Project

General

Profile

Download (3.42 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9

    
10
package eu.etaxonomy.taxeditor.ui.section.occurrence;
11

    
12
import org.eclipse.ui.forms.widgets.ExpandableComposite;
13

    
14
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
15
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
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 TextWithLabelElement text_collectingMethod;
43

    
44
	private TextWithLabelElement text_gatheringEventDescription;
45

    
46
	private CollectingAreasDetailSection section_collectingAreas;
47

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

    
65
	/** {@inheritDoc} */
66
	@Override
67
	protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
68

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

    
71
        text_gatheringEventDescription = formFactory.createTextWithLabelElement(
72
        		formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style);
73

    
74
		element_distToGround = formFactory.createGatheringEventUnitElement(
75
				formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND,  style);
76

    
77
		element_distToWater = formFactory.createGatheringEventUnitElement(
78
				formElement, "Dist. To Watersurface : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER,  style);
79

    
80

    
81
        if(!PreferencesUtil.isCollectingAreaInGeneralSection()){
82
            section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
83
            section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
84
            section_collectingAreas.setEntity(entity);
85
        }
86

    
87
	}
88

    
89
	/** {@inheritDoc} */
90
	@Override
91
	public void handleEvent(Object eventSource) {
92
		if (eventSource == text_collectingMethod) {
93
			getEntity().setCollectingMethod(text_collectingMethod.getText());
94
		} else if (eventSource == text_gatheringEventDescription) {
95
			getEntity().setGatheringEventDescription(
96
					text_gatheringEventDescription.getText());
97
		}
98
	}
99
}
(25-25/37)