package eu.etaxonomy.taxeditor.ui.section.description;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
import eu.etaxonomy.cdm.model.description.StateData;
+import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
this.entity = entity;
if(getParentElement() instanceof ModifierSection){
ModifierSection parentSection = (ModifierSection) getParentElement();
+ List<DefinedTerm> modifierTerms = new ArrayList<DefinedTerm>();
+ Set<TermVocabulary<DefinedTerm>> recommendedModifierEnumeration = new HashSet<TermVocabulary<DefinedTerm>>();
if(parentSection.getEntity() instanceof StateData){
StateData stateData = (StateData) parentSection.getEntity();
- List<DefinedTerm> modifierTerms = new ArrayList<DefinedTerm>();
- Set<TermVocabulary<DefinedTerm>> recommendedModifierEnumeration = stateData.getCategoricalData().getFeature().getRecommendedModifierEnumeration();
- for (TermVocabulary<DefinedTerm> termVocabulary : recommendedModifierEnumeration) {
- modifierTerms.addAll(termVocabulary.getTerms());
- }
- combo_modifier.setTerms(modifierTerms);
+ recommendedModifierEnumeration = stateData.getCategoricalData().getFeature().getRecommendedModifierEnumeration();
}
+ if(parentSection.getEntity() instanceof StatisticalMeasurementValue){
+ StatisticalMeasurementValue statisticalMeasurementValue = (StatisticalMeasurementValue)parentSection.getEntity();
+ recommendedModifierEnumeration = statisticalMeasurementValue.getQuantitativeData().getFeature().getRecommendedModifierEnumeration();
+ }
+ for (TermVocabulary<DefinedTerm> termVocabulary : recommendedModifierEnumeration) {
+ modifierTerms.addAll(termVocabulary.getTerms());
+ }
+ combo_modifier.setTerms(modifierTerms);
}
if(entity.getId()>0){
combo_modifier.setSelection(entity);
super.createControls(formElement, entity, style);\r
this.parentFormElement = formElement;\r
supportsTextData = formFactory.createCheckbox(formElement, "Supports Text Data", entity.isSupportsTextData(), style);\r
- supportsQuantitativeData = formFactory.createCheckbox(formElement, "Supports Quantitive Data", entity.isSupportsQuantitativeData(), style);\r
+ supportsQuantitativeData = formFactory.createCheckbox(formElement, "Supports Quantitative Data", entity.isSupportsQuantitativeData(), style);\r
supportsDistribution = formFactory.createCheckbox(formElement, "Supports Distribution", entity.isSupportsDistribution(), style);\r
supportsIndividualAssociation = formFactory.createCheckbox(formElement, "Supports Individual Association", entity.isSupportsIndividualAssociation(), style);\r
supportsTaxonInteraction = formFactory.createCheckbox(formElement, "Supports Taxon Interaction", entity.isSupportsTaxonInteraction(), style);\r
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionStateVocabularies.setEntity(getEntity());\r
\r
- sectionStateModifiers = formFactory.createStateModifierCollectionSection(getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);\r
- sectionStateModifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
- sectionStateModifiers.setEntity(getEntity());\r
}\r
if(supportsQuantitativeData.getSelection()){\r
sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);\r
sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionStatisticalMeasures.setEntity(getEntity());\r
}\r
+ if(supportsCategoricalData.getSelection() || supportsQuantitativeData.getSelection()){\r
+ sectionStateModifiers = formFactory.createStateModifierCollectionSection(getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);\r
+ sectionStateModifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionStateModifiers.setEntity(getEntity());\r
+ }\r
}\r
\r
/* (non-Javadoc)\r
sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);\r
sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionStatisticalMeasures.setEntity(getEntity());\r
+\r
+ if(!supportsCategoricalData.getSelection()){\r
+ sectionStateModifiers = formFactory.createStateModifierCollectionSection(getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);\r
+ sectionStateModifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionStateModifiers.setEntity(getEntity());\r
+ }\r
}\r
else{\r
if(sectionMeasurementUnits!=null){\r
removeElementsAndControls(sectionMeasurementUnits);\r
removeElementsAndControls(sectionStatisticalMeasures);\r
+ if(!supportsCategoricalData.getSelection()){\r
+ removeElementsAndControls(sectionStateModifiers);\r
+ }\r
}\r
}\r
}\r
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionStateVocabularies.setEntity(getEntity());\r
\r
- sectionStateModifiers = formFactory.createStateModifierCollectionSection(getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);\r
- sectionStateModifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
- sectionStateModifiers.setEntity(getEntity());\r
+ if(!supportsQuantitativeData.getSelection()){\r
+ sectionStateModifiers = formFactory.createStateModifierCollectionSection(getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE);\r
+ sectionStateModifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionStateModifiers.setEntity(getEntity());\r
+ }\r
}\r
else{\r
if(sectionStateVocabularies!=null){\r
removeElementsAndControls(sectionStateVocabularies);\r
- removeElementsAndControls(sectionStateModifiers);\r
+ if(!supportsQuantitativeData.getSelection()){\r
+ removeElementsAndControls(sectionStateModifiers);\r
+ }\r
}\r
}\r
}\r