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
.taxeditor
.ui
.campanula
.compatibility
.ICdmFormElement
;
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
.TextWithLabelElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
18 * <p>AnnotationElement class.</p>
23 public class AnnotationElement
extends AbstractEntityCollectionElement
<Annotation
>{
25 private TextWithLabelElement text
;
26 private TermComboElement
<AnnotationType
> combo_annotationType
;
29 * <p>Constructor for AnnotationElement.</p>
31 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
32 * @param annotation a {@link eu.etaxonomy.cdm.model.common.Annotation} object.
34 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
35 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
37 public AnnotationElement(CdmFormFactory cdmFormFactory
, AbstractFormSection formElement
, Annotation annotation
, SelectionListener removeListener
, int style
) {
38 super(cdmFormFactory
, formElement
, annotation
, removeListener
, null, style
);
42 * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetComposite#createControls(org.eclipse.swt.widgets.Composite)
46 public void createControls(ICdmFormElement element
, int style
) {
47 combo_annotationType
= formFactory
.createTermComboElement(AnnotationType
.class, this, "Annotation Type", null, style
);
49 text
= formFactory
.createMultilineTextWithLabel(this, "Annotation", 100, style
);
53 * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetComposite#setEntity(eu.etaxonomy.cdm.model.common.AnnotatableEntity)
57 public void setEntity(Annotation entity
) {
59 combo_annotationType
.setSelection(getEntity().getAnnotationType());
60 text
.setText(entity
.getText());
65 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
69 public void handleEvent(Object eventSource
) {
70 if(eventSource
== combo_annotationType
){
71 getEntity().setAnnotationType(combo_annotationType
.getSelection());
72 }else if(eventSource
== text
){
73 getEntity().setText(text
.getText());