3079a4d28edf42f37ee16ea1f8b762a26085ee27
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / SequenceReferenceCollectionDetailSection.java
1 // $Id$
2 /**
3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.ui.section.occurrence;
11
12 import java.util.Collection;
13
14 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15 import eu.etaxonomy.cdm.model.molecular.Sequence;
16 import eu.etaxonomy.cdm.model.reference.Reference;
17 import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
18 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
20
21 /**
22 * @author pplitzner
23 * @date 07.01.2014
24 *
25 */
26 public class SequenceReferenceCollectionDetailSection extends
27 AbstractEntityCollectionSection<Sequence, Reference> {
28
29 public SequenceReferenceCollectionDetailSection(CdmFormFactory formFactory,
30 ConversationHolder conversation, ICdmFormElement parentElement, int style) {
31 super(formFactory, conversation, parentElement, "References", style);
32 }
33
34 /* (non-Javadoc)
35 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
36 */
37 /** {@inheritDoc} */
38 @Override
39 public Collection<Reference> getCollection(Sequence entity) {
40 return entity.getCitations();
41 }
42
43 /* (non-Javadoc)
44 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
45 */
46 /** {@inheritDoc} */
47 @Override
48 public Reference createNewElement() {
49 return null;
50 }
51
52 /* (non-Javadoc)
53 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
54 */
55 /** {@inheritDoc} */
56 @Override
57 public void addElement(Reference element) {
58 getEntity().addCitation(element);
59 }
60
61 /* (non-Javadoc)
62 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
63 */
64 /** {@inheritDoc} */
65 @Override
66 public void removeElement(Reference element) {
67 getEntity().removeCitation(element);
68 }
69
70 /* (non-Javadoc)
71 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
72 */
73 /** {@inheritDoc} */
74 @Override
75 public String getEmptyString() {
76 return "No references yet.";
77 }
78
79 /* (non-Javadoc)
80 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
81 */
82 /** {@inheritDoc} */
83 @Override
84 protected String getTooltipString() {
85 return "Add a reference";
86 }
87
88
89 }