Project

General

Profile

Download (2.74 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.TaxonDescription;
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>ScopeSection class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created Mar 18, 2010
28
 * @version 1.0
29
 */
30
public class ScopeSection extends AbstractUnboundEntityCollectionSection<TaxonDescription, DefinedTerm> {
31

    
32
	/**
33
	 * <p>Constructor for ScopeSection.</p>
34
	 *
35
	 * @param cdmFormFactory 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 ScopeSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
41
		super(cdmFormFactory, conversation, parentElement, "Scope", style);
42
	}
43

    
44
	/** {@inheritDoc} */
45
	@Override
46
	public void addElement(DefinedTerm element) {
47
		getEntity().addScope(element);
48
	}
49

    
50
	/** {@inheritDoc} */
51
	@Override
52
	public DefinedTerm createNewElement() {
53
		return null;
54
	}
55

    
56
	/** {@inheritDoc} */
57
	@Override
58
	public String getEmptyString() {
59
		return "No scopes yet.";
60
	}
61

    
62
	/** {@inheritDoc} */
63
	@Override
64
	protected String getTooltipString() {
65
		return "Create a new scope";
66
	}
67

    
68
	/** {@inheritDoc} */
69
	@Override
70
	public void removeElement(DefinedTerm element) {
71
		getEntity().removeScope(element);
72
	}
73

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

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

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

    
95
    /**
96
     * {@inheritDoc}
97
     */
98
    @Override
99
    public boolean allowAddExisting() {
100
        return false;
101
    }
102
}
(20-20/25)