Project

General

Profile

Download (2.57 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.description.TaxonDescription;
17
import eu.etaxonomy.cdm.model.location.NamedArea;
18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
21
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
22

    
23
/**
24
 * <p>GeoScopeSection class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created Sep 17, 2010
28
 * @version 1.0
29
 */
30
public class GeoScopeSection extends AbstractEntityCollectionSection<TaxonDescription, NamedArea> {
31

    
32
	/**
33
	 * <p>Constructor for GeoScopeSection.</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 GeoScopeSection(CdmFormFactory formFactory,
41
			ConversationHolder conversation, ICdmFormElement parentElement, int style) {
42
		super(formFactory, conversation, parentElement, "Geo Scope", style);
43
	}
44

    
45
	/** {@inheritDoc} */
46
	@Override
47
	public Collection<NamedArea> getCollection(TaxonDescription entity) {
48
		return entity.getGeoScopes();
49
	}
50

    
51
	@Override
52
	public Comparator<NamedArea> getComparator() {
53
        return new DefaultCdmBaseComparator<>();
54
	}
55

    
56
	/** {@inheritDoc} */
57
	@Override
58
	public NamedArea createNewElement() {
59
		return NamedArea.NewInstance();
60
	}
61

    
62
	/** {@inheritDoc} */
63
	@Override
64
	public void addElement(NamedArea element) {
65
		getEntity().addGeoScope(element);
66
	}
67

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

    
74
	/** {@inheritDoc} */
75
	@Override
76
	public String getEmptyString() {
77
		return "No geo scopes yet.";
78
	}
79

    
80
	/** {@inheritDoc} */
81
	@Override
82
	protected String getTooltipString() {
83
		return "Add a new geo scope.";
84
	}
85

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

    
94
    /**
95
     * {@inheritDoc}
96
     */
97
    @Override
98
    public boolean allowAddExisting() {
99
        return false;
100
    }
101
}
(14-14/26)