ref #9190: rename webapp to local
[taxeditor.git] / eu.etaxonomy.taxeditor.webapp / src / main / java / eu / etaxonomy / taxeditor / local / datasource / wizard / CdmDataSourceMySQLWizardPage.java
diff --git a/eu.etaxonomy.taxeditor.webapp/src/main/java/eu/etaxonomy/taxeditor/local/datasource/wizard/CdmDataSourceMySQLWizardPage.java b/eu.etaxonomy.taxeditor.webapp/src/main/java/eu/etaxonomy/taxeditor/local/datasource/wizard/CdmDataSourceMySQLWizardPage.java
deleted file mode 100644 (file)
index 5510aff..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.local.datasource.wizard;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-import eu.etaxonomy.cdm.database.CdmDataSource;
-import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
-
-/**
- * <p>CdmDataSourceMySQLWizardPage class.</p>
- *
- * @author n.hoffmann
- * @created 19.05.2009
- */
-public class CdmDataSourceMySQLWizardPage extends CdmDataSourceCredentialsWizardPage {
-
-       private Text text_port;
-       private Text text_server;
-
-       private String server;
-
-       private int port;
-
-
-
-       /**
-        * <p>Constructor for CdmDataSourceMySQLWizardPage.</p>
-        *
-        * @param dataSource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
-        */
-       @Deprecated
-       protected CdmDataSourceMySQLWizardPage(ICdmDataSource dataSource) {
-               super("MySQL", dataSource, CdmDataSourceWizard.Mode.CREATE);
-               setTitle("MySQL Server");
-               setDescription("Enter credentials for MySQL database");
-
-       }
-
-       /**
-        * <p>Constructor for CdmDataSourceMySQLWizardPage.</p>
-        *
-        * @param dataSource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
-        * @param mode a {@link eu.etaxonomy.taxeditor.webapp.datasource.common.wizard.CdmDataSourceWizard.Mode} enum type.
-        */
-       protected CdmDataSourceMySQLWizardPage(ICdmDataSource dataSource, CdmDataSourceWizard.Mode mode) {
-               super("MySQL", dataSource, mode);
-               setTitle("MySQL Server");
-               setDescription("Enter credentials for MySQL database");
-
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void createDatabaseForm() {
-               // Create group composite for location data
-               locationGroup = new Group(composite, SWT.NONE);
-               locationGroup.setText("Location");
-               locationGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 2));
-               GridLayout locationLayout = new GridLayout();
-               locationLayout.numColumns = 2;
-               locationGroup.setLayout(locationLayout);
-
-               // Create host label
-               Label serverLabel = new Label(locationGroup, SWT.NONE);
-               serverLabel.setText("Host:");
-
-               // Create host input
-               text_server = new Text(locationGroup, SWT.BORDER);
-               text_server.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
-
-               // Create port label
-               Label portLabel = new Label(locationGroup, SWT.NONE);
-               portLabel.setText("Port:");
-
-               // Create port input
-               text_port = new Text(locationGroup, SWT.BORDER);
-               text_port.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
-
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void updateLocation() {
-               server = text_server.getText();
-               try{
-                       if(! text_port.getText().equals("")){
-                               port = new Integer(text_port.getText());
-                               setErrorMessage(null);
-                       }
-               }catch(NumberFormatException e){
-                       setErrorMessage("Port number contains invalid characters");
-               }
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void updateDataSource() {
-               ICdmDataSource dataSource = getDataSource();
-
-               if(dataSource == null) {
-                       setDataSource(CdmDataSource.NewMySqlInstance(server,
-                                       database,
-                                       port,
-                                       username,
-                                       password));
-               } else {
-                       dataSource.setName(name);
-                       dataSource.setServer(server);
-                       dataSource.setDatabase(database);
-                       dataSource.setPort(port);
-                       dataSource.setUsername(username);
-                       dataSource.setPassword(password);
-               }
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void checkPageComplete() {
-               // check if widgets of this component are complete
-               boolean complete = server.trim().length() != 0;
-
-               // set default port
-               if(port == 0){
-                       port = DatabaseTypeEnum.MySQL.getDefaultPort();
-               }
-
-               setPageComplete(complete);
-
-               // check if widgets of the extended class are complete
-               super.checkPageComplete();
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void init() {
-               super.init();
-               if(getDataSource() != null){
-                       removeListeners();
-                       text_server.setText(getDataSource().getServer());
-                       text_port.setText(String.valueOf(getDataSource().getPort()));
-                       // add listeners after setting text to avoid the modify event being called
-                       // for the initial value
-                       addListeners();
-               }
-
-       }
-
-       private void addListeners() {
-               text_server.addModifyListener(this);
-               text_port.addModifyListener(this);
-       }
-
-       private void removeListeners() {
-               text_server.removeModifyListener(this);
-               text_port.removeModifyListener(this);
-       }
-}