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.Section;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
|
16
|
import eu.etaxonomy.taxeditor.preference.Resources;
|
17
|
import eu.etaxonomy.taxeditor.store.StoreUtil;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
|
23
|
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
|
24
|
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
|
25
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
26
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
27
|
|
28
|
/**
|
29
|
* <p>
|
30
|
* GatheringEventDetailElement class.
|
31
|
* </p>
|
32
|
*
|
33
|
* @author n.hoffmann
|
34
|
* @created Jun 24, 2010
|
35
|
* @version 1.0
|
36
|
*/
|
37
|
public class GatheringEventDetailElement extends
|
38
|
AbstractCdmDetailElement<DerivedUnitFacade> {
|
39
|
|
40
|
private GatheringEventUnitElement element_elevation;
|
41
|
|
42
|
private GatheringEventUnitElement element_distToGround;
|
43
|
|
44
|
private GatheringEventUnitElement element_distToWater;
|
45
|
|
46
|
private MinMaxTextSection section_minMaxText;
|
47
|
|
48
|
private TextWithLabelElement text_collectingMethod;
|
49
|
|
50
|
private TextWithLabelElement text_gatheringEventDescription;
|
51
|
|
52
|
private CollectingAreasDetailSection section_collectingAreas;
|
53
|
|
54
|
/**
|
55
|
* <p>
|
56
|
* Constructor for GatheringEventDetailElement.
|
57
|
* </p>
|
58
|
*
|
59
|
* @param formFactory
|
60
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
61
|
* object.
|
62
|
* @param formElement
|
63
|
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
|
64
|
* object.
|
65
|
*/
|
66
|
public GatheringEventDetailElement(CdmFormFactory formFactory,
|
67
|
ICdmFormElement formElement) {
|
68
|
super(formFactory, formElement);
|
69
|
}
|
70
|
|
71
|
/** {@inheritDoc} */
|
72
|
@Override
|
73
|
protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
|
74
|
|
75
|
|
76
|
// collectingArea
|
77
|
|
78
|
|
79
|
text_collectingMethod = formFactory.createTextWithLabelElement(
|
80
|
formElement, "Collecting Method", entity.getCollectingMethod(),
|
81
|
style);
|
82
|
|
83
|
|
84
|
// exactLocation
|
85
|
text_gatheringEventDescription = formFactory
|
86
|
.createTextWithLabelElement(formElement,
|
87
|
"Gathering Event Description",
|
88
|
entity.getGatheringEventDescription(), style);
|
89
|
element_elevation = formFactory.createGatheringEventUnitElement(
|
90
|
formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION, style);
|
91
|
|
92
|
|
93
|
element_distToGround = formFactory.createGatheringEventUnitElement(
|
94
|
formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND, style);
|
95
|
|
96
|
element_distToWater = formFactory.createGatheringEventUnitElement(
|
97
|
formElement, "Dist. To Water : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER, style);
|
98
|
|
99
|
section_collectingAreas = (CollectingAreasDetailSection) formFactory
|
100
|
.createEntityDetailSection(EntityDetailType.COLLECTING_AREA,
|
101
|
getConversationHolder(), formElement, Section.TWISTIE);
|
102
|
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(
|
103
|
2, 1));
|
104
|
section_collectingAreas.setEntity(entity);
|
105
|
|
106
|
}
|
107
|
|
108
|
/** {@inheritDoc} */
|
109
|
@Override
|
110
|
public void handleEvent(Object eventSource) {
|
111
|
if (eventSource == text_collectingMethod) {
|
112
|
getEntity().setCollectingMethod(text_collectingMethod.getText());
|
113
|
} else if (eventSource == text_gatheringEventDescription) {
|
114
|
getEntity().setGatheringEventDescription(
|
115
|
text_gatheringEventDescription.getText());
|
116
|
}
|
117
|
}
|
118
|
}
|