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
.occurrence
;
13 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
15 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
16 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
17 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.GatheringEventUnitElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.LayoutConstants
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.MinMaxTextSection
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
28 * GatheringEventDetailElement class.
32 * @created Jun 24, 2010
35 public class GatheringEventDetailElement
extends
36 AbstractCdmDetailElement
<DerivedUnitFacade
> {
38 private GatheringEventUnitElement element_elevation
;
40 private GatheringEventUnitElement element_distToGround
;
42 private GatheringEventUnitElement element_distToWater
;
44 private TextWithLabelElement text_collectingMethod
;
46 private TextWithLabelElement text_gatheringEventDescription
;
48 private CollectingAreasDetailSection section_collectingAreas
;
52 * Constructor for GatheringEventDetailElement.
56 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
59 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
62 public GatheringEventDetailElement(CdmFormFactory formFactory
,
63 ICdmFormElement formElement
) {
64 super(formFactory
, formElement
);
69 protected void createControls(ICdmFormElement formElement
, DerivedUnitFacade entity
, int style
) {
71 text_collectingMethod
= formFactory
.createTextWithLabelElement(formElement
, "Collecting Method", entity
.getCollectingMethod(), style
);
73 text_gatheringEventDescription
= formFactory
.createTextWithLabelElement(
74 formElement
, "Gathering Event Description", entity
.getGatheringEventDescription(), style
);
76 element_distToGround
= formFactory
.createGatheringEventUnitElement(
77 formElement
, "Dist. To Ground : ", entity
, MinMaxTextSection
.UnitType
.DIST_TO_GROUND
, style
);
79 element_distToWater
= formFactory
.createGatheringEventUnitElement(
80 formElement
, "Dist. To Watersurface : ", entity
, MinMaxTextSection
.UnitType
.DIST_TO_WATER
, style
);
83 if(!PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION
)){
84 section_collectingAreas
= formFactory
.createCollectingAreasDetailSection(getConversationHolder(), formElement
, ExpandableComposite
.TWISTIE
);
85 section_collectingAreas
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
86 section_collectingAreas
.setEntity(entity
);
93 public void handleEvent(Object eventSource
) {
94 if (eventSource
== text_collectingMethod
) {
95 getEntity().setCollectingMethod(text_collectingMethod
.getText());
96 } else if (eventSource
== text_gatheringEventDescription
) {
97 getEntity().setGatheringEventDescription(
98 text_gatheringEventDescription
.getText());