Fix some labels and handle toggle states
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 2 Nov 2015 13:55:56 +0000 (14:55 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 2 Nov 2015 14:01:52 +0000 (15:01 +0100)
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateFieldUnitContextMenu.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchComposite.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java

index e27ca38dbe2c520bc14282ee84d4dbddf612d114..97d534dec393cee5b10c5847ec005d388a44b9f7 100644 (file)
          <command
                commandId="eu.etaxonomy.taxeditor.editor.derivative.listenToSelectionChange"
                icon="icons/synced.gif"
          <command
                commandId="eu.etaxonomy.taxeditor.editor.derivative.listenToSelectionChange"
                icon="icons/synced.gif"
-               label="Link with Editor"
+               label="Link with Taxon Editor"
                style="toggle">
             <visibleWhen
                   checkEnabled="false">
                style="toggle">
             <visibleWhen
                   checkEnabled="false">
index f63569495046fc8e457fc53a4ccc93993c11607e..6c7d81cd11865c72f4e3cbeda7cc82046289a9cd 100644 (file)
@@ -48,7 +48,6 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.Messages;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.Messages;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
 import eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter.DerivateSearchCompositeController;
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter.DerivateSearchCompositeController;
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
@@ -464,11 +463,12 @@ public class DerivateView extends AbstractCdmViewPart implements IPartContentHas
                     uuids.add(specimenOrObservationBase.getUuid());
                 }
                 updateRootEntities(uuids);
                     uuids.add(specimenOrObservationBase.getUuid());
                 }
                 updateRootEntities(uuids);
+                derivateSearchCompositeController.setTaxon(selectedTaxon);
+                setPartName("Derivative Editor: " + selectedTaxon.getName());
             }
             }
-            if(part instanceof MultiPageTaxonEditor){
-                Taxon taxon = ((MultiPageTaxonEditor) part).getTaxon();
-                derivateSearchCompositeController.setTaxon(taxon);
-            }
+//            if(part instanceof MultiPageTaxonEditor){
+//                Taxon taxon = ((MultiPageTaxonEditor) part).getTaxon();
+//            }
         }
     }
 
         }
     }
 
@@ -502,6 +502,10 @@ public class DerivateView extends AbstractCdmViewPart implements IPartContentHas
         derivateSearchCompositeController.setTaxon(null);
         if(!listenToSelectionChange){
             selectedTaxon = null;
         derivateSearchCompositeController.setTaxon(null);
         if(!listenToSelectionChange){
             selectedTaxon = null;
+            setPartName("Derivative Editor");
+        }
+        else if(selectedTaxon==null){
+            setPartName("Derivative Editor [no taxon selected]");
         }
     }
 
         }
     }
 
index 589869ab44f37098ede72b244374fb0586d85a94..838e5c081411dd4b4eda74c7361ad64049d4fd4a 100644 (file)
@@ -49,7 +49,7 @@ public class CreateFieldUnitContextMenu extends CompoundContributionItem {
                                 if(selectionInput instanceof CdmBase && ((CdmBase) selectionInput).isInstanceOf(Taxon.class)){
                                     final Taxon taxon = HibernateProxyHelper.deproxy(selectionInput, Taxon.class);
                                     MenuItem item = new MenuItem(menu, SWT.NONE);
                                 if(selectionInput instanceof CdmBase && ((CdmBase) selectionInput).isInstanceOf(Taxon.class)){
                                     final Taxon taxon = HibernateProxyHelper.deproxy(selectionInput, Taxon.class);
                                     MenuItem item = new MenuItem(menu, SWT.NONE);
-                                    item.setText("Create FieldUnit (attach to "+taxon.getTitleCache()+")");
+                                    item.setText("Create FieldUnit for "+taxon.getName());
                                     item.addSelectionListener(new SelectionAdapter() {
                                         @Override
                                         public void widgetSelected(SelectionEvent e) {
                                     item.addSelectionListener(new SelectionAdapter() {
                                         @Override
                                         public void widgetSelected(SelectionEvent e) {
index 36d23173ffb72ae5fe5807cf0c8c7ad032533404..b34b7ab192b7a03c6a02cf44ea3080237f1e2d74 100644 (file)
@@ -152,4 +152,8 @@ public class DerivateSearchComposite extends Composite {
     public Combo getComboTaxonAssignment() {
         return comboTaxonAssignment;
     }
     public Combo getComboTaxonAssignment() {
         return comboTaxonAssignment;
     }
+
+    public Label getLbltaxonAssignment() {
+        return lbltaxonAssignment;
+    }
 }
 }
index b70fec2607b2977d94007d7fe4165b7f2fe7c63b..153bc2974fb696ff108304ad8db5053600ad504d 100644 (file)
@@ -135,10 +135,16 @@ public class DerivateSearchCompositeController implements Listener{
             if(selectedTaxon!=null){
                 derivateSearchComposite.getTextTaxonName().setText(selectedTaxon.getTitleCache());
             }
             if(selectedTaxon!=null){
                 derivateSearchComposite.getTextTaxonName().setText(selectedTaxon.getTitleCache());
             }
+            derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ASSIGNED_SPECIMENS);
+            derivateSearchComposite.getComboTaxonAssignment().setEnabled(false);
+            derivateSearchComposite.getLbltaxonAssignment().setEnabled(false);
         }
         else if(eventSource==derivateSearchComposite.getBtnClearTaxon()){
             selectedTaxon = null;
             derivateSearchComposite.getTextTaxonName().setText("");
         }
         else if(eventSource==derivateSearchComposite.getBtnClearTaxon()){
             selectedTaxon = null;
             derivateSearchComposite.getTextTaxonName().setText("");
+            derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ALL_SPECIMENS);
+            derivateSearchComposite.getComboTaxonAssignment().setEnabled(true);
+            derivateSearchComposite.getLbltaxonAssignment().setEnabled(true);
         }
     }
 
         }
     }
 
@@ -178,9 +184,11 @@ public class DerivateSearchCompositeController implements Listener{
     public void setTaxon(Taxon taxon) {
         if(taxon==null){
             derivateSearchComposite.getTextTaxonName().setText("");
     public void setTaxon(Taxon taxon) {
         if(taxon==null){
             derivateSearchComposite.getTextTaxonName().setText("");
+            derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ALL_SPECIMENS);
         }
         else{
             derivateSearchComposite.getTextTaxonName().setText(taxon.getTitleCache());
         }
         else{
             derivateSearchComposite.getTextTaxonName().setText(taxon.getTitleCache());
+            derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ASSIGNED_SPECIMENS);
         }
     }
 
         }
     }