4 package eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
;
6 import java
.util
.Collection
;
8 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
9 import eu
.etaxonomy
.cdm
.model
.common
.AnnotatableEntity
;
10 import eu
.etaxonomy
.cdm
.model
.common
.Annotation
;
11 import eu
.etaxonomy
.cdm
.model
.common
.AnnotationType
;
12 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
13 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
14 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
15 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
16 import eu
.etaxonomy
.taxeditor
.ui
.section
.campanula
.compatibility
.ICdmFormElement
;
19 * <p>AnnotationSection class.</p>
22 * @created Nov 5, 2009
25 public class AnnotationSection
extends AbstractEntityCollectionSection
<AnnotatableEntity
, Annotation
>{
28 * <p>Constructor for AnnotationSection.</p>
30 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
32 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
33 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
35 public AnnotationSection(CdmFormFactory cdmFormFactory
, ConversationHolder conversation
, ICdmFormElement parentElement
, int style
) {
36 super(cdmFormFactory
, conversation
, parentElement
, "Annotations", style
);
41 public Annotation
createNewElement() {
43 AnnotationType type
= AnnotationType
.EDITORIAL();
44 Language language
= CdmStore
.getDefaultLanguage();
46 return Annotation
.NewInstance(text
, type
, language
);
51 public Collection
<Annotation
> getCollection(AnnotatableEntity entity
) {
52 return entity
.getAnnotations();
57 public String
getEmptyString() {
58 return "No annotations yet.";
63 protected String
getTooltipString() {
64 return "Create a new annotation";
69 public void addElement(Annotation element
) {
70 getEntity().addAnnotation(element
);
75 public void removeElement(Annotation element
) {
76 getEntity().removeAnnotation(element
);