- added special case handling for DerivateEditor so that the DetailsView only show...
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 9 Dec 2014 15:52:02 +0000 (15:52 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 9 Dec 2014 15:52:02 +0000 (15:52 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index acd4690a3b9b01856249247e6bf24790eaae012c..665e6e12a781223e90751f6134799ac6928522d7 100644 (file)
@@ -40,6 +40,8 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 public class DerivedUnitGeneralDetailElement extends
                AbstractCdmDetailElement<DerivedUnitFacade> {
 
+    boolean showOnlyDerivedUnitData = false;
+
        private ToggleableTextElement toggleableText_titleCache;
        private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
        private EntitySelectionElement<NamedArea> selection_country;
@@ -54,14 +56,13 @@ public class DerivedUnitGeneralDetailElement extends
        private GatheringEventUnitElement element_elevation;
 
 
-
        /**
         * @param formFactory
         * @param formElement
         */
        public DerivedUnitGeneralDetailElement(CdmFormFactory formFactory,
                        ICdmFormElement formElement) {
-               super(formFactory, formElement);
+           super(formFactory, formElement);
        }
 
        /*
@@ -77,7 +78,11 @@ public class DerivedUnitGeneralDetailElement extends
                toggleableText_titleCache = formFactory.createToggleableTextField(
                                formElement, "Title Cache", entity.getTitleCache(),
                                entity.isProtectedTitleCache(), style);
-               if((AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
+        //TODO for DerivateEditor do not use facade anyore to avoid this special case handling #4539
+               if(showOnlyDerivedUnitData){
+                   toggleableText_titleCache.setEnabled(false);
+               }
+               else{
                    combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
                    combo_specorobstype.setSelection(entity.getType());
                    selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
@@ -101,9 +106,6 @@ public class DerivedUnitGeneralDetailElement extends
                    text_collectingNumber = formFactory.createTextWithLabelElement(formElement,
                            "Collecting number", entity.getFieldNumber(), style);
                }
-               else{
-                   toggleableText_titleCache.setEnabled(false);
-               }
                selection_collection = formFactory
                                .createSelectionElement(Collection.class,
                                                getConversationHolder(), formElement, "Collection",
@@ -155,5 +157,9 @@ public class DerivedUnitGeneralDetailElement extends
                        toggleableText_titleCache.setText(getEntity().getTitleCache());
                }
        }
+       
+    public void setShowOnlyDerivedUnitData(boolean showOnlyDerivedUnitData) {
+        this.showOnlyDerivedUnitData = showOnlyDerivedUnitData;
+    }
 
 }
index 6b48d0796e3e2f732966c6e8f3170518214a58c0..2e2ff814237a3394ed25f97bba20381a7bd51b75 100644 (file)
@@ -26,7 +26,10 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
  */
 public class DerivedUnitGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
 
-       /**
+    //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
+       private DerivedUnitGeneralDetailElement derivedUnitGeneralDetailElement;
+
+    /**
         * @param formFactory
         * @param conversation
         * @param parentElement
@@ -53,7 +56,12 @@ public class DerivedUnitGeneralDetailSection extends AbstractCdmDetailSection<De
         */
        @Override
        protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
-           return formFactory.createDerivedUnitGeneralDetailElement(parentElement);
+           derivedUnitGeneralDetailElement = formFactory.createDerivedUnitGeneralDetailElement(parentElement);
+        return derivedUnitGeneralDetailElement;
+       }
+
+       public void setShowOnlyDerivedUnitData(boolean showOnlyDerivedUnitData){
+           derivedUnitGeneralDetailElement.setShowOnlyDerivedUnitData(showOnlyDerivedUnitData);
        }
 
 }
index 5d81dbf00f16e61dd0aa8968041200135370fc76..4f22a0c2833e844f9f8fb2734acff9861d4cafce 100644 (file)
@@ -659,6 +659,10 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         destroySections();
 
         DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539 
+        if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
+            derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
+        }
         addPart(derivedUnitGeneralDetailSection);
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);