1 |
86f69343
|
Patric Plitzner
|
/**
|
2 |
|
|
* Copyright (C) 2007 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 |
|
|
|
10 |
87924e53
|
Patric Plitzner
|
package eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit;
|
11 |
86f69343
|
Patric Plitzner
|
|
12 |
|
|
import java.util.Collection;
|
13 |
|
|
|
14 |
|
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
15 |
|
|
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
|
16 |
|
|
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
|
17 |
|
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
18 |
|
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19 |
dacb59c9
|
Patric Plitzner
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20 |
86f69343
|
Patric Plitzner
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
21 |
|
|
|
22 |
|
|
/**
|
23 |
|
|
* <p>SourceCollectionDetailSection class.</p>
|
24 |
|
|
*
|
25 |
|
|
* @author n.hoffmann
|
26 |
|
|
* @created Oct 15, 2010
|
27 |
|
|
* @version 1.0
|
28 |
|
|
*/
|
29 |
|
|
public class PreservedSpecimenSourceCollectionDetailSection extends
|
30 |
|
|
AbstractEntityCollectionSection<DerivedUnit, IdentifiableSource> {
|
31 |
|
|
|
32 |
|
|
/**
|
33 |
|
|
* <p>Constructor for SourceCollectionDetailSection.</p>
|
34 |
|
|
*
|
35 |
|
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
36 |
|
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
37 |
|
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
38 |
|
|
* @param style a int.
|
39 |
|
|
*/
|
40 |
|
|
public PreservedSpecimenSourceCollectionDetailSection(CdmFormFactory formFactory,
|
41 |
|
|
ConversationHolder conversation, ICdmFormElement parentElement, int style) {
|
42 |
|
|
super(formFactory, conversation, parentElement, "Sources", style);
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
/* (non-Javadoc)
|
46 |
|
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
|
47 |
|
|
*/
|
48 |
|
|
/** {@inheritDoc} */
|
49 |
|
|
@Override
|
50 |
|
|
public Collection<IdentifiableSource> getCollection(DerivedUnit entity) {
|
51 |
|
|
return entity.getSources();
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
/* (non-Javadoc)
|
55 |
|
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
|
56 |
|
|
*/
|
57 |
|
|
/** {@inheritDoc} */
|
58 |
|
|
@Override
|
59 |
|
|
public IdentifiableSource createNewElement() {
|
60 |
|
|
return IdentifiableSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
/* (non-Javadoc)
|
64 |
|
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
65 |
|
|
*/
|
66 |
|
|
/** {@inheritDoc} */
|
67 |
|
|
@Override
|
68 |
|
|
public void addElement(IdentifiableSource element) {
|
69 |
|
|
getEntity().addSource(element);
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
/* (non-Javadoc)
|
73 |
|
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
74 |
|
|
*/
|
75 |
|
|
/** {@inheritDoc} */
|
76 |
|
|
@Override
|
77 |
|
|
public void removeElement(IdentifiableSource element) {
|
78 |
|
|
getEntity().removeSource(element);
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
/* (non-Javadoc)
|
82 |
|
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
|
83 |
|
|
*/
|
84 |
|
|
/** {@inheritDoc} */
|
85 |
|
|
@Override
|
86 |
|
|
public String getEmptyString() {
|
87 |
|
|
return "No sources yet.";
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
/* (non-Javadoc)
|
91 |
|
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
|
92 |
|
|
*/
|
93 |
|
|
/** {@inheritDoc} */
|
94 |
|
|
@Override
|
95 |
|
|
protected String getTooltipString() {
|
96 |
|
|
return "Add source";
|
97 |
|
|
}
|
98 |
|
|
|
99 |
f5b66699
|
Patrick Plitzner
|
/**
|
100 |
|
|
* {@inheritDoc}
|
101 |
|
|
*/
|
102 |
|
|
@Override
|
103 |
|
|
public IdentifiableSource addExisting() {
|
104 |
|
|
return null;
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
/**
|
108 |
|
|
* {@inheritDoc}
|
109 |
|
|
*/
|
110 |
|
|
@Override
|
111 |
|
|
public boolean allowAddExisting() {
|
112 |
|
|
return false;
|
113 |
|
|
}
|
114 |
|
|
|
115 |
86f69343
|
Patric Plitzner
|
}
|