Public Member Functions | |
BackendTab (WizardTabs tabs) | |
void | setUsersComboBox () |
void | focusGained (FocusEvent e) |
void | usersChanged () |
void | focusLost (FocusEvent e) |
void | actionPerformed (ActionEvent e) |
void | itemStateChanged (ItemEvent e) |
ArrayList | getBackends () |
Public Attributes | |
JComboBox | backendsCombo |
WizardTab
Definition at line 65 of file BackendTab.java.
|
Creates a new
Definition at line 96 of file BackendTab.java. 00097 { 00098 super(tabs, WizardConstants.TAB_BACKENDS); 00099 00100 /////////////////////////////////////////////////////////////////////////// 00101 // list panel 00102 /////////////////////////////////////////////////////////////////////////// 00103 JPanel list = new JPanel(); 00104 list.setBorder(BorderFactory.createTitledBorder(WizardTranslate 00105 .get("label.list"))); 00106 list.setLayout(new GridBagLayout()); 00107 GridBagConstraints listconstraints = new GridBagConstraints(); 00108 listconstraints.fill = GridBagConstraints.HORIZONTAL; 00109 00110 listconstraints.weightx = 1.0; 00111 listconstraints.weighty = 1.0; 00112 listconstraints.gridy = 0; 00113 listconstraints.gridwidth = 2; 00114 00115 backendsCombo = new JComboBox(new Object[]{}); 00116 backendsCombo.addItemListener(this); 00117 00118 list.add(backendsCombo, listconstraints); 00119 00120 listconstraints.gridy = ++listconstraints.gridy; 00121 listconstraints.gridwidth = 1; 00122 00123 listconstraints.gridx = 0; 00124 buttonAdd = new JButton(WizardTranslate.get("label.addbackend")); 00125 buttonAdd.setActionCommand(WizardConstants.COMMAND_ADD_BACKEND); 00126 buttonAdd.addActionListener(this); 00127 list.add(buttonAdd, listconstraints); 00128 00129 listconstraints.gridx = 1; 00130 buttonRemove = new JButton(WizardTranslate.get("label.removebackend")); 00131 buttonRemove.setActionCommand(WizardConstants.COMMAND_REMOVE_BACKEND); 00132 buttonRemove.addActionListener(this); 00133 list.add(buttonRemove, listconstraints); 00134 00135 this.add(list, constraints); 00136 00137 constraints.gridy = ++constraints.gridy; 00138 00139 /////////////////////////////////////////////////////////////////////////// 00140 // general panel 00141 /////////////////////////////////////////////////////////////////////////// 00142 JPanel general = new JPanel(); 00143 general.setBorder(BorderFactory.createTitledBorder(WizardTranslate 00144 .get("label.general"))); 00145 general.setLayout(new GridBagLayout()); 00146 GridBagConstraints generalconstraints = new GridBagConstraints(); 00147 generalconstraints.fill = GridBagConstraints.HORIZONTAL; 00148 generalconstraints.weightx = 1.0; 00149 00150 generalconstraints.gridy = ++generalconstraints.gridy; 00151 generalconstraints.gridx = 0; 00152 general.add(new JLabel(WizardTranslate.get("label.backendName")), 00153 generalconstraints); 00154 generalconstraints.gridx = 1; 00155 backendName = new JTextField(); 00156 backendName.addFocusListener(this); 00157 general.add(backendName, generalconstraints); 00158 00159 generalconstraints.gridy = ++generalconstraints.gridy; 00160 generalconstraints.gridx = 0; 00161 general.add(new JLabel(WizardTranslate.get("label.backendUrl")), 00162 generalconstraints); 00163 generalconstraints.gridx = 1; 00164 backendUrl = new JTextField(); 00165 backendUrl.addFocusListener(this); 00166 general.add(backendUrl, generalconstraints); 00167 00168 generalconstraints.gridy = ++generalconstraints.gridy; 00169 generalconstraints.gridx = 0; 00170 general.add(new JLabel(WizardTranslate.get("label.backendDriver")), 00171 generalconstraints); 00172 generalconstraints.gridx = 1; 00173 backendDriver = new JTextField(); 00174 backendDriver.addFocusListener(this); 00175 general.add(backendDriver, generalconstraints); 00176 00177 generalconstraints.gridy = ++generalconstraints.gridy; 00178 generalconstraints.gridx = 0; 00179 general.add(new JLabel(WizardTranslate.get("label.backendDriverPath")), 00180 generalconstraints); 00181 generalconstraints.gridx = 1; 00182 backendDriverPath = new JTextField(); 00183 backendDriverPath.addFocusListener(this); 00184 general.add(backendDriverPath, generalconstraints); 00185 00186 generalconstraints.gridy = ++generalconstraints.gridy; 00187 generalconstraints.gridx = 0; 00188 general.add(new JLabel(WizardTranslate.get("label.backendStatement")), 00189 generalconstraints); 00190 generalconstraints.gridx = 1; 00191 backendStatement = new JTextField(); 00192 backendStatement.addFocusListener(this); 00193 general.add(backendStatement, generalconstraints); 00194 00195 generalconstraints.gridy = ++generalconstraints.gridy; 00196 generalconstraints.gridx = 0; 00197 general.add(new JLabel(WizardTranslate.get("label.gatherSystemTables")), 00198 generalconstraints); 00199 generalconstraints.gridx = 1; 00200 gatherSystemTables = new JCheckBox(); 00201 gatherSystemTables.setName("label.gatherSystemTables"); 00202 gatherSystemTables.addFocusListener(this); 00203 general.add(gatherSystemTables, generalconstraints); 00204 00205 generalconstraints.gridy = ++generalconstraints.gridy; 00206 dynamicPrecision = new JComboBox(WizardConstants.DYNAMIC_PRECISION); 00207 dynamicPrecision.setSelectedItem(WizardConstants.DEFAULT_DYNAMIC_PRECISION); 00208 dynamicPrecision.addItemListener(this); 00209 dynamicPrecision.addFocusListener(this); 00210 generalconstraints.gridx = 0; 00211 general.add(new JLabel(WizardTranslate.get("label.dynamicPrecision")), 00212 generalconstraints); 00213 generalconstraints.gridx = 1; 00214 general.add(dynamicPrecision, generalconstraints); 00215 00216 this.add(general, constraints); 00217 00218 constraints.gridy = ++constraints.gridy; 00219 00220 /////////////////////////////////////////////////////////////////////////// 00221 // Connection managers 00222 /////////////////////////////////////////////////////////////////////////// 00223 00224 connections = new JPanel(); 00225 connections.setBorder(BorderFactory.createTitledBorder(WizardTranslate 00226 .get("label.connections"))); 00227 connections.setLayout(new GridBagLayout()); 00228 connectionconstraints = new GridBagConstraints(); 00229 connectionconstraints.fill = GridBagConstraints.HORIZONTAL; 00230 connectionconstraints.weightx = 1.0; 00231 00232 // users list 00233 setUsersComboBox(); 00234 00235 // rLogin 00236 connectionconstraints.gridy = ++connectionconstraints.gridy; 00237 connectionconstraints.gridx = 0; 00238 connections.add(new JLabel(WizardTranslate.get("label.rLogin")), 00239 connectionconstraints); 00240 connectionconstraints.gridx = 1; 00241 rLogin = new JTextField(); 00242 rLogin.addFocusListener(this); 00243 connections.add(rLogin, connectionconstraints); 00244 00245 // rPassword 00246 connectionconstraints.gridy = ++connectionconstraints.gridy; 00247 connectionconstraints.gridx = 0; 00248 connections.add(new JLabel(WizardTranslate.get("label.rPassword")), 00249 connectionconstraints); 00250 connectionconstraints.gridx = 1; 00251 rPassword = new JTextField(); 00252 rPassword.addFocusListener(this); 00253 connections.add(rPassword, connectionconstraints); 00254 00255 // urlparameters 00256 connectionconstraints.gridy = ++connectionconstraints.gridy; 00257 connectionconstraints.gridx = 0; 00258 connections.add(new JLabel(WizardTranslate.get("label.urlparameters")), 00259 connectionconstraints); 00260 connectionconstraints.gridx = 1; 00261 urlparameters = new JTextField(); 00262 urlparameters.addFocusListener(this); 00263 connections.add(urlparameters, connectionconstraints); 00264 00265 // connectiontype 00266 connectionconstraints.gridy = ++connectionconstraints.gridy; 00267 connectiontype = new JComboBox(WizardConstants.CONNECTION_MANAGERS); 00268 connectionconstraints.gridx = 0; 00269 connectiontype.addFocusListener(this); 00270 connectiontype.addItemListener(this); 00271 connections.add(new JLabel(WizardTranslate.get("label.connectiontype")), 00272 connectionconstraints); 00273 connectionconstraints.gridx = 1; 00274 connections.add(connectiontype, connectionconstraints); 00275 00276 // edit connection parameters 00277 connectionconstraints.gridy = ++connectionconstraints.gridy; 00278 connectionParameter = new JButton(WizardTranslate 00279 .get("label.edit.connection.parameters")); 00280 connectionParameter 00281 .setActionCommand(WizardConstants.COMMAND_EDIT_CONNECTION_PARAM); 00282 connectionconstraints.gridx = 1; 00283 connectionParameter.setEnabled(false); 00284 connectionParameter.addActionListener(this); 00285 connections.add(connectionParameter, connectionconstraints); 00286 00287 this.add(connections, constraints); 00288 00289 }
|
|
Definition at line 377 of file BackendTab.java. References org.objectweb.cjdbc.console.wizard.WizardTabs.backendListChanged(), org.objectweb.cjdbc.console.wizard.objects.Backend.getConnectionManagers(), org.objectweb.cjdbc.console.wizard.objects.ConnectionInfo.getConnectionTypeInfo(), org.objectweb.cjdbc.console.wizard.objects.ConnectionParameterDialog.getValues(), org.objectweb.cjdbc.console.wizard.objects.Backend.setConnectionManagers(), org.objectweb.cjdbc.console.wizard.objects.Backend.setConnectionTestStatement(), org.objectweb.cjdbc.console.wizard.objects.ConnectionInfo.setConnectionTypeInfo(), org.objectweb.cjdbc.console.wizard.objects.Backend.setDriver(), org.objectweb.cjdbc.console.wizard.objects.Backend.setName(), org.objectweb.cjdbc.console.wizard.objects.ConnectionTypeInfo.setType(), org.objectweb.cjdbc.console.wizard.objects.Backend.setUrl(), and org.objectweb.cjdbc.console.wizard.objects.ConnectionTypeInfo.setValues(). 00378 { 00379 String command = e.getActionCommand(); 00380 00381 if (command.equals(WizardConstants.COMMAND_ADD_BACKEND)) 00382 { 00383 00384 String select = WizardTab.showBackendSelectDialog(); 00385 Backend backend = new Backend(); 00386 00387 if (select != null) 00388 { 00389 backend.setName(select + backendsCombo.getItemCount()); 00390 backend.setUrl(types.getString(select + ".url")); 00391 backend.setDriver(types.getString(select + ".driver")); 00392 backend.setConnectionTestStatement(types.getString(select 00393 + ".statement")); 00394 } 00395 00396 backendsCombo.addItem(backend); 00397 backendsCombo.setSelectedItem(backend); 00398 backendsCombo.validate(); 00399 tabs.backendListChanged(); 00400 } 00401 else if (command.equals(WizardConstants.COMMAND_REMOVE_BACKEND)) 00402 { 00403 Backend backend = (Backend) backendsCombo.getSelectedItem(); 00404 backendsCombo.removeItem(backend); 00405 backendsCombo.validate(); 00406 backendsCombo.repaint(); 00407 tabs.backendListChanged(); 00408 } 00409 else if (command.equals(WizardConstants.COMMAND_EDIT_CONNECTION_PARAM)) 00410 { 00411 Backend backend = (Backend) backendsCombo.getSelectedItem(); 00412 User user = (User) users.getSelectedItem(); 00413 if (backend == null || user == null) 00414 return; 00415 00416 Hashtable managers = backend.getConnectionManagers(); 00417 ConnectionInfo info = ((ConnectionInfo) managers.get(user)); 00418 ConnectionTypeInfo infoType; 00419 if (info == null) 00420 { 00421 info = new ConnectionInfo(); 00422 infoType = new ConnectionTypeInfo(); 00423 infoType.setType((String) connectiontype.getSelectedItem()); 00424 info.setConnectionTypeInfo(infoType); 00425 managers.put(user, info); 00426 } 00427 else 00428 infoType = info.getConnectionTypeInfo(); 00429 00430 ConnectionParameterDialog cpd = new ConnectionParameterDialog(infoType); 00431 00432 infoType.setValues(cpd.getValues()); 00433 info.setConnectionTypeInfo(infoType); 00434 managers.put(user, info); 00435 backend.setConnectionManagers(managers); 00436 } 00437 00438 }
|
|
Definition at line 308 of file BackendTab.java. 00309 { 00310 00311 }
|
|
Definition at line 324 of file BackendTab.java. References org.objectweb.cjdbc.console.wizard.objects.Backend.setConnectionTestStatement(), org.objectweb.cjdbc.console.wizard.objects.Backend.setDriver(), org.objectweb.cjdbc.console.wizard.objects.Backend.setDriverPath(), org.objectweb.cjdbc.console.wizard.objects.Backend.setDynamicPrecision(), org.objectweb.cjdbc.console.wizard.objects.Backend.setGatherSystemTables(), org.objectweb.cjdbc.console.wizard.objects.Backend.setName(), and org.objectweb.cjdbc.console.wizard.objects.Backend.setUrl(). 00325 { 00326 Backend backend = ((Backend) backendsCombo.getSelectedItem()); 00327 if (backend == null) 00328 return; 00329 backend.setName(backendName.getText()); 00330 backend.setUrl(backendUrl.getText()); 00331 backend.setConnectionTestStatement(backendStatement.getText()); 00332 backend.setDriver(backendDriver.getText()); 00333 backend.setDriverPath(backendDriverPath.getText()); 00334 String string = (String) dynamicPrecision.getSelectedItem(); 00335 backend.setDynamicPrecision(string); 00336 if (gatherSystemTables.isSelected()) 00337 backend.setGatherSystemTables("true"); 00338 else 00339 backend.setGatherSystemTables(null); 00340 00341 setBackendInfo(); 00342 backendsCombo.repaint(); 00343 }
|
|
Get the list of backends
Definition at line 512 of file BackendTab.java. 00513 { 00514 return WizardConstants.getItemsFromCombo(this.backendsCombo); 00515 }
|
|
Definition at line 443 of file BackendTab.java. References org.objectweb.cjdbc.console.wizard.objects.Backend.getConnectionManagers(), org.objectweb.cjdbc.console.wizard.objects.Backend.getConnectionTestStatement(), org.objectweb.cjdbc.console.wizard.objects.ConnectionInfo.getConnectionTypeInfo(), org.objectweb.cjdbc.console.wizard.objects.Backend.getDriver(), org.objectweb.cjdbc.console.wizard.objects.Backend.getDriverPath(), org.objectweb.cjdbc.console.wizard.objects.Backend.getDynamicPrecision(), org.objectweb.cjdbc.console.wizard.objects.Backend.getGatherSystemTables(), org.objectweb.cjdbc.console.wizard.objects.Backend.getName(), org.objectweb.cjdbc.console.wizard.objects.ConnectionInfo.getRLogin(), org.objectweb.cjdbc.console.wizard.objects.ConnectionInfo.getRPassword(), org.objectweb.cjdbc.console.wizard.objects.ConnectionTypeInfo.getType(), org.objectweb.cjdbc.console.wizard.objects.Backend.getUrl(), and org.objectweb.cjdbc.console.wizard.objects.ConnectionInfo.getUrlParameters(). 00444 { 00445 JComponent comp = (JComponent) e.getSource(); 00446 if (comp == dynamicPrecision) 00447 return; 00448 00449 Backend backend = (Backend) backendsCombo.getSelectedItem(); 00450 // selected user changed load it from backend 00451 User user = (User) users.getSelectedItem(); 00452 if (user == null || backend == null) 00453 return; 00454 00455 Hashtable con = backend.getConnectionManagers(); 00456 ConnectionInfo info = (ConnectionInfo) con.get(user); 00457 00458 if (info == null) 00459 { 00460 info = new ConnectionInfo(); 00461 } 00462 00463 if (comp == connectiontype) 00464 { 00465 int selectedIndex = connectiontype.getSelectedIndex(); 00466 if (selectedIndex == 0) 00467 connectionParameter.setEnabled(false); 00468 else 00469 connectionParameter.setEnabled(true); 00470 connectionParameter.repaint(); 00471 return; 00472 } 00473 00474 rLogin.setText(info.getRLogin()); 00475 rPassword.setText(info.getRPassword()); 00476 urlparameters.setText(info.getUrlParameters()); 00477 connectiontype.setSelectedItem(info.getConnectionTypeInfo().getType()); 00478 00479 if (backend == null) 00480 { 00481 backendName.setText(""); 00482 backendUrl.setText(""); 00483 backendDriver.setText(""); 00484 backendDriverPath.setText(""); 00485 backendStatement.setText(""); 00486 gatherSystemTables.setSelected(false); 00487 dynamicPrecision 00488 .setSelectedItem(WizardConstants.DEFAULT_DYNAMIC_PRECISION); 00489 } 00490 else 00491 { 00492 backendName.setText(backend.getName()); 00493 backendUrl.setText(backend.getUrl()); 00494 backendDriver.setText(backend.getDriver()); 00495 backendDriverPath.setText(backend.getDriverPath()); 00496 backendStatement.setText(backend.getConnectionTestStatement()); 00497 gatherSystemTables.setSelected(backend.getGatherSystemTables() != null); 00498 if (backend.getDynamicPrecision() == null) 00499 dynamicPrecision 00500 .setSelectedItem(WizardConstants.DEFAULT_DYNAMIC_PRECISION); 00501 else 00502 dynamicPrecision.setSelectedItem(backend.getDynamicPrecision()); 00503 } 00504 00505 }
|
|
Reimplemented from org.objectweb.cjdbc.console.wizard.WizardTab. Definition at line 316 of file BackendTab.java. 00317 { 00318 setUsersComboBox(); 00319 }
|