Project

General

Profile

Download (2.41 KB) Statistics
| Branch: | Tag: | Revision:
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.common.DefinedTerm;
17
import eu.etaxonomy.cdm.model.common.TermType;
18
import eu.etaxonomy.cdm.model.description.IModifiable;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
22

    
23
/**
24
 * <p>ModifierSection class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created Sep 15, 2010
28
 * @version 1.0
29
 */
30
public class ModifierSection extends AbstractUnboundEntityCollectionSection<IModifiable, DefinedTerm> {
31

    
32
	/**
33
	 * <p>Constructor for ModifierSection.</p>
34
	 *
35
	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
36
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
37
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
38
	 * @param style a int.
39
	 */
40
	public ModifierSection(CdmFormFactory formFactory,
41
			ConversationHolder conversation, ICdmFormElement parentElement,
42
			int style) {
43
		super(formFactory, conversation, parentElement, "Modifiers", style);
44
	}
45

    
46
	/** {@inheritDoc} */
47
	@Override
48
	public DefinedTerm createNewElement() {
49
		return DefinedTerm.NewInstance(TermType.Modifier,"","Untitled","");
50
	}
51

    
52
	/** {@inheritDoc} */
53
	@Override
54
	public void addElement(DefinedTerm element) {
55
		getEntity().addModifier(element);
56
	}
57

    
58
	/** {@inheritDoc} */
59
	@Override
60
	public void removeElement(DefinedTerm element) {
61
		getEntity().removeModifier(element);
62
	}
63

    
64
	/** {@inheritDoc} */
65
	@Override
66
	public String getEmptyString() {
67
		return "No modifiers yet.";
68
	}
69

    
70
	/** {@inheritDoc} */
71
	@Override
72
	protected String getTooltipString() {
73
		return "Add a modifier.";
74
	}
75

    
76
    /* (non-Javadoc)
77
     * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection#getEntityCollection(java.lang.Object)
78
     */
79
    @Override
80
    protected Collection<DefinedTerm> getEntityCollection(IModifiable entity) {
81
        return entity.getModifiers();
82
    }
83
}
(16-16/24)