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
.Section
;
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
.ICdmFormElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.LayoutConstants
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.NumberWithLabelElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
.EntityDetailType
;
25 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
28 * <p>StatisticalMeasurementValueElement class.</p>
31 * @created Sep 15, 2010
34 public class StatisticalMeasurementValueElement
extends
35 AbstractEntityCollectionElement
<StatisticalMeasurementValue
> {
37 private NumberWithLabelElement number_value
;
38 private TermComboElement
<StatisticalMeasure
> combo_type
;
39 private ModifierSection section_modifiers
;
42 * <p>Constructor for StatisticalMeasurementValueElement.</p>
44 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
45 * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
46 * @param entity a {@link eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue} object.
47 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
50 public StatisticalMeasurementValueElement(CdmFormFactory formFactory
,
51 AbstractFormSection section
, StatisticalMeasurementValue entity
,
52 SelectionListener removeListener
, int style
) {
53 super(formFactory
, section
, entity
, removeListener
, null, style
);
58 public void setEntity(StatisticalMeasurementValue entity
) {
60 number_value
.setFloat(entity
.getValue());
61 combo_type
.setSelection(entity
.getType());
62 section_modifiers
.setEntity(entity
);
67 public void createControls(ICdmFormElement element
, int style
) {
68 number_value
= formFactory
.createFloatTextWithLabelElement(element
, "Value", 0, style
);
69 combo_type
= formFactory
.createTermComboElement(StatisticalMeasure
.class, element
, "Statistical Measure", null, style
);
70 section_modifiers
= (ModifierSection
) formFactory
.createEntityDetailSection(EntityDetailType
.MODIFIER
, getConversationHolder(), element
, Section
.TWISTIE
);
71 section_modifiers
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
76 public void handleEvent(Object eventSource
) {
77 if(eventSource
== number_value
){
78 getEntity().setValue(number_value
.getFloat());
80 else if(eventSource
== combo_type
){
81 getEntity().setType(combo_type
.getSelection());