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("Enter credentials for MySQL database");
48 this.setDataSource(dataSource
);
52 * @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#createDatabaseForm()
55 public void createDatabaseForm() {
56 logger
.warn("Creating");
58 // Create group composite for location data
59 locationGroup
= new Group(composite
, SWT
.NONE
);
60 locationGroup
.setText("Location");
61 locationGroup
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 2, 1));
62 GridLayout locationLayout
= new GridLayout();
63 locationLayout
.numColumns
= 2;
64 locationGroup
.setLayout(locationLayout
);
67 Label serverLabel
= new Label(locationGroup
, SWT
.NONE
);
68 serverLabel
.setText("Host:");
71 text_server
= new Text(locationGroup
, SWT
.BORDER
);
72 text_server
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
73 text_server
.addModifyListener(this);
76 Label portLabel
= new Label(locationGroup
, SWT
.NONE
);
77 portLabel
.setText("Port:");
80 text_port
= new Text(locationGroup
, SWT
.BORDER
);
81 text_port
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
82 text_port
.addModifyListener(this);
84 if(getDataSource() != null){
85 text_server
.setText(getDataSource().getServer());
86 text_port
.setText(getDataSource().getPort()+"");
87 text_databaseName
.setText(getDataSource().getDatabase());
88 text_username
.setText(getDataSource().getUsername());
89 text_password
.setText(getDataSource().getPassword());
94 * @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#updateLocation()
97 public void updateLocation() {
98 server
= text_server
.getText();
99 port
= new Integer(text_port
.getText());
104 * @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#updateDataSource()
107 public void updateDataSource() {
108 setDataSource(CdmDataSource
.NewMySqlInstance(server
,
116 * @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#init()
120 if(getDataSource() != null){
121 modifyTextWithoutTriggeringListeners(text_server
, this, getDataSource().getServer());
122 modifyTextWithoutTriggeringListeners(text_port
, this, getDataSource().getPort()+"");