1 |
729887cf
|
n.hoffmann
|
/**
|
2 |
3331cc69
|
Cherian Mathew
|
*
|
3 |
729887cf
|
n.hoffmann
|
*/
|
4 |
f211dd28
|
n.hoffmann
|
package eu.etaxonomy.taxeditor.ui.section.description;
|
5 |
729887cf
|
n.hoffmann
|
|
6 |
9bdb03b1
|
Patrick Plitzner
|
import java.util.ArrayList;
|
7 |
729887cf
|
n.hoffmann
|
import java.util.Collection;
|
8 |
9bdb03b1
|
Patrick Plitzner
|
import java.util.Collections;
|
9 |
|
|
import java.util.List;
|
10 |
729887cf
|
n.hoffmann
|
|
11 |
2d9a13f7
|
n.hoffmann
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
12 |
4f1767d9
|
Cherian Mathew
|
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
|
13 |
729887cf
|
n.hoffmann
|
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
14 |
1e2ff9ee
|
Patric Plitzner
|
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
|
15 |
78222507
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
16 |
dacb59c9
|
Patric Plitzner
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
17 |
f211dd28
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
18 |
729887cf
|
n.hoffmann
|
|
19 |
|
|
/**
|
20 |
9bdb03b1
|
Patrick Plitzner
|
* <p>
|
21 |
|
|
* DescriptionElementSourceSection class.
|
22 |
|
|
* </p>
|
23 |
3be6ef3e
|
n.hoffmann
|
*
|
24 |
729887cf
|
n.hoffmann
|
* @author n.hoffmann
|
25 |
|
|
* @created Nov 17, 2009
|
26 |
|
|
* @version 1.0
|
27 |
|
|
*/
|
28 |
9bdb03b1
|
Patrick Plitzner
|
public class DescriptionElementSourceSection extends
|
29 |
|
|
AbstractEntityCollectionSection<DescriptionElementBase, DescriptionElementSource> {
|
30 |
729887cf
|
n.hoffmann
|
|
31 |
9bdb03b1
|
Patrick Plitzner
|
/**
|
32 |
|
|
* <p>
|
33 |
|
|
* Constructor for DescriptionElementSourceSection.
|
34 |
|
|
* </p>
|
35 |
|
|
*
|
36 |
|
|
* @param parentElement
|
37 |
|
|
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
|
38 |
|
|
* object.
|
39 |
|
|
* @param style
|
40 |
|
|
* a int.
|
41 |
|
|
* @param cdmFormFactory
|
42 |
|
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
43 |
|
|
* object.
|
44 |
|
|
* @param conversation
|
45 |
|
|
* a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
|
46 |
|
|
* object.
|
47 |
|
|
*/
|
48 |
|
|
public DescriptionElementSourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
|
49 |
|
|
ICdmFormElement parentElement, int style) {
|
50 |
|
|
super(cdmFormFactory, conversation, parentElement, "References", style);
|
51 |
|
|
}
|
52 |
729887cf
|
n.hoffmann
|
|
53 |
9bdb03b1
|
Patrick Plitzner
|
/** {@inheritDoc} */
|
54 |
|
|
@Override
|
55 |
|
|
public DescriptionElementSource createNewElement() {
|
56 |
|
|
return DescriptionElementSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
|
57 |
|
|
}
|
58 |
729887cf
|
n.hoffmann
|
|
59 |
9bdb03b1
|
Patrick Plitzner
|
/** {@inheritDoc} */
|
60 |
|
|
@Override
|
61 |
|
|
public Collection<DescriptionElementSource> getCollection(DescriptionElementBase entity) {
|
62 |
|
|
List<DescriptionElementSource> sources = new ArrayList<DescriptionElementSource>(entity.getSources());
|
63 |
9d33b6ef
|
Patrick Plitzner
|
Collections.sort(sources, new SourceComparator());
|
64 |
9bdb03b1
|
Patrick Plitzner
|
return sources;
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
/** {@inheritDoc} */
|
68 |
|
|
@Override
|
69 |
|
|
public String getEmptyString() {
|
70 |
|
|
return "No references yet.";
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
/** {@inheritDoc} */
|
74 |
|
|
@Override
|
75 |
|
|
protected String getTooltipString() {
|
76 |
|
|
return "Create a new reference";
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
/** {@inheritDoc} */
|
80 |
|
|
@Override
|
81 |
|
|
public void addElement(DescriptionElementSource element) {
|
82 |
|
|
getEntity().addSource(element);
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
/** {@inheritDoc} */
|
86 |
|
|
@Override
|
87 |
|
|
public void removeElement(DescriptionElementSource element) {
|
88 |
|
|
getEntity().removeSource(element);
|
89 |
|
|
}
|
90 |
729887cf
|
n.hoffmann
|
}
|