Project

General

Profile

Download (1.95 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.model.description.IModifiable;
16
import eu.etaxonomy.cdm.model.term.DefinedTerm;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
20
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
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 AbstractUnboundEntityCollectionSection<IModifiable, DefinedTerm> {
30

    
31
	public ModifierSection(CdmFormFactory formFactory,
32
			ICdmFormElement parentElement,
33
			int style) {
34
		super(formFactory, parentElement, "Modifiers", style);
35
	}
36

    
37
	@Override
38
	public DefinedTerm createNewElement() {
39
		return null;
40
	}
41

    
42
	@Override
43
	public void addElement(DefinedTerm element) {
44
		getEntity().addModifier(element);
45
	}
46

    
47
	@Override
48
	public void removeElement(DefinedTerm element) {
49
		getEntity().removeModifier(element);
50
	}
51

    
52
	@Override
53
	public String getEmptyString() {
54
		return "No modifiers yet.";
55
	}
56

    
57
	@Override
58
	protected String getTooltipString() {
59
		return "Add a modifier.";
60
	}
61

    
62
    @Override
63
    protected Collection<DefinedTerm> getEntityCollection(IModifiable entity) {
64
        return entity.getModifiers();
65
    }
66

    
67
    @Override
68
    public Comparator<DefinedTerm> getComparator() {
69
        return new DefaultCdmBaseComparator<>();
70
    }
71

    
72
    @Override
73
    public DefinedTerm addExisting() {
74
        return null;
75
    }
76

    
77
    @Override
78
    public boolean allowAddExisting() {
79
        return false;
80
    }
81
}
(17-17/26)