4 package eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
;
6 import org
.eclipse
.swt
.events
.SelectionListener
;
8 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
9 import eu
.etaxonomy
.cdm
.model
.common
.Extension
;
10 import eu
.etaxonomy
.cdm
.model
.common
.ExtensionType
;
11 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
12 import eu
.etaxonomy
.taxeditor
.ui
.element
.AbstractFormSection
;
13 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
14 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
16 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
19 * <p>ExtensionElement class.</p>
22 * @created Nov 17, 2009
25 public class ExtensionElement
extends AbstractEntityCollectionElement
<Extension
> {
27 private TermComboElement
<ExtensionType
> combo_extensionType
;
28 private TextWithLabelElement text_extensionValue
;
31 * <p>Constructor for ExtensionElement.</p>
33 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
34 * @param element a {@link eu.etaxonomy.cdm.model.common.Extension} object.
35 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
37 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
39 public ExtensionElement(CdmFormFactory cdmFormFactory
, AbstractFormSection formElement
, Extension element
,
40 SelectionListener removeListener
, int style
) {
41 super(cdmFormFactory
, formElement
, element
, removeListener
, null, style
);
45 * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
49 public void createControls(ICdmFormElement element
, int style
) {
50 combo_extensionType
= formFactory
.createTermComboElement(ExtensionType
.class, this, null, null, style
);
51 text_extensionValue
= formFactory
.createTextWithLabelElement(element
, null, null, style
);
52 text_extensionValue
.getLayoutComposite().setLayoutData(CdmFormFactory
.FILL_HORIZONTALLY());
56 * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#setElement(eu.etaxonomy.cdm.model.common.VersionableEntity)
60 public void setEntity(Extension element
) {
61 this.entity
= element
;
62 ExtensionType extensionType
= (ExtensionType
) HibernateProxyHelper
.deproxy(element
.getType());
63 combo_extensionType
.setSelection(extensionType
);
64 text_extensionValue
.setText(element
.getValue());
69 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
73 public void handleEvent(Object eventSource
) {
74 if(eventSource
== combo_extensionType
){
75 entity
.setType(combo_extensionType
.getSelection());
77 else if(eventSource
== text_extensionValue
){
78 entity
.setValue(text_extensionValue
.getText());