1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.ui.section.description;
|
12
|
|
13
|
import java.util.Collection;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
16
|
import eu.etaxonomy.cdm.model.description.IModifiable;
|
17
|
import eu.etaxonomy.cdm.model.description.Modifier;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.ICdmFormElement;
|
21
|
|
22
|
/**
|
23
|
* <p>ModifierSection class.</p>
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created Sep 15, 2010
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class ModifierSection extends AbstractEntityCollectionSection<IModifiable, Modifier> {
|
30
|
|
31
|
/**
|
32
|
* <p>Constructor for ModifierSection.</p>
|
33
|
*
|
34
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
35
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
36
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
37
|
* @param style a int.
|
38
|
*/
|
39
|
public ModifierSection(CdmFormFactory formFactory,
|
40
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
41
|
int style) {
|
42
|
super(formFactory, conversation, parentElement, "Modifiers", style);
|
43
|
}
|
44
|
|
45
|
/** {@inheritDoc} */
|
46
|
@Override
|
47
|
public Collection<Modifier> getCollection(IModifiable entity) {
|
48
|
return entity.getModifiers();
|
49
|
}
|
50
|
|
51
|
/** {@inheritDoc} */
|
52
|
@Override
|
53
|
public Modifier createNewElement() {
|
54
|
return Modifier.NewInstance();
|
55
|
}
|
56
|
|
57
|
/** {@inheritDoc} */
|
58
|
@Override
|
59
|
public void addElement(Modifier element) {
|
60
|
getEntity().addModifier(element);
|
61
|
}
|
62
|
|
63
|
/** {@inheritDoc} */
|
64
|
@Override
|
65
|
public void removeElement(Modifier element) {
|
66
|
getEntity().removeModifier(element);
|
67
|
}
|
68
|
|
69
|
/** {@inheritDoc} */
|
70
|
@Override
|
71
|
public String getEmptyString() {
|
72
|
return "No modifiers yet.";
|
73
|
}
|
74
|
|
75
|
/** {@inheritDoc} */
|
76
|
@Override
|
77
|
protected String getTooltipString() {
|
78
|
return "Add a modifier.";
|
79
|
}
|
80
|
}
|