Project

General

Profile

Download (3.81 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.ui.section.occurrence;
12

    
13
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
14
import eu.etaxonomy.cdm.model.common.DefinedTerm;
15
import eu.etaxonomy.taxeditor.store.CdmStore;
16
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
20
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
22

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

    
34
	private TextWithLabelElement text_plantDescription;
35

    
36
	private TextWithLabelElement text_fieldObjectDefinition;
37

    
38
	private TextWithLabelElement text_fieldNotes;
39

    
40
	private NumberWithLabelElement number_individualCount;
41

    
42
	private TermComboElement<DefinedTerm> combo_sex;
43

    
44
	private TermComboElement<DefinedTerm> combo_lifeStage;
45
	
46
	/**
47
	 * <p>Constructor for FieldObservationDetailElement.</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 FieldObservationDetailElement(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
		
67
		number_individualCount = formFactory.createIntegerTextWithLabelElement(formElement, "Individual Count", entity.getIndividualCount(), style);
68
		//FIXME:3.3MC
69
		combo_lifeStage = formFactory.createTermComboElement(DefinedTerm.class, formElement, "Life Stage", entity.getLifeStage(), style);
70
		combo_sex = formFactory.createTermComboElement(DefinedTerm.class, formElement, "Sex", entity.getSex(), style);
71
	}
72

    
73
	/** {@inheritDoc} */
74
	@Override
75
	public void handleEvent(Object eventSource) {
76
		if(eventSource == text_ecology){
77
			getEntity().setEcology(text_ecology.getText());
78
		}
79
		else if(eventSource == text_plantDescription){
80
			getEntity().setPlantDescription(text_plantDescription.getText());
81
		}
82
		else if(eventSource == text_fieldObjectDefinition){
83
			getEntity().addFieldObjectDefinition(text_fieldObjectDefinition.getText(), CdmStore.getDefaultLanguage());
84
		}
85
		else if(eventSource == text_fieldNotes){
86
			getEntity().setFieldNotes(text_fieldNotes.getText());
87
		}
88
		else if(eventSource == number_individualCount){
89
			getEntity().setIndividualCount(number_individualCount.getInteger());
90
		}
91
		else if(eventSource == combo_lifeStage){
92
			getEntity().setLifeStage(combo_lifeStage.getSelection());
93
		}
94
		else if(eventSource == combo_sex){
95
			getEntity().setSex(combo_sex.getSelection());
96
		}
97
	}
98
}
(16-16/29)