--- /dev/null
+// $Id$
+/**
+* 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.navigation.handler;
+
+
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.model.reference.ReferenceBase;
+import eu.etaxonomy.taxeditor.dialogs.FilteredReferenceSelectionDialog;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+
+/**
+ * @author n.hoffmann
+ * @created 23.06.2009
+ * @version 1.0
+ */
+public class NewTaxonomicTreeWizardPage extends WizardPage implements ModifyListener {
+ private static final Logger logger = Logger
+ .getLogger(NewTaxonomicTreeWizardPage.class);
+
+ private Text text_treeLabel;
+
+ private Text text_reference;
+
+ private Button button_browseReference;
+
+ private UUID referenceUuid;
+
+ private Text text_microReference;
+
+ private ReferenceBase reference;
+
+ /**
+ * @param pageName
+ */
+ protected NewTaxonomicTreeWizardPage(String pageName) {
+ super(pageName);
+ this.setTitle("Taxonomic Tree");
+
+ this.setDescription("Create a new Taxonomic Tree.");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+
+ setPageComplete(false);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 3;
+ composite.setLayout(gridLayout);
+
+ CLabel label_treeLabel = new CLabel(composite, SWT.NULL);
+ label_treeLabel.setText("Label:");
+
+ text_treeLabel = new Text(composite, SWT.BORDER);
+ text_treeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+ text_treeLabel.addModifyListener(this);
+
+ // FIXME this is a rudimentary implementation. Add missing fields.
+
+ CLabel label_reference = new CLabel(composite, SWT.NULL);
+ label_reference.setText("Reference:");
+
+ text_reference = new Text(composite, SWT.BORDER);
+ text_reference.setEnabled(false);
+ text_reference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ button_browseReference = new Button(composite, SWT.PUSH);
+ button_browseReference.setText("Browse...");
+ button_browseReference.addMouseListener(new MouseAdapter(){
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
+ */
+ @Override
+ public void mouseUp(MouseEvent e) {
+ // TODO Auto-generated method stub
+ super.mouseUp(e);
+ logger.warn("Open reference search dialog");
+
+ reference = FilteredReferenceSelectionDialog.selectReference(NavigationUtil.getShell(), reference);
+
+ referenceUuid = reference.getUuid();
+
+ text_reference.setText(reference.getTitleCache());
+ }
+
+ });
+
+ CLabel label_microReference = new CLabel(composite, SWT.NULL);
+ label_microReference.setText("Reference Detail");
+
+ text_microReference = new Text(composite, SWT.BORDER);
+ text_microReference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+
+ setControl(composite);
+ }
+
+ /**
+ * @return the text_treeLabel
+ */
+ public String getTreeLabel() {
+ return text_treeLabel.getText();
+ }
+
+ /**
+ * @return
+ */
+ public String getMicroReference() {
+ return text_microReference.getText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ if(getTreeLabel().trim().length() > 0){
+ setPageComplete(true);
+ }
+ }
+
+ /**
+ * @return
+ */
+ public UUID getReferenceUuid() {
+ return referenceUuid;
+ }
+}