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;
|
12
|
|
13
|
import org.eclipse.swt.SWT;
|
14
|
import org.eclipse.swt.events.SelectionListener;
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.common.DescriptionElementSource;
|
17
|
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
18
|
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractOriginalSourceElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
24
|
|
25
|
/**
|
26
|
* <p>
|
27
|
* DescriptionElementSourceElement class.
|
28
|
* </p>
|
29
|
*
|
30
|
* @author n.hoffmann
|
31
|
* @created Nov 16, 2009
|
32
|
* @version 1.0
|
33
|
* @param <T>
|
34
|
*/
|
35
|
public class DescriptionElementSourceElement extends
|
36
|
AbstractOriginalSourceElement<DescriptionElementSource> implements
|
37
|
IEntityElement<DescriptionElementSource> {
|
38
|
|
39
|
private EntitySelectionElement<TaxonNameBase> selection_name;
|
40
|
|
41
|
/**
|
42
|
* <p>
|
43
|
* Constructor for DescriptionElementSourceElement.
|
44
|
* </p>
|
45
|
*
|
46
|
* @param formElement
|
47
|
* a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
|
48
|
* object.
|
49
|
* @param element
|
50
|
* a
|
51
|
* {@link eu.etaxonomy.cdm.model.common.DescriptionElementSource}
|
52
|
* object.
|
53
|
* @param removeListener
|
54
|
* a {@link org.eclipse.swt.events.SelectionListener} object.
|
55
|
* @param style
|
56
|
* a int.
|
57
|
* @param cdmFormFactory
|
58
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
59
|
* object.
|
60
|
*/
|
61
|
public DescriptionElementSourceElement(CdmFormFactory cdmFormFactory,
|
62
|
AbstractFormSection formElement, DescriptionElementSource element,
|
63
|
SelectionListener removeListener, int style) {
|
64
|
super(cdmFormFactory, formElement, element, removeListener, style);
|
65
|
formFactory.createSelectionArbitrator(this);
|
66
|
}
|
67
|
|
68
|
/*
|
69
|
* (non-Javadoc)
|
70
|
*
|
71
|
* @see eu.etaxonomy.taxeditor.forms.entitysections.OriginalSourceComposite#
|
72
|
* createControls(org.eclipse.swt.widgets.Composite, int)
|
73
|
*/
|
74
|
/** {@inheritDoc} */
|
75
|
@Override
|
76
|
public void createControls(ICdmFormElement formElement, int style) {
|
77
|
super.createControls(formElement, style);
|
78
|
selection_name = formFactory
|
79
|
.createSelectionElement(TaxonNameBase.class,
|
80
|
getConversationHolder(), formElement, "Name in Source",
|
81
|
null, EntitySelectionElement.ALL, SWT.NULL);
|
82
|
}
|
83
|
|
84
|
/*
|
85
|
* (non-Javadoc)
|
86
|
*
|
87
|
* @see
|
88
|
* eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractOriginalSourceElement
|
89
|
* #setElement(eu.etaxonomy.cdm.model.common.OriginalSourceBase)
|
90
|
*/
|
91
|
/** {@inheritDoc} */
|
92
|
@Override
|
93
|
public void setEntity(DescriptionElementSource entity) {
|
94
|
super.setEntity(entity);
|
95
|
text_idInSource.setText(entity.getIdInSource());
|
96
|
text_idNamespace.setText(entity.getIdNamespace());
|
97
|
|
98
|
selection_reference.setEntity(entity.getCitation());
|
99
|
text_referenceDetail.setText(entity.getCitationMicroReference());
|
100
|
text_originaleNameString.setText(entity.getOriginalNameString());
|
101
|
selection_name.setEntity(entity.getNameUsedInSource());
|
102
|
}
|
103
|
|
104
|
/** {@inheritDoc} */
|
105
|
@Override
|
106
|
public void setSelected(boolean selected) {
|
107
|
|
108
|
}
|
109
|
|
110
|
/*
|
111
|
* (non-Javadoc)
|
112
|
*
|
113
|
* @see
|
114
|
* eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
|
115
|
* (java.lang.Object)
|
116
|
*/
|
117
|
/** {@inheritDoc} */
|
118
|
@Override
|
119
|
public void handleEvent(Object eventSource) {
|
120
|
if (eventSource == text_idInSource) {
|
121
|
getEntity().setIdInSource(text_idInSource.getText());
|
122
|
} else if (eventSource == text_idNamespace) {
|
123
|
getEntity().setIdNamespace(text_idNamespace.getText());
|
124
|
} else if (eventSource == selection_reference) {
|
125
|
getEntity().setCitation(selection_reference.getSelection());
|
126
|
} else if (eventSource == text_referenceDetail) {
|
127
|
getEntity().setCitationMicroReference(
|
128
|
text_referenceDetail.getText());
|
129
|
} else if (eventSource == text_originaleNameString) {
|
130
|
getEntity().setOriginalNameString(
|
131
|
text_originaleNameString.getText());
|
132
|
} else if (eventSource == selection_name) {
|
133
|
getEntity().setNameUsedInSource(selection_name.getSelection());
|
134
|
}
|
135
|
}
|
136
|
|
137
|
}
|