1 24 25 package org.objectweb.cjdbc.console.wizard; 26 27 import java.awt.GridBagConstraints ; 28 import java.awt.GridBagLayout ; 29 import java.util.ResourceBundle ; 30 import java.util.StringTokenizer ; 31 32 import javax.swing.BorderFactory ; 33 import javax.swing.JOptionPane ; 34 import javax.swing.JPanel ; 35 import javax.swing.border.BevelBorder ; 36 37 import org.objectweb.cjdbc.common.i18n.WizardTranslate; 38 import org.objectweb.cjdbc.console.wizard.listeners.WizardListener; 39 40 48 public abstract class WizardTab extends JPanel implements WizardListener 49 { 50 protected WizardTabs tabs; 51 protected GridBagConstraints constraints; 52 protected static ResourceBundle types; 53 54 60 public WizardTab(WizardTabs tabs, String name) 61 { 62 super(); 63 this.tabs = tabs; 64 this.setName(WizardTranslate.get(name)); 65 this.setLayout(new GridBagLayout ()); 66 this.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); 67 constraints = new GridBagConstraints (); 68 constraints.gridy = 0; 69 70 constraints.fill = GridBagConstraints.BOTH; 71 constraints.weightx = 1.0; 72 constraints.weighty = 1.0; 73 } 74 75 78 public void backendListChanged() 79 { 80 81 } 82 83 86 public void distributionChanged() 87 { 88 } 89 90 93 public void usersChanged() 94 { 95 96 } 97 98 103 public static final String [] getDatabasesTypes() 104 { 105 if (types == null) 106 types = ResourceBundle.getBundle("database"); 107 String typestring = types.getString("database.types"); 108 109 StringTokenizer token = new StringTokenizer (typestring, ","); 110 int tokens = token.countTokens(); 111 String [] databases = new String [tokens]; 112 int count = 0; 113 while (token.hasMoreTokens()) 114 { 115 databases[count] = token.nextToken(); 116 count++; 117 } 118 119 return databases; 120 } 121 122 127 public static String showBackendSelectDialog() 128 { 129 return (String ) JOptionPane.showInputDialog(null, WizardTranslate 130 .get("label.backend.select"), WizardTranslate 131 .get("label.backend.select"), JOptionPane.QUESTION_MESSAGE, null, 132 getDatabasesTypes(), null); 133 } 134 } | Popular Tags |