Project

General

Profile

Download (3.67 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.CdmStore;
15
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
16
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
17
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
18
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
19

    
20
/**
21
 * <p>FieldUnitDetailElement class.</p>
22
 *
23
 * @author n.hoffmann
24
 * @created Jun 17, 2010
25
 * @version 1.0
26
 */
27
public class FieldUnitDetailElement extends AbstractSpecimenOrObservationDetailElement {
28

    
29
	private TextWithLabelElement text_ecology;
30

    
31
	private TextWithLabelElement text_plantDescription;
32

    
33
	private TextWithLabelElement text_fieldObjectDefinition;
34

    
35
	private TextWithLabelElement text_fieldNotes;
36

    
37
	private TextWithLabelElement text_lifeForm;
38

    
39
	private TextWithLabelElement number_individualCount;
40

    
41
//	private TermComboElement<DefinedTerm> combo_kindOfUnit;
42
//
43
//	private TermComboElement<DefinedTerm> combo_lifeStage;
44
//
45
//	private TermComboElement<DefinedTerm> combo_sex;
46

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

    
58
	/** {@inheritDoc} */
59
	@Override
60
	protected void createControls(ICdmFormElement formElement,
61
			DerivedUnitFacade entity, int style) {
62
		text_ecology = formFactory.createTextWithLabelElement(formElement, "Ecology", entity.getEcology(CdmStore.getDefaultLanguage()), style);
63
		text_plantDescription = formFactory.createTextWithLabelElement(formElement, "Plant Description", entity.getPlantDescription(CdmStore.getDefaultLanguage()), style);
64
		// Disable for now
65
//		text_fieldObjectDefinition = formFactory.createTextWithLabelElement(formElement, "Field Object Definition", entity.getFieldObjectDefinition(CdmStore.getDefaultLanguage()), style);
66
		text_fieldNotes = formFactory.createTextWithLabelElement(formElement, "Field Notes", entity.getFieldNotes(), style);
67
		if (PreferencesUtil.isShowLifeForm()){
68
			text_lifeForm = formFactory.createTextWithLabelElement(formElement, "Life Form", entity.getLifeform(PreferencesUtil.getGlobalLanguage()), style);
69
		}
70

    
71
		number_individualCount = formFactory.createTextWithLabelElement(formElement, "Individual Count", entity.getIndividualCount(), style);
72
		super.createControls(formElement, entity, style);
73
	}
74

    
75
	/** {@inheritDoc} */
76
	@Override
77
	public void handleEvent(Object eventSource) {
78
		super.handleEvent(eventSource);
79
		if(eventSource == text_ecology){
80
			getEntity().setEcology(text_ecology.getText());
81
		}
82
		else if(eventSource == text_plantDescription){
83
			getEntity().setPlantDescription(text_plantDescription.getText());
84
		}
85
		else if(eventSource == text_fieldObjectDefinition){
86
			getEntity().addFieldObjectDefinition(text_fieldObjectDefinition.getText(), CdmStore.getDefaultLanguage());
87
		}
88
		else if(eventSource == text_fieldNotes){
89
			getEntity().setFieldNotes(text_fieldNotes.getText());
90
		}
91
		else if(eventSource == text_lifeForm){
92
			getEntity().setLifeform(text_lifeForm.getText());
93
		}
94
		else if(eventSource == number_individualCount){
95
			getEntity().setIndividualCount(number_individualCount.getText());
96
		}
97

    
98
	}
99
}
(21-21/36)