merged/implemented cdm3.3 model adaptations
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / GatheringEventDetailElement.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10
11 package eu.etaxonomy.taxeditor.ui.section.occurrence;
12
13 import org.eclipse.ui.forms.widgets.ExpandableComposite;
14
15 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
16 import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
17 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
19 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
20 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
21 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
22 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
23
24 /**
25 * <p>
26 * GatheringEventDetailElement class.
27 * </p>
28 *
29 * @author n.hoffmann
30 * @created Jun 24, 2010
31 * @version 1.0
32 */
33 public class GatheringEventDetailElement extends
34 AbstractCdmDetailElement<DerivedUnitFacade> {
35
36 private GatheringEventUnitElement element_elevation;
37
38 private GatheringEventUnitElement element_distToGround;
39
40 private GatheringEventUnitElement element_distToWater;
41
42 private MinMaxTextSection section_minMaxText;
43
44 private TextWithLabelElement text_collectingMethod;
45
46 private TextWithLabelElement text_gatheringEventDescription;
47
48 private CollectingAreasDetailSection section_collectingAreas;
49
50 /**
51 * <p>
52 * Constructor for GatheringEventDetailElement.
53 * </p>
54 *
55 * @param formFactory
56 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
57 * object.
58 * @param formElement
59 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
60 * object.
61 */
62 public GatheringEventDetailElement(CdmFormFactory formFactory,
63 ICdmFormElement formElement) {
64 super(formFactory, formElement);
65 }
66
67 /** {@inheritDoc} */
68 @Override
69 protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
70
71
72 // collectingArea
73
74
75 text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
76
77
78 // exactLocation
79 text_gatheringEventDescription = formFactory.createTextWithLabelElement(formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style);
80 element_elevation = formFactory.createGatheringEventUnitElement(
81 formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION, style);
82
83
84 element_distToGround = formFactory.createGatheringEventUnitElement(
85 formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND, style);
86
87 element_distToWater = formFactory.createGatheringEventUnitElement(
88 formElement, "Dist. To Water : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER, style);
89
90 section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
91 section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
92 section_collectingAreas.setEntity(entity);
93
94 }
95
96 /** {@inheritDoc} */
97 @Override
98 public void handleEvent(Object eventSource) {
99 if (eventSource == text_collectingMethod) {
100 getEntity().setCollectingMethod(text_collectingMethod.getText());
101 } else if (eventSource == text_gatheringEventDescription) {
102 getEntity().setGatheringEventDescription(
103 text_gatheringEventDescription.getText());
104 }
105 }
106 }