- DerivedUnits DetailsView only shows FieldUnit data in titleCache (fixes #4474)
[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 eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
14 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
15 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
16 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
17 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
18 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
19 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
20
21 /**
22 * <p>
23 * GatheringEventDetailElement class.
24 * </p>
25 *
26 * @author n.hoffmann
27 * @created Jun 24, 2010
28 * @version 1.0
29 */
30 public class GatheringEventDetailElement extends
31 AbstractCdmDetailElement<DerivedUnitFacade> {
32
33 private GatheringEventUnitElement element_elevation;
34
35 private GatheringEventUnitElement element_distToGround;
36
37 private GatheringEventUnitElement element_distToWater;
38
39 private TextWithLabelElement text_collectingMethod;
40
41 private TextWithLabelElement text_gatheringEventDescription;
42
43 /**
44 * <p>
45 * Constructor for GatheringEventDetailElement.
46 * </p>
47 *
48 * @param formFactory
49 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
50 * object.
51 * @param formElement
52 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
53 * object.
54 */
55 public GatheringEventDetailElement(CdmFormFactory formFactory,
56 ICdmFormElement formElement) {
57 super(formFactory, formElement);
58 }
59
60 /** {@inheritDoc} */
61 @Override
62 protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
63 text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
64
65 text_gatheringEventDescription = formFactory.createTextWithLabelElement(
66 formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style);
67
68 element_distToGround = formFactory.createGatheringEventUnitElement(
69 formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND, style);
70
71 element_distToWater = formFactory.createGatheringEventUnitElement(
72 formElement, "Dist. To Watersurface : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER, style);
73
74 }
75
76 /** {@inheritDoc} */
77 @Override
78 public void handleEvent(Object eventSource) {
79 if (eventSource == text_collectingMethod) {
80 getEntity().setCollectingMethod(text_collectingMethod.getText());
81 } else if (eventSource == text_gatheringEventDescription) {
82 getEntity().setGatheringEventDescription(
83 text_gatheringEventDescription.getText());
84 }
85 }
86 }