1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.taxeditor.ui.section.supplemental;
|
5
|
|
6
|
import java.util.Collection;
|
7
|
import java.util.Comparator;
|
8
|
|
9
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
10
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
11
|
import eu.etaxonomy.cdm.model.media.Rights;
|
12
|
import eu.etaxonomy.taxeditor.ui.dialog.selection.RightsSelectionDialog;
|
13
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
14
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
15
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
16
|
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
|
17
|
|
18
|
/**
|
19
|
* <p>RightsSection class.</p>
|
20
|
*
|
21
|
* @author nho
|
22
|
* @version $Id: $
|
23
|
*/
|
24
|
public class RightsSection extends AbstractEntityCollectionSection<IdentifiableEntity, Rights> {
|
25
|
|
26
|
/**
|
27
|
* <p>Constructor for RightsSection.</p>
|
28
|
*
|
29
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
30
|
* @param style a int.
|
31
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
32
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
33
|
*/
|
34
|
public RightsSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
|
35
|
super(cdmFormFactory, conversation, parentElement, "Rights", style);
|
36
|
}
|
37
|
|
38
|
/** {@inheritDoc} */
|
39
|
@Override
|
40
|
public Rights createNewElement() {
|
41
|
return Rights.NewInstance();
|
42
|
}
|
43
|
|
44
|
/** {@inheritDoc} */
|
45
|
@Override
|
46
|
public Collection<Rights> getCollection(IdentifiableEntity entity) {
|
47
|
return entity.getRights();
|
48
|
}
|
49
|
|
50
|
@Override
|
51
|
public Comparator<Rights> getComparator() {
|
52
|
return new DefaultCdmBaseComparator<>();
|
53
|
}
|
54
|
|
55
|
/** {@inheritDoc} */
|
56
|
@Override
|
57
|
public String getEmptyString() {
|
58
|
return "No rights yet.";
|
59
|
}
|
60
|
|
61
|
/** {@inheritDoc} */
|
62
|
@Override
|
63
|
protected String getTooltipString() {
|
64
|
// TODO Auto-generated method stub
|
65
|
return "Create new rights.";
|
66
|
}
|
67
|
|
68
|
/** {@inheritDoc} */
|
69
|
@Override
|
70
|
public void addElement(Rights element) {
|
71
|
getEntity().addRights(element);
|
72
|
}
|
73
|
|
74
|
/** {@inheritDoc} */
|
75
|
@Override
|
76
|
public void removeElement(Rights element) {
|
77
|
getEntity().removeRights(element);
|
78
|
}
|
79
|
|
80
|
/**
|
81
|
* {@inheritDoc}
|
82
|
*/
|
83
|
@Override
|
84
|
public Rights addExisting() {
|
85
|
return RightsSelectionDialog.select(getShell(), //getConversationHolder(),
|
86
|
null);
|
87
|
}
|
88
|
|
89
|
/**
|
90
|
* {@inheritDoc}
|
91
|
*/
|
92
|
@Override
|
93
|
public boolean allowAddExisting() {
|
94
|
return true;
|
95
|
}
|
96
|
|
97
|
|
98
|
|
99
|
|
100
|
}
|