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.description.Sex;
|
15
|
import eu.etaxonomy.cdm.model.description.Stage;
|
16
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
17
|
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
23
|
|
24
|
/**
|
25
|
* <p>FieldObservationDetailElement class.</p>
|
26
|
*
|
27
|
* @author n.hoffmann
|
28
|
* @created Jun 17, 2010
|
29
|
* @version 1.0
|
30
|
*/
|
31
|
public class FieldObservationDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
|
32
|
|
33
|
private TextWithLabelElement text_ecology;
|
34
|
|
35
|
private TextWithLabelElement text_plantDescription;
|
36
|
|
37
|
private TextWithLabelElement text_fieldObjectDefinition;
|
38
|
|
39
|
private TextWithLabelElement text_fieldNotes;
|
40
|
|
41
|
private NumberWithLabelElement number_individualCount;
|
42
|
|
43
|
private TermComboElement<Sex> combo_sex;
|
44
|
|
45
|
private TermComboElement<Stage> combo_lifeStage;
|
46
|
|
47
|
/**
|
48
|
* <p>Constructor for FieldObservationDetailElement.</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 FieldObservationDetailElement(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
|
|
68
|
number_individualCount = formFactory.createIntegerTextWithLabelElement(formElement, "Individual Count", entity.getIndividualCount(), style);
|
69
|
combo_lifeStage = formFactory.createTermComboElement(Stage.class, formElement, "Life Stage", entity.getLifeStage(), style);
|
70
|
combo_sex = formFactory.createTermComboElement(Sex.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
|
}
|