3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.datasource
.wizard
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.swt
.SWT
;
15 import org
.eclipse
.swt
.layout
.GridData
;
16 import org
.eclipse
.swt
.layout
.GridLayout
;
17 import org
.eclipse
.swt
.widgets
.Group
;
18 import org
.eclipse
.swt
.widgets
.Label
;
19 import org
.eclipse
.swt
.widgets
.Text
;
21 import eu
.etaxonomy
.cdm
.database
.CdmDataSource
;
22 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
29 public class CdmDataSourceMySQLWizardPage
extends CdmDataSourceCredentialsWizardPage
{
32 private static final Logger logger
= Logger
33 .getLogger(CdmDataSourceMySQLWizardPage
.class);
35 private Text text_port
;
36 private Text text_server
;
38 private String server
;
45 protected CdmDataSourceMySQLWizardPage(ICdmDataSource dataSource
) {
47 setTitle("MySQL Server");
48 setDescription("Enter credentials for MySQL database");
49 this.setDataSource(dataSource
);
53 * @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#createDatabaseForm()
56 public void createDatabaseForm() {
57 logger
.warn("Creating");
59 // Create group composite for location data
60 locationGroup
= new Group(composite
, SWT
.NONE
);
61 locationGroup
.setText("Location");
62 locationGroup
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 2, 1));
63 GridLayout locationLayout
= new GridLayout();
64 locationLayout
.numColumns
= 2;
65 locationGroup
.setLayout(locationLayout
);
68 Label serverLabel
= new Label(locationGroup
, SWT
.NONE
);
69 serverLabel
.setText("Host:");
72 text_server
= new Text(locationGroup
, SWT
.BORDER
);
73 text_server
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
74 text_server
.addModifyListener(this);
77 Label portLabel
= new Label(locationGroup
, SWT
.NONE
);
78 portLabel
.setText("Port:");
81 text_port
= new Text(locationGroup
, SWT
.BORDER
);
82 text_port
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
83 text_port
.addModifyListener(this);
88 * @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#updateLocation()
91 public void updateLocation() {
92 server
= text_server
.getText();
94 port
= new Integer(text_port
.getText());
95 }catch(NumberFormatException e
){
102 * @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#updateDataSource()
105 public void updateDataSource() {
106 setDataSource(CdmDataSource
.NewMySqlInstance(server
,
114 * @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#init()
118 if(getDataSource() != null){
119 modifyTextWithoutTriggeringListeners(text_server
, this, getDataSource().getServer());
120 modifyTextWithoutTriggeringListeners(text_port
, this, getDataSource().getPort()+"");