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