Updated filtered selection dialogs to 1) pass up an existing value and 2) create...
authorp.ciardelli <p.ciardelli@localhost>
Tue, 22 Sep 2009 08:32:08 +0000 (08:32 +0000)
committerp.ciardelli <p.ciardelli@localhost>
Tue, 22 Sep 2009 08:32:08 +0000 (08:32 +0000)
.gitattributes
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizard.java
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizardPage.java [new file with mode: 0644]

index 29f6c74a1078f750960773d9d94f2cde8f80130d..5c4a9ebaedf0635ccba603a9fe0226284dca33af 100644 (file)
@@ -899,6 +899,7 @@ taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/Edi
 taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/MoveTaxonHandler.java -text
 taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizadPage.java -text
 taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizard.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizardPage.java -text
 taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/QuickCreateChildTaxonHandler.java -text
 taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/RefreshTreeHandler.java -text
 taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/ShowTaxonomicTreeViewHandler.java -text
index 9c27bcf116bea93480090897218050fdf90d0b8d..ec48d9a75e3be663bb997bc8a4a319ff9d27d396 100644 (file)
@@ -33,7 +33,7 @@ public class NewTaxonomicTreeWizard extends Wizard implements INewWizard {
 
        public static final String NEW_TAXONOMIC_TREE = "NEW_TAXONOMIC_TREE";
 
-       private NewTaxonomicTreeWizadPage page;
+       private NewTaxonomicTreeWizardPage page;
        
        /**
         * 
@@ -49,7 +49,7 @@ public class NewTaxonomicTreeWizard extends Wizard implements INewWizard {
        public void addPages() {
                super.addPages();
                
-               page = new NewTaxonomicTreeWizadPage(NEW_TAXONOMIC_TREE);
+               page = new NewTaxonomicTreeWizardPage(NEW_TAXONOMIC_TREE);
                
                addPage(page);
        }
diff --git a/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizardPage.java b/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizardPage.java
new file mode 100644 (file)
index 0000000..2e170e3
--- /dev/null
@@ -0,0 +1,153 @@
+// $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;
+       }
+}