Project

General

Profile

Download (3.62 KB) Statistics
| Branch: | Tag: | Revision:
1 2d9a13f7 n.hoffmann
/**
2
* Copyright (C) 2007 EDIT
3 6a9dd32f Patric Plitzner
* European Distributed Institute of Taxonomy
4 2d9a13f7 n.hoffmann
* http://www.e-taxonomy.eu
5 6a9dd32f Patric Plitzner
*
6 2d9a13f7 n.hoffmann
* 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 f211dd28 n.hoffmann
package eu.etaxonomy.taxeditor.ui.section.occurrence;
11 2d9a13f7 n.hoffmann
12
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
13 df5e3464 Katja Luther
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
14 2d9a13f7 n.hoffmann
import eu.etaxonomy.taxeditor.store.CdmStore;
15 78222507 n.hoffmann
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
16 dacb59c9 Patric Plitzner
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
17 78222507 n.hoffmann
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
18 2d9a13f7 n.hoffmann
19
/**
20 148d6ead Andreas Müller
 * <p>FieldUnitDetailElement class.</p>
21 3be6ef3e n.hoffmann
 *
22 2d9a13f7 n.hoffmann
 * @author n.hoffmann
23
 * @created Jun 17, 2010
24
 * @version 1.0
25
 */
26 fbbe5da0 Katja Luther
public class FieldUnitFacadeDetailElement extends AbstractSpecimenOrObservationDetailElement {
27 6a9dd32f Patric Plitzner
28 2d9a13f7 n.hoffmann
	private TextWithLabelElement text_ecology;
29
30
	private TextWithLabelElement text_plantDescription;
31
32
	private TextWithLabelElement text_fieldObjectDefinition;
33
34
	private TextWithLabelElement text_fieldNotes;
35 256fbc69 Katja Luther
36 df5e3464 Katja Luther
	private TextWithLabelElement text_lifeForm;
37 2d9a13f7 n.hoffmann
38 652496d7 Andreas Müller
	private TextWithLabelElement number_individualCount;
39 2d9a13f7 n.hoffmann
40 d72a0740 Katja Luther
//	private TermComboElement<DefinedTerm> combo_kindOfUnit;
41
//
42
//	private TermComboElement<DefinedTerm> combo_lifeStage;
43
//
44
//	private TermComboElement<DefinedTerm> combo_sex;
45 b8e0a9cc Patric Plitzner
46 3be6ef3e n.hoffmann
	/**
47 148d6ead Andreas Müller
	 * <p>Constructor for FieldUnitDetailElement.</p>
48 3be6ef3e n.hoffmann
	 *
49 78222507 n.hoffmann
	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
50
	 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
51 3be6ef3e n.hoffmann
	 */
52 fbbe5da0 Katja Luther
	public FieldUnitFacadeDetailElement(CdmFormFactory formFactory,
53 2d9a13f7 n.hoffmann
			ICdmFormElement formElement) {
54
		super(formFactory, formElement);
55
	}
56 6a9dd32f Patric Plitzner
57 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
58 2d9a13f7 n.hoffmann
	@Override
59
	protected void createControls(ICdmFormElement formElement,
60 c4c08e81 n.hoffmann
			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 30140758 n.hoffmann
		// Disable for now
64 c4c08e81 n.hoffmann
//		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 256fbc69 Katja Luther
		if (PreferencesUtil.isShowLifeForm()){
67 c8edc5c9 Katja Luther
			text_lifeForm = formFactory.createTextWithLabelElement(formElement, "Life Form", entity.getLifeform(PreferencesUtil.getGlobalLanguage()), style);
68
		}
69 256fbc69 Katja Luther
70 652496d7 Andreas Müller
		number_individualCount = formFactory.createTextWithLabelElement(formElement, "Individual Count", entity.getIndividualCount(), style);
71 d72a0740 Katja Luther
		super.createControls(formElement, entity, style);
72 2d9a13f7 n.hoffmann
	}
73
74 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
75 2d9a13f7 n.hoffmann
	@Override
76
	public void handleEvent(Object eventSource) {
77 d72a0740 Katja Luther
		super.handleEvent(eventSource);
78 2d9a13f7 n.hoffmann
		if(eventSource == text_ecology){
79 c4c08e81 n.hoffmann
			getEntity().setEcology(text_ecology.getText());
80 2d9a13f7 n.hoffmann
		}
81
		else if(eventSource == text_plantDescription){
82 c4c08e81 n.hoffmann
			getEntity().setPlantDescription(text_plantDescription.getText());
83 2d9a13f7 n.hoffmann
		}
84
		else if(eventSource == text_fieldObjectDefinition){
85 c4c08e81 n.hoffmann
			getEntity().addFieldObjectDefinition(text_fieldObjectDefinition.getText(), CdmStore.getDefaultLanguage());
86 2d9a13f7 n.hoffmann
		}
87
		else if(eventSource == text_fieldNotes){
88 c4c08e81 n.hoffmann
			getEntity().setFieldNotes(text_fieldNotes.getText());
89 2d9a13f7 n.hoffmann
		}
90 df5e3464 Katja Luther
		else if(eventSource == text_lifeForm){
91
			getEntity().setLifeform(text_lifeForm.getText());
92
		}
93 2d9a13f7 n.hoffmann
		else if(eventSource == number_individualCount){
94 652496d7 Andreas Müller
			getEntity().setIndividualCount(number_individualCount.getText());
95 2d9a13f7 n.hoffmann
		}
96 256fbc69 Katja Luther
97 2d9a13f7 n.hoffmann
	}
98
}