Project

General

Profile

Download (2.23 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.AbstractEntityCollectionSection;
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 AbstractEntityCollectionSection<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 Collection<DefinedTerm> getCollection(IModifiable entity) {
49
		return entity.getModifiers();
50
	}
51

    
52
	/** {@inheritDoc} */
53
	@Override
54
	public DefinedTerm createNewElement() {		
55
		return DefinedTerm.NewInstance(TermType.Modifier,"","Untitled","");				
56
	}
57

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

    
64
	/** {@inheritDoc} */
65
	@Override
66
	public void removeElement(DefinedTerm element) {
67
		getEntity().removeModifier(element);
68
	}
69

    
70
	/** {@inheritDoc} */
71
	@Override
72
	public String getEmptyString() {
73
		return "No modifiers yet.";
74
	}
75

    
76
	/** {@inheritDoc} */
77
	@Override
78
	protected String getTooltipString() {
79
		return "Add a modifier.";
80
	}
81
}
(16-16/24)