4 package eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
;
6 import org
.eclipse
.swt
.events
.SelectionListener
;
8 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
9 import eu
.etaxonomy
.cdm
.model
.common
.AnnotationType
;
10 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
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>AnnotationElement class.</p>
24 public class AnnotationElement
extends AbstractEntityCollectionElement
<Annotation
>{
26 private TextWithLabelElement text
;
27 private TermComboElement
<AnnotationType
> combo_annotationType
;
30 * <p>Constructor for AnnotationElement.</p>
32 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
33 * @param annotation a {@link eu.etaxonomy.cdm.model.common.Annotation} object.
35 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
36 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
38 public AnnotationElement(CdmFormFactory cdmFormFactory
, AbstractFormSection formElement
, Annotation annotation
, SelectionListener removeListener
, int style
) {
39 super(cdmFormFactory
, formElement
, annotation
, removeListener
, null, style
);
43 * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetComposite#createControls(org.eclipse.swt.widgets.Composite)
47 public void createControls(ICdmFormElement element
, int style
) {
48 combo_annotationType
= formFactory
.createDefinedTermComboElement(TermType
.AnnotationType
, this, "Annotation Type", null, style
);
50 text
= formFactory
.createMultilineTextWithLabel(this, "Annotation", 100, style
);
54 * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetComposite#setEntity(eu.etaxonomy.cdm.model.common.AnnotatableEntity)
58 public void setEntity(Annotation entity
) {
60 combo_annotationType
.setSelection(getEntity().getAnnotationType());
61 text
.setText(entity
.getText());
66 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
70 public void handleEvent(Object eventSource
) {
71 if(eventSource
== combo_annotationType
){
72 getEntity().setAnnotationType(combo_annotationType
.getSelection());
73 }else if(eventSource
== text
){
74 getEntity().setText(text
.getText());