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
.apache
.log4j
.Logger
;
14 import org
.eclipse
.swt
.events
.SelectionListener
;
15 import org
.eclipse
.ui
.forms
.widgets
.Section
;
17 import eu
.etaxonomy
.cdm
.model
.description
.StatisticalMeasurementValue
;
18 import eu
.etaxonomy
.taxeditor
.ui
.forms
.AbstractFormSection
;
19 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
;
20 import eu
.etaxonomy
.taxeditor
.ui
.forms
.ICdmFormElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.forms
.NumberWithLabelElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.EntityDetailType
;
23 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.TermComboType
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
25 import eu
.etaxonomy
.taxeditor
.ui
.term
.StatisticalMeasureComboElement
;
28 * <p>StatisticalMeasurementValueElement class.</p>
31 * @created Sep 15, 2010
34 public class StatisticalMeasurementValueElement
extends
35 AbstractEntityCollectionElement
<StatisticalMeasurementValue
> {
38 private static final Logger logger
= Logger
39 .getLogger(StatisticalMeasurementValueElement
.class);
40 private NumberWithLabelElement number_value
;
41 private StatisticalMeasureComboElement combo_type
;
42 private ModifierSection section_modifiers
;
45 * <p>Constructor for StatisticalMeasurementValueElement.</p>
47 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
48 * @param section a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
49 * @param entity a {@link eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue} object.
50 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
53 public StatisticalMeasurementValueElement(CdmFormFactory formFactory
,
54 AbstractFormSection section
, StatisticalMeasurementValue entity
,
55 SelectionListener removeListener
, int style
) {
56 super(formFactory
, section
, entity
, removeListener
, null, style
);
61 public void setEntity(StatisticalMeasurementValue entity
) {
63 number_value
.setFloat(entity
.getValue());
64 combo_type
.setSelection(entity
.getType());
65 section_modifiers
.setEntity(entity
);
70 public void createControls(ICdmFormElement element
, int style
) {
71 number_value
= formFactory
.createFloatTextWithLabelElement(element
, "Value", 0, style
);
72 combo_type
= (StatisticalMeasureComboElement
) formFactory
.createTermComboElement(TermComboType
.STATISTICAL_MEASURE
, element
, "Statistical Measure", null, style
);
73 section_modifiers
= (ModifierSection
) formFactory
.createEntityDetailSection(EntityDetailType
.MODIFIER
, getConversationHolder(), element
, Section
.TWISTIE
);
74 section_modifiers
.setLayoutData(CdmFormFactory
.FILL_HORIZONTALLY(2, 1));
79 public void handleEvent(Object eventSource
) {
80 if(eventSource
== number_value
){
81 getEntity().setValue(number_value
.getFloat());
83 else if(eventSource
== combo_type
){
84 getEntity().setType(combo_type
.getSelection());