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