1
|
/**
|
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
|
package eu.etaxonomy.taxeditor.ui.section.supplemental;
|
10
|
|
11
|
import java.util.Collection;
|
12
|
import java.util.Comparator;
|
13
|
|
14
|
import eu.etaxonomy.cdm.model.common.Credit;
|
15
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
|
20
|
|
21
|
/**
|
22
|
* <p>CreditSection class.</p>
|
23
|
*
|
24
|
* @author n.hoffmann
|
25
|
* @created Nov 16, 2009
|
26
|
*/
|
27
|
public class CreditSection extends AbstractEntityCollectionSection<IdentifiableEntity, Credit> {
|
28
|
|
29
|
public CreditSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
|
30
|
super(cdmFormFactory, parentElement, "Credits", style);
|
31
|
}
|
32
|
|
33
|
@Override
|
34
|
public Credit createNewElement() {
|
35
|
return Credit.NewInstance(null, null, null);
|
36
|
}
|
37
|
|
38
|
@Override
|
39
|
public Collection<Credit> getCollection(IdentifiableEntity entity) {
|
40
|
return entity.getCredits();
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
public Comparator<Credit> getComparator() {
|
45
|
return new DefaultCdmBaseComparator<>();
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public String getEmptyString() {
|
50
|
return "No credits yet.";
|
51
|
}
|
52
|
|
53
|
@Override
|
54
|
protected String getTooltipString() {
|
55
|
return "Create a new credit entry";
|
56
|
}
|
57
|
|
58
|
@Override
|
59
|
public void addElement(Credit element) {
|
60
|
getEntity().addCredit(element);
|
61
|
}
|
62
|
|
63
|
@Override
|
64
|
public void removeElement(Credit element) {
|
65
|
getEntity().removeCredit(element);
|
66
|
}
|
67
|
|
68
|
@Override
|
69
|
public Credit addExisting() {
|
70
|
// TODO Auto-generated method stub
|
71
|
return null;
|
72
|
}
|
73
|
|
74
|
@Override
|
75
|
public boolean allowAddExisting() {
|
76
|
// TODO Auto-generated method stub
|
77
|
return false;
|
78
|
}
|
79
|
}
|