Project

General

Profile

Download (2.75 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.taxeditor.ui.section.description;
11

    
12
import java.util.Collection;
13
import java.util.Comparator;
14

    
15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16
import eu.etaxonomy.cdm.model.common.DefinedTerm;
17
import eu.etaxonomy.cdm.model.description.IModifiable;
18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
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 null;
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

    
84
    @Override
85
    public Comparator<DefinedTerm> getComparator() {
86
        return new DefaultCdmBaseComparator<>();
87
    }
88

    
89
    /**
90
     * {@inheritDoc}
91
     */
92
    @Override
93
    public DefinedTerm addExisting() {
94
        return null;
95
    }
96

    
97
    /**
98
     * {@inheritDoc}
99
     */
100
    @Override
101
    public boolean allowAddExisting() {
102
        return false;
103
    }
104
}
(16-16/25)