Revision a433aeeb
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java | ||
---|---|---|
18 | 18 |
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; |
19 | 19 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
20 | 20 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
21 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; |
|
22 | 21 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
23 | 22 |
import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection; |
24 | 23 |
import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection; |
... | ... | |
104 | 103 |
if(eventSource == supportsQuantitativeData){ |
105 | 104 |
getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection()); |
106 | 105 |
if(supportsQuantitativeData.getSelection()){ |
107 |
sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(), |
|
108 |
parentFormElement, ExpandableComposite.TWISTIE); |
|
109 |
sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
110 |
sectionMeasurementUnits.setEntity(getEntity()); |
|
111 |
|
|
112 |
sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection( |
|
113 |
getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE); |
|
114 |
sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
115 |
sectionStatisticalMeasures.setEntity(getEntity()); |
|
116 |
|
|
117 |
if (!supportsCategoricalData.getSelection()) { |
|
118 |
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection( |
|
119 |
getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE); |
|
120 |
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
121 |
sectionModifierVocabularies.setEntity(getEntity()); |
|
122 |
} |
|
106 |
activateQuantitativeWidgets(); |
|
123 | 107 |
} |
124 | 108 |
else{ |
125 |
if(sectionMeasurementUnits!=null){ |
|
126 |
removeElementsAndControls(sectionMeasurementUnits); |
|
127 |
removeElementsAndControls(sectionStatisticalMeasures); |
|
128 |
if(!supportsCategoricalData.getSelection()){ |
|
129 |
removeElementsAndControls(sectionModifierVocabularies); |
|
130 |
} |
|
131 |
} |
|
109 |
removeQuantitativeWidgets(); |
|
132 | 110 |
} |
133 | 111 |
} |
134 | 112 |
else if(eventSource == supportsCategoricalData){ |
135 | 113 |
getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection()); |
136 | 114 |
if (supportsCategoricalData.getSelection()) { |
137 |
sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(), |
|
138 |
parentFormElement, ExpandableComposite.TWISTIE); |
|
139 |
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
140 |
sectionStateVocabularies.setEntity(getEntity()); |
|
141 |
|
|
142 |
if (!supportsQuantitativeData.getSelection()) { |
|
143 |
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection( |
|
144 |
getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE); |
|
145 |
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
146 |
sectionModifierVocabularies.setEntity(getEntity()); |
|
147 |
} |
|
115 |
activateCategoricalWidgets(); |
|
148 | 116 |
} |
149 | 117 |
else{ |
150 |
if(sectionStateVocabularies!=null){ |
|
151 |
removeElementsAndControls(sectionStateVocabularies); |
|
152 |
if(!supportsQuantitativeData.getSelection()){ |
|
153 |
removeElementsAndControls(sectionModifierVocabularies); |
|
154 |
} |
|
155 |
} |
|
118 |
removeCategoricalWidgets(); |
|
156 | 119 |
} |
157 | 120 |
} |
158 | 121 |
} |
159 | 122 |
|
123 |
private void activateQuantitativeWidgets(){ |
|
124 |
//disable categorical widgets |
|
125 |
supportsCategoricalData.setSelection(false); |
|
126 |
removeCategoricalWidgets(); |
|
127 |
|
|
128 |
//measurement units |
|
129 |
sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(), |
|
130 |
parentFormElement, ExpandableComposite.TWISTIE); |
|
131 |
sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
132 |
sectionMeasurementUnits.setEntity(getEntity()); |
|
133 |
|
|
134 |
//statistical measures |
|
135 |
sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection( |
|
136 |
getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE); |
|
137 |
sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
138 |
sectionStatisticalMeasures.setEntity(getEntity()); |
|
139 |
|
|
140 |
//modifiers |
|
141 |
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection( |
|
142 |
getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE); |
|
143 |
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
144 |
sectionModifierVocabularies.setEntity(getEntity()); |
|
145 |
} |
|
146 |
|
|
147 |
private void removeQuantitativeWidgets(){ |
|
148 |
if(sectionMeasurementUnits!=null){ |
|
149 |
removeElementsAndControls(sectionMeasurementUnits); |
|
150 |
removeElementsAndControls(sectionStatisticalMeasures); |
|
151 |
removeElementsAndControls(sectionModifierVocabularies); |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
private void activateCategoricalWidgets(){ |
|
156 |
//disable quantitative widgeets |
|
157 |
supportsQuantitativeData.setSelection(false); |
|
158 |
removeQuantitativeWidgets(); |
|
159 |
|
|
160 |
//states |
|
161 |
sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(), |
|
162 |
parentFormElement, ExpandableComposite.TWISTIE); |
|
163 |
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
164 |
sectionStateVocabularies.setEntity(getEntity()); |
|
165 |
|
|
166 |
//modifiers |
|
167 |
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection( |
|
168 |
getConversationHolder(), parentFormElement, ExpandableComposite.TWISTIE); |
|
169 |
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
170 |
sectionModifierVocabularies.setEntity(getEntity()); |
|
171 |
} |
|
172 |
|
|
173 |
private void removeCategoricalWidgets(){ |
|
174 |
if(sectionStateVocabularies!=null){ |
|
175 |
removeElementsAndControls(sectionStateVocabularies); |
|
176 |
removeElementsAndControls(sectionModifierVocabularies); |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
160 | 180 |
} |
Also available in: Unified diff
Allow either categorical xor quantitative data for characters