3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.ui
.section
.description
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.events
.SelectionListener
;
16 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
17 import eu
.etaxonomy
.taxeditor
.ui
.forms
.AbstractFormSection
;
18 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.SelectionType
;
20 import eu
.etaxonomy
.taxeditor
.ui
.forms
.ICdmFormElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.forms
.IEntityElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.forms
.SelectionArbitrator
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AbstractOriginalSourceElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
28 * DescriptionElementSourceElement class.
32 * @created Nov 16, 2009
36 public class DescriptionElementSourceElement
extends
37 AbstractOriginalSourceElement
<DescriptionElementSource
> implements
38 IEntityElement
<DescriptionElementSource
> {
40 private final SelectionArbitrator selectionArbitrator
;
42 private NameSelectionElement selection_name
;
46 * Constructor for DescriptionElementSourceElement.
50 * a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection}
54 * {@link eu.etaxonomy.cdm.model.common.DescriptionElementSource}
56 * @param removeListener
57 * a {@link org.eclipse.swt.events.SelectionListener} object.
60 * @param cdmFormFactory
61 * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
64 public DescriptionElementSourceElement(CdmFormFactory cdmFormFactory
,
65 AbstractFormSection formElement
, DescriptionElementSource element
,
66 SelectionListener removeListener
, int style
) {
67 super(cdmFormFactory
, formElement
, element
, removeListener
, style
);
68 selectionArbitrator
= formFactory
.createSelectionArbitrator(this);
74 * @see eu.etaxonomy.taxeditor.forms.entitysections.OriginalSourceComposite#
75 * createControls(org.eclipse.swt.widgets.Composite, int)
79 public void createControls(ICdmFormElement formElement
, int style
) {
80 super.createControls(formElement
, style
);
81 selection_name
= (NameSelectionElement
) formFactory
82 .createSelectionElement(SelectionType
.NAME
,
83 getConversationHolder(), formElement
, "Name in Source",
84 null, NameSelectionElement
.DEFAULT
, SWT
.NULL
);
91 * eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractOriginalSourceElement
92 * #setElement(eu.etaxonomy.cdm.model.common.OriginalSourceBase)
96 public void setEntity(DescriptionElementSource entity
) {
97 super.setEntity(entity
);
98 text_idInSource
.setText(entity
.getIdInSource());
99 text_idNamespace
.setText(entity
.getIdNamespace());
101 selection_reference
.setEntity(entity
.getCitation());
102 text_referenceDetail
.setText(entity
.getCitationMicroReference());
103 text_originaleNameString
.setText(entity
.getOriginalNameString());
104 selection_name
.setEntity(entity
.getNameUsedInSource());
109 public void setSelected(boolean selected
) {
117 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
122 public void handleEvent(Object eventSource
) {
123 if (eventSource
== text_idInSource
) {
124 getEntity().setIdInSource(text_idInSource
.getText());
125 } else if (eventSource
== text_idNamespace
) {
126 getEntity().setIdNamespace(text_idNamespace
.getText());
127 } else if (eventSource
== selection_reference
) {
128 getEntity().setCitation(selection_reference
.getSelection());
129 } else if (eventSource
== text_referenceDetail
) {
130 getEntity().setCitationMicroReference(
131 text_referenceDetail
.getText());
132 } else if (eventSource
== text_originaleNameString
) {
133 getEntity().setOriginalNameString(
134 text_originaleNameString
.getText());
135 } else if (eventSource
== selection_name
) {
136 getEntity().setNameUsedInSource(selection_name
.getSelection());