1
|
/**
|
2
|
* Copyright (C) 2014 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
|
10
|
|
11
|
import java.util.Collection;
|
12
|
|
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;
|
19
|
|
20
|
/**
|
21
|
* This section visualizes {@link Reference}s belonging to a {@link Sequence} and alllows adding/removing them.
|
22
|
* @author pplitzner
|
23
|
* @date 07.01.2014
|
24
|
*
|
25
|
*/
|
26
|
public class SequenceReferenceCollectionDetailSection extends AbstractUnboundEntityCollectionSection<Sequence, Reference> {
|
27
|
|
28
|
public SequenceReferenceCollectionDetailSection(CdmFormFactory formFactory,
|
29
|
ConversationHolder conversation, ICdmFormElement parentElement, int style) {
|
30
|
super(formFactory, conversation, parentElement, "References", style);
|
31
|
}
|
32
|
|
33
|
/* (non-Javadoc)
|
34
|
* @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
|
35
|
*/
|
36
|
/** {@inheritDoc} */
|
37
|
@Override
|
38
|
protected Collection<Reference> getEntityCollection(Sequence entity) {
|
39
|
return entity.getCitations();
|
40
|
}
|
41
|
|
42
|
/* (non-Javadoc)
|
43
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
|
44
|
*/
|
45
|
/** {@inheritDoc} */
|
46
|
@Override
|
47
|
public Reference createNewElement() {
|
48
|
return ReferenceFactory.newGeneric();
|
49
|
}
|
50
|
|
51
|
/* (non-Javadoc)
|
52
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
53
|
*/
|
54
|
/** {@inheritDoc} */
|
55
|
@Override
|
56
|
public void addElement(Reference element) {
|
57
|
//never gets called
|
58
|
}
|
59
|
|
60
|
/* (non-Javadoc)
|
61
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
62
|
*/
|
63
|
/** {@inheritDoc} */
|
64
|
@Override
|
65
|
public void removeElement(Reference element) {
|
66
|
getEntity().removeCitation(element);
|
67
|
}
|
68
|
|
69
|
/* (non-Javadoc)
|
70
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
|
71
|
*/
|
72
|
/** {@inheritDoc} */
|
73
|
@Override
|
74
|
public String getEmptyString() {
|
75
|
return "No references yet.";
|
76
|
}
|
77
|
|
78
|
/* (non-Javadoc)
|
79
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
|
80
|
*/
|
81
|
/** {@inheritDoc} */
|
82
|
@Override
|
83
|
protected String getTooltipString() {
|
84
|
return "Add a reference";
|
85
|
}
|
86
|
|
87
|
/**
|
88
|
* {@inheritDoc}
|
89
|
*/
|
90
|
@Override
|
91
|
public Reference addExisting() {
|
92
|
return null;
|
93
|
}
|
94
|
|
95
|
/**
|
96
|
* {@inheritDoc}
|
97
|
*/
|
98
|
@Override
|
99
|
public boolean allowAddExisting() {
|
100
|
return false;
|
101
|
}
|
102
|
|
103
|
|
104
|
}
|