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.description.detail;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.description.Distribution;
|
14
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
|
15
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
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.selection.EntitySelectionElement;
|
20
|
|
21
|
/**
|
22
|
* <p>DistributionDetailElement class.</p>
|
23
|
*
|
24
|
* @author n.hoffmann
|
25
|
* @created Jun 10, 2010
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class DistributionDetailElement extends
|
29
|
AbstractDetailedDescriptionDetailElement<Distribution> {
|
30
|
|
31
|
private EntitySelectionElement<NamedArea> selection_namedArea;
|
32
|
private TermComboElement<PresenceAbsenceTerm> combo_presenceAbsence;
|
33
|
|
34
|
|
35
|
/**
|
36
|
* <p>Constructor for DistributionDetailElement.</p>
|
37
|
*
|
38
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
39
|
* @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
40
|
* @param entity a {@link eu.etaxonomy.cdm.model.description.Distribution} object.
|
41
|
* @param style a int.
|
42
|
*/
|
43
|
public DistributionDetailElement(CdmFormFactory formFactory,
|
44
|
ICdmFormElement formElement, Distribution entity, int style) {
|
45
|
super(formFactory, formElement, entity, style);
|
46
|
}
|
47
|
|
48
|
/** {@inheritDoc} */
|
49
|
@Override
|
50
|
protected void createControls(ICdmFormElement formElement,
|
51
|
Distribution entity, int style) {
|
52
|
selection_namedArea = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
|
53
|
formElement, "Area",
|
54
|
entity.getArea(), EntitySelectionElement.NOTHING, style);
|
55
|
combo_presenceAbsence = formFactory.createTermComboElement(PresenceAbsenceTerm.class, this, "Distribution Status", entity.getStatus(), style);
|
56
|
|
57
|
}
|
58
|
|
59
|
/** {@inheritDoc} */
|
60
|
@Override
|
61
|
public void handleEvent(Object eventSource) {
|
62
|
if(eventSource == selection_namedArea){
|
63
|
getEntity().setArea(selection_namedArea.getEntity());
|
64
|
}else if(eventSource == combo_presenceAbsence){
|
65
|
getEntity().setStatus(combo_presenceAbsence.getSelection());
|
66
|
}
|
67
|
}
|
68
|
|
69
|
|
70
|
}
|