From a5e9f7de7116e068dff015ed7e66f413fb477ed2 Mon Sep 17 00:00:00 2001
From: Patric Plitzner
Date: Tue, 9 Dec 2014 15:52:02 +0000
Subject: [PATCH] - added special case handling for DerivateEditor so that the
DetailsView only show data of the DerivedUnit and the FieldUnit #4474
---
.../DerivedUnitGeneralDetailElement.java | 18 ++++++++++++------
.../DerivedUnitGeneralDetailSection.java | 12 ++++++++++--
.../taxeditor/view/detail/DetailsViewer.java | 4 ++++
3 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
index acd4690a3..665e6e12a 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
@@ -40,6 +40,8 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
public class DerivedUnitGeneralDetailElement extends
AbstractCdmDetailElement {
+ boolean showOnlyDerivedUnitData = false;
+
private ToggleableTextElement toggleableText_titleCache;
private EnumComboElement combo_specorobstype;
private EntitySelectionElement 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;
+ }
}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailSection.java
index 6b48d0796..2e2ff8142 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailSection.java
@@ -26,7 +26,10 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
*/
public class DerivedUnitGeneralDetailSection extends AbstractCdmDetailSection 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 createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) {
- return formFactory.createDerivedUnitGeneralDetailElement(parentElement);
+ derivedUnitGeneralDetailElement = formFactory.createDerivedUnitGeneralDetailElement(parentElement);
+ return derivedUnitGeneralDetailElement;
+ }
+
+ public void setShowOnlyDerivedUnitData(boolean showOnlyDerivedUnitData){
+ derivedUnitGeneralDetailElement.setShowOnlyDerivedUnitData(showOnlyDerivedUnitData);
}
}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
index 5d81dbf00..4f22a0c28 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
@@ -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);
--
2.34.1