commit a433aeeb294c552e70649d3c98f804daa462d64a
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Tue Aug 14 19:51:46 2018 +0200

    Allow either categorical xor quantitative data for characters

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java
index 43e5bcb06..e8e4bd864 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java
@@ -18,7 +18,6 @@ import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection;
 import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection;
@@ -104,57 +103,78 @@ public class CharacterDetailElement extends AbstractCdmDetailElement<Character>
 	    if(eventSource == supportsQuantitativeData){
 	        getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
 	        if(supportsQuantitativeData.getSelection()){
-                sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),
-                        parentFormElement, ExpandableComposite.TWISTIE);
-                sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-                sectionMeasurementUnits.setEntity(getEntity());
-
-                sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(
-                        getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);
-                sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-                sectionStatisticalMeasures.setEntity(getEntity());
-
-                if (!supportsCategoricalData.getSelection()) {
-                    sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
-                            getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);
-                    sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-                    sectionModifierVocabularies.setEntity(getEntity());
-                }
+	            activateQuantitativeWidgets();
 	        }
 	        else{
-	            if(sectionMeasurementUnits!=null){
-	                removeElementsAndControls(sectionMeasurementUnits);
-	                removeElementsAndControls(sectionStatisticalMeasures);
-	                if(!supportsCategoricalData.getSelection()){
-	                    removeElementsAndControls(sectionModifierVocabularies);
-	                }
-	            }
+	            removeQuantitativeWidgets();
 	        }
 	    }
 	    else if(eventSource == supportsCategoricalData){
 	        getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());
             if (supportsCategoricalData.getSelection()) {
-                sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),
-                        parentFormElement, ExpandableComposite.TWISTIE);
-                sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-                sectionStateVocabularies.setEntity(getEntity());
-
-                if (!supportsQuantitativeData.getSelection()) {
-                    sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
-                            getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);
-                    sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-                    sectionModifierVocabularies.setEntity(getEntity());
-                }
+                activateCategoricalWidgets();
             }
 	        else{
-	            if(sectionStateVocabularies!=null){
-	                removeElementsAndControls(sectionStateVocabularies);
-	                if(!supportsQuantitativeData.getSelection()){
-	                    removeElementsAndControls(sectionModifierVocabularies);
-	                }
-	            }
+	            removeCategoricalWidgets();
 	        }
 	    }
 	}
 
+	private void activateQuantitativeWidgets(){
+	    //disable categorical widgets
+	    supportsCategoricalData.setSelection(false);
+	    removeCategoricalWidgets();
+
+	    //measurement units
+	    sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),
+	            parentFormElement, ExpandableComposite.TWISTIE);
+	    sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+	    sectionMeasurementUnits.setEntity(getEntity());
+
+	    //statistical measures
+	    sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(
+	            getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);
+	    sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+	    sectionStatisticalMeasures.setEntity(getEntity());
+
+	    //modifiers
+	    sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
+	            getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);
+	    sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+	    sectionModifierVocabularies.setEntity(getEntity());
+	}
+
+	private void removeQuantitativeWidgets(){
+	    if(sectionMeasurementUnits!=null){
+	        removeElementsAndControls(sectionMeasurementUnits);
+	        removeElementsAndControls(sectionStatisticalMeasures);
+	        removeElementsAndControls(sectionModifierVocabularies);
+	    }
+	}
+
+	private void activateCategoricalWidgets(){
+	    //disable quantitative widgeets
+	    supportsQuantitativeData.setSelection(false);
+	    removeQuantitativeWidgets();
+
+	    //states
+	    sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),
+                parentFormElement, ExpandableComposite.TWISTIE);
+        sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        sectionStateVocabularies.setEntity(getEntity());
+
+        //modifiers
+        sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
+                getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);
+        sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        sectionModifierVocabularies.setEntity(getEntity());
+	}
+
+	private void removeCategoricalWidgets(){
+	    if(sectionStateVocabularies!=null){
+	        removeElementsAndControls(sectionStateVocabularies);
+	        removeElementsAndControls(sectionModifierVocabularies);
+	    }
+	}
+
 }
