Project

General

Profile

Download (3.68 KB) Statistics
| Branch: | Tag: | Revision:
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.model.AbstractUtility;
17
import eu.etaxonomy.taxeditor.preference.Resources;
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.NumberWithLabelElement;
24
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
25
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
26

    
27
/**
28
 * <p>
29
 * GatheringEventDetailElement class.
30
 * </p>
31
 *
32
 * @author n.hoffmann
33
 * @created Jun 24, 2010
34
 * @version 1.0
35
 */
36
public class GatheringEventDetailElement extends
37
		AbstractCdmDetailElement<DerivedUnitFacade> {
38

    
39
	private GatheringEventUnitElement element_elevation;
40

    
41
	private GatheringEventUnitElement element_distToGround;
42
	
43
	private GatheringEventUnitElement element_distToWater;
44
	
45
	private MinMaxTextSection section_minMaxText;
46

    
47
	private TextWithLabelElement text_collectingMethod;
48

    
49
	private TextWithLabelElement text_gatheringEventDescription;
50

    
51
	private CollectingAreasDetailSection section_collectingAreas;
52

    
53
	/**
54
	 * <p>
55
	 * Constructor for GatheringEventDetailElement.
56
	 * </p>
57
	 *
58
	 * @param formFactory
59
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
60
	 *            object.
61
	 * @param formElement
62
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
63
	 *            object.
64
	 */
65
	public GatheringEventDetailElement(CdmFormFactory formFactory,
66
			ICdmFormElement formElement) {
67
		super(formFactory, formElement);
68
	}
69

    
70
	/** {@inheritDoc} */
71
	@Override
72
	protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
73
		
74

    
75
		// collectingArea
76

    
77

    
78
        text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
79

    
80

    
81
		// exactLocation
82
        text_gatheringEventDescription = formFactory.createTextWithLabelElement(formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style);
83
		element_elevation = formFactory.createGatheringEventUnitElement(
84
				formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
85
		
86
		
87
		element_distToGround = formFactory.createGatheringEventUnitElement(
88
				formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND,  style);
89
		
90
		element_distToWater = formFactory.createGatheringEventUnitElement(
91
				formElement, "Dist. To Water : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER,  style);
92
		
93
        section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
94
        section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
95
		section_collectingAreas.setEntity(entity);
96

    
97
	}
98

    
99
	/** {@inheritDoc} */
100
	@Override
101
	public void handleEvent(Object eventSource) {
102
		if (eventSource == text_collectingMethod) {
103
			getEntity().setCollectingMethod(text_collectingMethod.getText());
104
		} else if (eventSource == text_gatheringEventDescription) {
105
			getEntity().setGatheringEventDescription(
106
					text_gatheringEventDescription.getText());
107
		}
108
	}
109
}
(19-19/29)