Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

WizardTab.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Nicolas Modrzyk.
00022  * Contributor(s): ______________________.
00023  */
00024 
00025 package org.objectweb.cjdbc.console.wizard;
00026 
00027 import java.awt.GridBagConstraints;
00028 import java.awt.GridBagLayout;
00029 import java.util.ResourceBundle;
00030 import java.util.StringTokenizer;
00031 
00032 import javax.swing.BorderFactory;
00033 import javax.swing.JOptionPane;
00034 import javax.swing.JPanel;
00035 import javax.swing.border.BevelBorder;
00036 
00037 import org.objectweb.cjdbc.common.i18n.WizardTranslate;
00038 import org.objectweb.cjdbc.console.wizard.listeners.WizardListener;
00039 
00040 /**
00041  * This is the asbtract class used to define tabs in the wizard. A tab is used
00042  * to write and fill the necessary configuration of a particular point of the
00043  * virtual database xml configuration file.
00044  * 
00045  * @author <a href="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
00046  * @version 1.0
00047  */
00048 public abstract class WizardTab extends JPanel implements WizardListener
00049 {
00050   protected WizardTabs            tabs;
00051   protected GridBagConstraints    constraints;
00052   protected static ResourceBundle types;
00053 
00054   public WizardTab(WizardTabs tabs, String name)
00055   {
00056     super();
00057     this.tabs = tabs;
00058     this.setName(WizardTranslate.get(name));
00059     this.setLayout(new GridBagLayout());
00060     this.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
00061     constraints = new GridBagConstraints();
00062     constraints.gridy = 0;
00063 
00064     constraints.fill = GridBagConstraints.BOTH;
00065     constraints.weightx = 1.0;
00066     constraints.weighty = 1.0;
00067   }
00068 
00069   /**
00070    * @see org.objectweb.cjdbc.console.wizard.listeners.WizardListener#backendListChanged()
00071    */
00072   public void backendListChanged()
00073   {
00074 
00075   }
00076 
00077   /**
00078    * @see org.objectweb.cjdbc.console.wizard.listeners.WizardListener#distributionChanged()
00079    */
00080   public void distributionChanged()
00081   {
00082   }
00083 
00084   /**
00085    * @see org.objectweb.cjdbc.console.wizard.listeners.WizardListener#usersChanged()
00086    */
00087   public void usersChanged()
00088   {
00089 
00090   }
00091 
00092   public static final String[] getDatabasesTypes()
00093   {
00094     if (types == null)
00095       types = ResourceBundle.getBundle("database");
00096     String typestring = types.getString("database.types");
00097 
00098     StringTokenizer token = new StringTokenizer(typestring, ",");
00099     int tokens = token.countTokens();
00100     String[] databases = new String[tokens];
00101     int count = 0;
00102     while (token.hasMoreTokens())
00103     {
00104       databases[count] = token.nextToken();
00105       count++;
00106     }
00107 
00108     return databases;
00109   }
00110 
00111   /**
00112    * Show backend select dialog
00113    * 
00114    * @return the selected backend
00115    */
00116   public static String showBackendSelectDialog()
00117   {
00118     return (String) JOptionPane.showInputDialog(null, WizardTranslate
00119         .get("label.backend.select"), WizardTranslate
00120         .get("label.backend.select"), JOptionPane.QUESTION_MESSAGE, null,
00121         getDatabasesTypes(), null);
00122   }
00123 }

Generated on Mon Apr 11 22:01:35 2005 for C-JDBC by  doxygen 1.3.9.1