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
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.forms
.IEntityElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.forms
.SelectionArbitrator
;
22 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.SelectionType
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AbstractOriginalSourceElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.selection
.NameSelectionElement
;
27 * <p>DescriptionElementSourceElement class.</p>
30 * @created Nov 16, 2009
34 public class DescriptionElementSourceElement
extends AbstractOriginalSourceElement
<DescriptionElementSource
> implements IEntityElement
<DescriptionElementSource
>{
36 private SelectionArbitrator selectionArbitrator
;
38 private NameSelectionElement selection_name
;
42 * <p>Constructor for DescriptionElementSourceElement.</p>
44 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
45 * @param element a {@link eu.etaxonomy.cdm.model.common.DescriptionElementSource} object.
46 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
48 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
50 public DescriptionElementSourceElement(CdmFormFactory cdmFormFactory
, AbstractFormSection formElement
,
51 DescriptionElementSource element
, SelectionListener removeListener
, int style
) {
52 super(cdmFormFactory
, formElement
, element
, removeListener
, style
);
53 selectionArbitrator
= formFactory
.createSelectionArbitrator(this);
57 * @see eu.etaxonomy.taxeditor.forms.entitysections.OriginalSourceComposite#createControls(org.eclipse.swt.widgets.Composite, int)
61 public void createControls(ICdmFormElement formElement
, int style
) {
62 super.createControls(formElement
, style
);
63 selection_name
= (NameSelectionElement
) formFactory
.createSelectionElement(SelectionType
.NAME
, getConversationHolder(), formElement
, "Name in Source", null, SWT
.NULL
);
68 * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractOriginalSourceElement#setElement(eu.etaxonomy.cdm.model.common.OriginalSourceBase)
72 public void setEntity(DescriptionElementSource entity
) {
73 super.setEntity(entity
);
74 text_idInSource
.setText(entity
.getIdInSource());
75 text_idNamespace
.setText(entity
.getIdNamespace());
77 selection_reference
.setEntity(entity
.getCitation());
78 text_referenceDetail
.setText(entity
.getCitationMicroReference());
79 text_originaleNameString
.setText(entity
.getOriginalNameString());
80 selection_name
.setEntity(entity
.getNameUsedInSource());
85 public void setSelected(boolean selected
) {
91 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
95 public void handleEvent(Object eventSource
) {
96 if(eventSource
== text_idInSource
){
97 getEntity().setIdInSource(text_idInSource
.getText());
99 else if(eventSource
== text_idNamespace
){
100 getEntity().setIdNamespace(text_idNamespace
.getText());
102 else if(eventSource
== selection_reference
){
103 getEntity().setCitation(selection_reference
.getSelection());
105 else if(eventSource
== text_referenceDetail
){
106 getEntity().setCitationMicroReference(text_referenceDetail
.getText());
108 else if(eventSource
== text_originaleNameString
){
109 getEntity().setOriginalNameString(text_originaleNameString
.getText());
111 else if(eventSource
== selection_name
){
112 getEntity().setNameUsedInSource(selection_name
.getSelection());