3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.ui
.section
.description
;
13 import org
.eclipse
.swt
.events
.SelectionListener
;
14 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
16 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasure
;
17 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
18 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.AbstractFormSection
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.LayoutConstants
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.NumberWithLabelElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.campanula
.compatibility
.ICdmFormElement
;
27 * <p>StatisticalMeasurementValueElement class.</p>
30 * @created Sep 15, 2010
33 public class StatisticalMeasurementValueElement
extends
34 AbstractEntityCollectionElement
<StatisticalMeasurementValue
> {
36 private NumberWithLabelElement number_value
;
37 private TermComboElement
<StatisticalMeasure
> combo_type
;
38 private ModifierSection section_modifiers
;
41 * <p>Constructor for StatisticalMeasurementValueElement.</p>
43 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
44 * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
45 * @param entity a {@link eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue} object.
46 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
49 public StatisticalMeasurementValueElement(CdmFormFactory formFactory
,
50 AbstractFormSection section
, StatisticalMeasurementValue entity
,
51 SelectionListener removeListener
, int style
) {
52 super(formFactory
, section
, entity
, removeListener
, null, style
);
57 public void setEntity(StatisticalMeasurementValue entity
) {
59 number_value
.setFloat(entity
.getValue());
60 combo_type
.setSelection(entity
.getType());
61 section_modifiers
.setEntity(entity
);
66 public void createControls(ICdmFormElement element
, int style
) {
67 number_value
= formFactory
.createFloatTextWithLabelElement(element
, "Value", 0, style
);
68 combo_type
= formFactory
.createTermComboElement(StatisticalMeasure
.class, element
, "Statistical Measure", null, style
);
69 section_modifiers
= formFactory
.createModifierSection(getConversationHolder(), element
, ExpandableComposite
.TWISTIE
);
70 section_modifiers
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
75 public void handleEvent(Object eventSource
) {
76 if(eventSource
== number_value
){
77 getEntity().setValue(number_value
.getFloat());
79 else if(eventSource
== combo_type
){
80 getEntity().setType(combo_type
.getSelection());