1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.taxeditor.section.supplemental;
|
5
|
|
6
|
import java.util.Collection;
|
7
|
|
8
|
|
9
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
10
|
import eu.etaxonomy.cdm.model.common.Credit;
|
11
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
12
|
import eu.etaxonomy.taxeditor.forms.CdmFormFactory;
|
13
|
import eu.etaxonomy.taxeditor.forms.ICdmFormElement;
|
14
|
import eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection;
|
15
|
|
16
|
/**
|
17
|
* <p>CreditSection class.</p>
|
18
|
*
|
19
|
* @author n.hoffmann
|
20
|
* @created Nov 16, 2009
|
21
|
* @version 1.0
|
22
|
*/
|
23
|
public class CreditSection extends AbstractEntityCollectionSection<IdentifiableEntity, Credit> {
|
24
|
|
25
|
/**
|
26
|
* <p>Constructor for CreditSection.</p>
|
27
|
*
|
28
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
29
|
* @param style a int.
|
30
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object.
|
31
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
32
|
*/
|
33
|
public CreditSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
|
34
|
super(cdmFormFactory, conversation, parentElement, "Credits", style);
|
35
|
}
|
36
|
|
37
|
/** {@inheritDoc} */
|
38
|
@Override
|
39
|
public Credit createNewElement() {
|
40
|
return Credit.NewInstance(null, null);
|
41
|
}
|
42
|
|
43
|
/** {@inheritDoc} */
|
44
|
@Override
|
45
|
public Collection<Credit> getCollection(IdentifiableEntity entity) {
|
46
|
return entity.getCredits();
|
47
|
}
|
48
|
|
49
|
/** {@inheritDoc} */
|
50
|
@Override
|
51
|
public String getEmptyString() {
|
52
|
return "No credits yet.";
|
53
|
}
|
54
|
|
55
|
/** {@inheritDoc} */
|
56
|
@Override
|
57
|
protected String getTooltipString() {
|
58
|
return "Create a new credit entry";
|
59
|
}
|
60
|
|
61
|
/** {@inheritDoc} */
|
62
|
@Override
|
63
|
public void addElement(Credit element) {
|
64
|
getEntity().addCredit(element);
|
65
|
}
|
66
|
|
67
|
/** {@inheritDoc} */
|
68
|
@Override
|
69
|
public void removeElement(Credit element) {
|
70
|
getEntity().removeCredit(element);
|
71
|
}
|
72
|
|
73
|
}
|