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 org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
18
|
import eu.etaxonomy.cdm.model.description.IModifiable;
|
19
|
import eu.etaxonomy.cdm.model.description.Modifier;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
23
|
|
24
|
/**
|
25
|
* <p>ModifierSection class.</p>
|
26
|
*
|
27
|
* @author n.hoffmann
|
28
|
* @created Sep 15, 2010
|
29
|
* @version 1.0
|
30
|
*/
|
31
|
public class ModifierSection extends AbstractEntityCollectionSection<IModifiable, Modifier> {
|
32
|
|
33
|
|
34
|
private static final Logger logger = Logger
|
35
|
.getLogger(ModifierSection.class);
|
36
|
|
37
|
/**
|
38
|
* <p>Constructor for ModifierSection.</p>
|
39
|
*
|
40
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
41
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
42
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
43
|
* @param style a int.
|
44
|
*/
|
45
|
public ModifierSection(CdmFormFactory formFactory,
|
46
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
47
|
int style) {
|
48
|
super(formFactory, conversation, parentElement, "Modifiers", style);
|
49
|
}
|
50
|
|
51
|
/** {@inheritDoc} */
|
52
|
@Override
|
53
|
public Collection<Modifier> getCollection(IModifiable entity) {
|
54
|
return entity.getModifiers();
|
55
|
}
|
56
|
|
57
|
/** {@inheritDoc} */
|
58
|
@Override
|
59
|
public Modifier createNewElement() {
|
60
|
return Modifier.NewInstance();
|
61
|
}
|
62
|
|
63
|
/** {@inheritDoc} */
|
64
|
@Override
|
65
|
public void addElement(Modifier element) {
|
66
|
getEntity().addModifier(element);
|
67
|
}
|
68
|
|
69
|
/** {@inheritDoc} */
|
70
|
@Override
|
71
|
public void removeElement(Modifier element) {
|
72
|
getEntity().removeModifier(element);
|
73
|
}
|
74
|
|
75
|
/** {@inheritDoc} */
|
76
|
@Override
|
77
|
public String getEmptyString() {
|
78
|
return "No modifiers yet.";
|
79
|
}
|
80
|
|
81
|
/** {@inheritDoc} */
|
82
|
@Override
|
83
|
protected String getTooltipString() {
|
84
|
return "Add a modifier.";
|
85
|
}
|
86
|
}
|