2 * Copyright (C) 2014 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
;
11 import java
.util
.Collection
;
13 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
14 import eu
.etaxonomy
.cdm
.model
.molecular
.Sequence
;
15 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
16 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
17 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
21 * This section visualizes {@link Reference}s belonging to a {@link Sequence} and alllows adding/removing them.
26 public class SequenceReferenceCollectionDetailSection
extends AbstractUnboundEntityCollectionSection
<Sequence
, Reference
> {
28 public SequenceReferenceCollectionDetailSection(CdmFormFactory formFactory
,
29 ConversationHolder conversation
, ICdmFormElement parentElement
, int style
) {
30 super(formFactory
, conversation
, parentElement
, "References", style
);
34 * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
38 protected Collection
<Reference
> getEntityCollection(Sequence entity
) {
39 return entity
.getCitations();
43 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
47 public Reference
createNewElement() {
48 return ReferenceFactory
.newGeneric();
52 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
56 public void addElement(Reference element
) {
61 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
65 public void removeElement(Reference element
) {
66 getEntity().removeCitation(element
);
70 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
74 public String
getEmptyString() {
75 return "No references yet.";
79 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
83 protected String
getTooltipString() {
84 return "Add a reference";