Project

General

Profile

Download (3.48 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 eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
13
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
14
import eu.etaxonomy.taxeditor.store.StoreUtil;
15
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
16
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
19
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
20
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
22

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

    
35
	private GatheringEventUnitElement element_elevation;
36

    
37
	private GatheringEventUnitElement element_distToGround;
38

    
39
	private GatheringEventUnitElement element_distToWater;
40

    
41
	private TextWithLabelElement text_collectingMethod;
42

    
43
	private TextWithLabelElement text_gatheringEventDescription;
44

    
45
	private CollectingAreasDetailSection section_collectingAreas;
46

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

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

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

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

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

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

    
79

    
80
        if(!PreferencesUtil.isCollectingAreaInGeneralSection()){
81
            section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(CollectingAreasDetailSection.class, entity.getClass().getCanonicalName()));
82
            section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
83
            section_collectingAreas.setEntity(entity);
84
        }
85

    
86
	}
87

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