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
.forms
.AbstractFormSection
;
12 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
;
13 import eu
.etaxonomy
.taxeditor
.ui
.forms
.ICdmFormElement
;
14 import eu
.etaxonomy
.taxeditor
.ui
.forms
.TextWithLabelElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.TermComboType
;
16 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.term
.ExtensionTypeComboElement
;
20 * <p>ExtensionElement class.</p>
23 * @created Nov 17, 2009
26 public class ExtensionElement
extends AbstractEntityCollectionElement
<Extension
> {
28 private ExtensionTypeComboElement combo_extensionType
;
29 private TextWithLabelElement text_extensionValue
;
32 * <p>Constructor for ExtensionElement.</p>
34 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
35 * @param element a {@link eu.etaxonomy.cdm.model.common.Extension} object.
36 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
38 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
40 public ExtensionElement(CdmFormFactory cdmFormFactory
, AbstractFormSection formElement
, Extension element
,
41 SelectionListener removeListener
, int style
) {
42 super(cdmFormFactory
, formElement
, element
, removeListener
, null, style
);
46 * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
50 public void createControls(ICdmFormElement element
, int style
) {
51 combo_extensionType
= (ExtensionTypeComboElement
) formFactory
.createTermComboElement(TermComboType
.EXTENSIONTYPE
, this, null, null, style
);
52 text_extensionValue
= formFactory
.createTextWithLabelElement(element
, null, null, style
);
53 text_extensionValue
.getLayoutComposite().setLayoutData(CdmFormFactory
.FILL_HORIZONTALLY());
57 * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#setElement(eu.etaxonomy.cdm.model.common.VersionableEntity)
61 public void setEntity(Extension element
) {
62 this.entity
= element
;
63 ExtensionType extensionType
= (ExtensionType
) HibernateProxyHelper
.deproxy(element
.getType());
64 combo_extensionType
.setSelection(extensionType
);
65 text_extensionValue
.setText(element
.getValue());
70 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
74 public void handleEvent(Object eventSource
) {
75 if(eventSource
== combo_extensionType
){
76 entity
.setType(combo_extensionType
.getSelection());
78 else if(eventSource
== text_extensionValue
){
79 entity
.setValue(text_extensionValue
.getText());