Project

General

Profile

Download (3.53 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.IPreferenceKeys;
16
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
21
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
22
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
23
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
24

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

    
37
	private GatheringEventUnitElement element_elevation;
38

    
39
	private GatheringEventUnitElement element_distToGround;
40

    
41
	private GatheringEventUnitElement element_distToWater;
42

    
43
	private TextWithLabelElement text_collectingMethod;
44

    
45
	private TextWithLabelElement text_gatheringEventDescription;
46

    
47
	private CollectingAreasDetailSection section_collectingAreas;
48

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

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

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

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

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

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

    
81

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

    
88
	}
89

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