3 * Copyright (C) 2013 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.
10 package eu
.etaxonomy
.taxeditor
.ui
.campanula
.detailViews
.fieldObservation
;
12 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
13 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.basicFields
.NumberFieldController
;
14 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.basicFields
.TextFieldController
;
15 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.compatibility
.ICdmFormElement
;
16 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
17 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
24 public class GatheringEventDetailsElementController
extends AbstractCdmDetailElement
<DerivedUnitFacade
> {
26 private GatheringEventDetailsElement gatheringEventDetailsElement
;
28 // private NumberFieldController number_absoluteElevationError;
30 // private NumberFieldController number_absoluteElevationMinimum;
32 private NumberFieldController number_absoluteElevationMaximum
;
34 private TextFieldController text_collectingMethod
;
36 private NumberFieldController number_distanceToGround
;
38 private NumberFieldController number_distanceToWaterSurface
;
40 private TextFieldController text_gatheringEventDescription
;
42 // private CollectingAreasDetailSection section_collectingAreas;
46 * Constructor for GatheringEventDetailElement.
50 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
53 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
56 public GatheringEventDetailsElementController(GatheringEventDetailsElement gatheringEventDetailsElement
, CdmFormFactory formFactory
, ICdmFormElement formElement
) {
57 super(formFactory
, formElement
);
58 this.gatheringEventDetailsElement
= gatheringEventDetailsElement
;
63 protected void createControls(ICdmFormElement formElement
, DerivedUnitFacade entity
, int style
) {
65 // number_absoluteElevationError = new NumberFieldController(gatheringEventDetailsElement.getTextElevationError(), formFactory, this, entity.getAbsoluteElevation());
66 // number_absoluteElevationMinimum = new NumberFieldController(gatheringEventDetailsElement.getText_ElevationMinimum(), formFactory, this, entity.getAbsoluteElevationMinimum());
67 number_absoluteElevationMaximum
= new NumberFieldController(gatheringEventDetailsElement
.getText_ElevationMaximum(), formFactory
, this, entity
.getAbsoluteElevationMaximum());
68 text_collectingMethod
= new TextFieldController(gatheringEventDetailsElement
.getText_CollectingMethod(), formFactory
, this, entity
.getCollectingMethod(), null);
69 number_distanceToGround
= new NumberFieldController(gatheringEventDetailsElement
.getText_DistanceToGround(), formFactory
, this, entity
.getDistanceToGround());
70 number_distanceToWaterSurface
= new NumberFieldController(gatheringEventDetailsElement
.getText_DistanceToWaterSurface(), formFactory
, this, entity
.getDistanceToWaterSurface());
71 text_gatheringEventDescription
= new TextFieldController(gatheringEventDetailsElement
.getText_GatheringEventDescription(), formFactory
, this, entity
.getGatheringEventDescription(), null);
72 // section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
73 // section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
74 // section_collectingAreas.setEntity(entity);
79 public void handleEvent(Object eventSource
) {
80 // if (eventSource == number_absoluteElevationError) {
81 // getEntity().setAbsoluteElevationError(number_absoluteElevationError.getDouble());
83 // else if (eventSource == number_absoluteElevationMinimum) {
85 // getEntity().setAbsoluteElevationRange(number_absoluteElevationMinimum.getInteger(), number_absoluteElevationMaximum.getInteger());
86 // number_absoluteElevationMinimum.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
87 // } catch (IllegalArgumentException e) {
88 // number_absoluteElevationMinimum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
89 // AbstractUtility.warn(getClass(), e.getLocalizedMessage());
92 // else if (eventSource == number_absoluteElevationMaximum) {
94 // getEntity().setAbsoluteElevationRange(number_absoluteElevationError.getInteger(), number_absoluteElevationMaximum.getInteger());
95 // number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
96 // } catch (IllegalArgumentException e) {
97 // number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
98 // AbstractUtility.warn(getClass(), e.getLocalizedMessage());
101 if (eventSource
== text_collectingMethod
) {
102 getEntity().setCollectingMethod(text_collectingMethod
.getText());
103 } else if (eventSource
== number_distanceToGround
) {
104 getEntity().setDistanceToGround(number_distanceToGround
.getDouble());
105 } else if (eventSource
== number_distanceToWaterSurface
) {
106 getEntity().setDistanceToWaterSurface(number_distanceToWaterSurface
.getDouble());
107 } else if (eventSource
== text_gatheringEventDescription
) {
108 getEntity().setGatheringEventDescription(text_gatheringEventDescription
.getText());