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 org.eclipse.swt.events.SelectionListener;
|
14
|
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.common.DefinedTerm;
|
17
|
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
|
18
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
19
|
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
24
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
25
|
|
26
|
/**
|
27
|
* <p>
|
28
|
* DeterminationEventDetailElement class.
|
29
|
* </p>
|
30
|
*
|
31
|
* @author n.hoffmann
|
32
|
* @created Oct 13, 2010
|
33
|
* @version 1.0
|
34
|
*/
|
35
|
public class DeterminationEventDetailElement extends
|
36
|
AbstractEventDetailElement<DeterminationEvent> {
|
37
|
|
38
|
private TermComboElement<DefinedTerm> combo_determinationModifier;
|
39
|
private CheckboxElement checkbox_preferredFlag;
|
40
|
private EntitySelectionElement<TaxonBase> selection_taxonBase;
|
41
|
|
42
|
// private TODO a set of references
|
43
|
|
44
|
/**
|
45
|
* <p>
|
46
|
* Constructor for DeterminationEventDetailElement.
|
47
|
* </p>
|
48
|
*
|
49
|
* @param formFactory
|
50
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
51
|
* object.
|
52
|
* @param section
|
53
|
* a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
|
54
|
* object.
|
55
|
* @param entity
|
56
|
* a {@link eu.etaxonomy.cdm.model.occurrence.DeterminationEvent}
|
57
|
* object.
|
58
|
* @param removeListener
|
59
|
* a {@link org.eclipse.swt.events.SelectionListener} object.
|
60
|
* @param style
|
61
|
* a int.
|
62
|
*/
|
63
|
public DeterminationEventDetailElement(CdmFormFactory formFactory,
|
64
|
AbstractFormSection section, DeterminationEvent entity,
|
65
|
SelectionListener removeListener, int style) {
|
66
|
super(formFactory, section, entity, removeListener, style);
|
67
|
}
|
68
|
|
69
|
/*
|
70
|
* (non-Javadoc)
|
71
|
*
|
72
|
* @see
|
73
|
* eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
|
74
|
* (eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
75
|
*/
|
76
|
/** {@inheritDoc} */
|
77
|
@Override
|
78
|
public void setEntity(DeterminationEvent entity) {
|
79
|
this.entity = entity;
|
80
|
combo_determinationModifier.setSelection(entity.getModifier());
|
81
|
selection_taxonBase.setEntity(entity.getTaxon());
|
82
|
super.setEntity(entity);
|
83
|
}
|
84
|
|
85
|
/*
|
86
|
* (non-Javadoc)
|
87
|
*
|
88
|
* @see
|
89
|
* eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
|
90
|
* (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
|
91
|
*/
|
92
|
/** {@inheritDoc} */
|
93
|
@Override
|
94
|
public void createControls(ICdmFormElement element, int style) {
|
95
|
selection_taxonBase = formFactory
|
96
|
.createSelectionElement(TaxonBase.class,
|
97
|
getConversationHolder(), element, "Taxon", null,
|
98
|
EntitySelectionElement.NOTHING, style);
|
99
|
|
100
|
|
101
|
// TODO set of references
|
102
|
|
103
|
super.createControls(element, style);
|
104
|
|
105
|
element_timePeriod.setLabel("Determined When");
|
106
|
selection_agent.setLabel("Determined by");
|
107
|
|
108
|
|
109
|
combo_determinationModifier = formFactory.createTermComboElement(DefinedTerm.class,
|
110
|
element, "Modifier", null, style);
|
111
|
}
|
112
|
|
113
|
/*
|
114
|
* (non-Javadoc)
|
115
|
*
|
116
|
* @see
|
117
|
* eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
|
118
|
* (java.lang.Object)
|
119
|
*/
|
120
|
/** {@inheritDoc} */
|
121
|
@Override
|
122
|
public void handleEvent(Object eventSource) {
|
123
|
if (eventSource == combo_determinationModifier) {
|
124
|
getEntity().setModifier(combo_determinationModifier.getSelection());
|
125
|
} else if (eventSource == checkbox_preferredFlag) {
|
126
|
getEntity().setPreferredFlag(checkbox_preferredFlag.getSelection());
|
127
|
} else if (eventSource == selection_taxonBase) {
|
128
|
getEntity().setTaxon(selection_taxonBase.getSelection());
|
129
|
}
|
130
|
// else if(eventSource == TODO set of references){
|
131
|
//
|
132
|
// }
|
133
|
else if (eventSource == selection_agent) {
|
134
|
getEntity().setDeterminer(selection_agent.getSelection());
|
135
|
} else if (eventSource == text_description) {
|
136
|
getEntity().setDescription(text_description.getText());
|
137
|
} else if (eventSource == element_timePeriod) {
|
138
|
getEntity().setTimeperiod(element_timePeriod.getTimePeriod());
|
139
|
}
|
140
|
}
|
141
|
|
142
|
}
|