Project

General

Profile

Download (3.62 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.TextWithLabelElement;
18

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

    
28
	private TextWithLabelElement text_ecology;
29

    
30
	private TextWithLabelElement text_plantDescription;
31

    
32
	private TextWithLabelElement text_fieldObjectDefinition;
33

    
34
	private TextWithLabelElement text_fieldNotes;
35

    
36
	private TextWithLabelElement text_lifeForm;
37

    
38
	private TextWithLabelElement number_individualCount;
39

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

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

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

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

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

    
97
	}
98
}
(21-21/36)