private String getConnStringForDriver( Driver _drv, String _host, String _port, String _db, String _user, String _pw) { if (_drv instanceof AlphanumericDBDriver) { logger.error("Returned null conn str (OK) for: " + _drv.getClass().getName()); return null; } else { if (_drv instanceof IVectorialDatabaseDriver) { IVectorialDatabaseDriver geo_driver = (IVectorialDatabaseDriver) _drv; return geo_driver.getConnectionString(_host, _port, _db, _user, _pw); } else { logger.error("Unexpected driver type: " + _drv.getClass().getName()); return null; } } }
public void actionPerformed(ActionEvent arg0) { Object src = arg0.getSource(); if (src == connectedCheckBox) { if (connectedCheckBox.isSelected()) { passwordField.setEnabled(true); passwordField.setBackground(Color.WHITE); } else { passwordField.setText(""); passwordField.setEnabled(false); passwordField.setBackground(Color.LIGHT_GRAY); } } if (src == okButton) { okPressed = true; PluginServices.getMDIManager().closeWindow(this); return; } if (src == cancelButton) { okPressed = false; PluginServices.getMDIManager().closeWindow(this); return; } if (src == driverComboBox) { String driverName = driverComboBox.getSelectedItem().toString(); IVectorialDatabaseDriver driver; try { driver = (IVectorialDatabaseDriver) LayerFactory.getDM().getDriver(driverName); portTextField.setText("" + driver.getDefaultPort()); } catch (DriverLoadException e1) { portTextField.setText(""); } return; } }