*/\r
package eu.etaxonomy.taxeditor.ui.section.vocabulary;\r
\r
+import org.eclipse.ui.forms.widgets.ExpandableComposite;\r
+\r
import eu.etaxonomy.cdm.model.description.Feature;\r
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;\r
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;\r
\r
/**\r
* @author l.morris\r
*/\r
public class FeatureDetailElement extends DefinedTermDetailElement<Feature> {\r
\r
+ private ICdmFormElement parentFormElement;\r
+\r
private CheckboxElement supportsTextData;\r
\r
private CheckboxElement supportsQuantitativeData;\r
\r
private CheckboxElement supportsCommonTaxonName;\r
\r
+ private StateVocabularyCollectionSection sectionStateVocabularies;\r
+\r
+ private MeasurementUnitCollectionSection sectionMeasurementUnits;\r
+\r
+ private StatisticalMeasureCollectionSection sectionStatisticalMeasures;\r
+\r
+ private RecommendedModifierVocabulariesCollectionSection sectionModifierVocabularies;\r
+\r
/**\r
* @param formFactory\r
* @param formElement\r
@Override\r
protected void createControls(ICdmFormElement formElement, Feature entity, int style) {\r
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
supportsCategoricalData = formFactory.createCheckbox(formElement, "Supports Categorical Data", entity.isSupportsCategoricalData(), style);\r
supportsCommonTaxonName = formFactory.createCheckbox(formElement, "Supports Common Taxon Name", entity.isSupportsCommonTaxonName(), style);\r
- }\r
+\r
+ if (supportsCategoricalData.getSelection()) {\r
+ sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),\r
+ parentFormElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);\r
+ sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionStateVocabularies.setEntity(getEntity());\r
+\r
+ }\r
+ if (supportsQuantitativeData.getSelection()) {\r
+ sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),\r
+ parentFormElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);\r
+ sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionMeasurementUnits.setEntity(getEntity());\r
+\r
+ sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(getConversationHolder(),\r
+ parentFormElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);\r
+ sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionStatisticalMeasures.setEntity(getEntity());\r
+ }\r
+ if (supportsCategoricalData.getSelection() || supportsQuantitativeData.getSelection()) {\r
+ sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(\r
+ getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE\r
+ | ExpandableComposite.EXPANDED);\r
+ sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionModifierVocabularies.setEntity(getEntity());\r
+ }\r
+ }\r
\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailElement#handleEvent(java.lang.Object)\r
}\r
else if(eventSource == supportsQuantitativeData){\r
getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());\r
+ if(supportsQuantitativeData.getSelection()){\r
+ removeElementsAndControls(supportsDistribution);\r
+ sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),\r
+ parentFormElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);\r
+ sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionMeasurementUnits.setEntity(getEntity());\r
+\r
+ sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(\r
+ getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);\r
+ sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionStatisticalMeasures.setEntity(getEntity());\r
+\r
+ if (!supportsCategoricalData.getSelection()) {\r
+ sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(\r
+ getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);\r
+ sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionModifierVocabularies.setEntity(getEntity());\r
+ }\r
+ }\r
+ else{\r
+ if(sectionMeasurementUnits!=null){\r
+ removeElementsAndControls(sectionMeasurementUnits);\r
+ removeElementsAndControls(sectionStatisticalMeasures);\r
+ if(!supportsCategoricalData.getSelection()){\r
+ removeElementsAndControls(sectionModifierVocabularies);\r
+ }\r
+ }\r
+ }\r
}\r
else if(eventSource == supportsDistribution){\r
getEntity().setSupportsDistribution(supportsDistribution.getSelection());\r
}\r
else if(eventSource == supportsCategoricalData){\r
getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());\r
+ if (supportsCategoricalData.getSelection()) {\r
+ sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),\r
+ parentFormElement, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);\r
+ sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionStateVocabularies.setEntity(getEntity());\r
+\r
+ if (!supportsQuantitativeData.getSelection()) {\r
+ sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(\r
+ getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);\r
+ sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
+ sectionModifierVocabularies.setEntity(getEntity());\r
+ }\r
+ }\r
+ else{\r
+ if(sectionStateVocabularies!=null){\r
+ removeElementsAndControls(sectionStateVocabularies);\r
+ if(!supportsQuantitativeData.getSelection()){\r
+ removeElementsAndControls(sectionModifierVocabularies);\r
+ }\r
+ }\r
+ }\r
}\r
else if(eventSource == supportsCommonTaxonName){\r
getEntity().setSupportsCommonTaxonName(supportsCommonTaxonName.getSelection());\r