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.identifier;
|
12
|
|
13
|
import org.eclipse.swt.events.SelectionListener;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.common.DefinedTerm;
|
16
|
import eu.etaxonomy.cdm.model.common.Identifier;
|
17
|
import eu.etaxonomy.cdm.model.common.TermType;
|
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.ICdmFormElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
|
24
|
|
25
|
/**
|
26
|
* <p>
|
27
|
* CollectionDetailElement class.
|
28
|
* </p>
|
29
|
*
|
30
|
* @author n.hoffmann
|
31
|
* @created Oct 13, 2010
|
32
|
* @version 1.0
|
33
|
*/
|
34
|
public class IdentifierDetailElement extends AbstractEntityCollectionElement<Identifier> {
|
35
|
|
36
|
private TextWithLabelElement textIdentifier;
|
37
|
|
38
|
private TermComboElement<DefinedTerm> comboIdentifierType;
|
39
|
|
40
|
/**
|
41
|
* <p>
|
42
|
* Constructor for CollectingAreasDetailElement.
|
43
|
* </p>
|
44
|
*
|
45
|
* @param formFactory
|
46
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
47
|
* object.
|
48
|
* @param section
|
49
|
* a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
|
50
|
* object.
|
51
|
* @param entity
|
52
|
* a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
|
53
|
* @param removeListener
|
54
|
* a {@link org.eclipse.swt.events.SelectionListener} object.
|
55
|
* @param style
|
56
|
* a int.
|
57
|
*/
|
58
|
public IdentifierDetailElement(CdmFormFactory formFactory,
|
59
|
AbstractFormSection section, Identifier entity,
|
60
|
SelectionListener removeListener, int style) {
|
61
|
super(formFactory, section, entity, removeListener, null, style);
|
62
|
}
|
63
|
|
64
|
/*
|
65
|
* (non-Javadoc)
|
66
|
*
|
67
|
* @see
|
68
|
* eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
|
69
|
* (java.lang.Object)
|
70
|
*/
|
71
|
/** {@inheritDoc} */
|
72
|
@Override
|
73
|
public void setEntity(Identifier entity) {
|
74
|
this.entity = entity;
|
75
|
textIdentifier.setText(entity.getIdentifier());
|
76
|
comboIdentifierType.setSelection(entity.getType());
|
77
|
}
|
78
|
|
79
|
/*
|
80
|
* (non-Javadoc)
|
81
|
*
|
82
|
* @see
|
83
|
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
|
84
|
* (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
|
85
|
* eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
|
86
|
*/
|
87
|
/** {@inheritDoc} */
|
88
|
@Override
|
89
|
public void createControls(ICdmFormElement formElement, int style) {
|
90
|
textIdentifier = formFactory.createTextWithLabelElement(formElement, "Identifier", null, style);
|
91
|
comboIdentifierType = formFactory.createDefinedTermComboElement(TermType.IdentifierType, formElement, "Type", null, style);
|
92
|
}
|
93
|
|
94
|
/*
|
95
|
* (non-Javadoc)
|
96
|
*
|
97
|
* @see
|
98
|
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
|
99
|
* .lang.Object)
|
100
|
*/
|
101
|
/** {@inheritDoc} */
|
102
|
@Override
|
103
|
public void handleEvent(Object eventSource) {
|
104
|
if (eventSource == textIdentifier) {
|
105
|
getEntity().setIdentifier(textIdentifier.getText());
|
106
|
} else if (eventSource == comboIdentifierType) {
|
107
|
getEntity().setType(comboIdentifierType.getSelection());
|
108
|
}
|
109
|
}
|
110
|
|
111
|
}
|