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
|
package eu.etaxonomy.taxeditor.ui.section.description;
|
10
|
|
11
|
import java.util.Collection;
|
12
|
import java.util.Comparator;
|
13
|
|
14
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
15
|
import eu.etaxonomy.cdm.model.term.DefinedTerm;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
|
20
|
|
21
|
/**
|
22
|
* @author n.hoffmann
|
23
|
* @created Mar 18, 2010
|
24
|
*/
|
25
|
public class ScopeSection extends AbstractUnboundEntityCollectionSection<TaxonDescription, DefinedTerm> {
|
26
|
|
27
|
public ScopeSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
|
28
|
super(cdmFormFactory, parentElement, "Scope", style);
|
29
|
}
|
30
|
|
31
|
@Override
|
32
|
public void addElement(DefinedTerm element) {
|
33
|
getEntity().addScope(element);
|
34
|
}
|
35
|
|
36
|
@Override
|
37
|
public DefinedTerm createNewElement() {
|
38
|
return null;
|
39
|
}
|
40
|
|
41
|
@Override
|
42
|
public String getEmptyString() {
|
43
|
return "No scopes yet.";
|
44
|
}
|
45
|
|
46
|
@Override
|
47
|
protected String getTooltipString() {
|
48
|
return "Create a new scope";
|
49
|
}
|
50
|
|
51
|
@Override
|
52
|
public void removeElement(DefinedTerm element) {
|
53
|
getEntity().removeScope(element);
|
54
|
}
|
55
|
|
56
|
@Override
|
57
|
protected Collection<DefinedTerm> getEntityCollection(TaxonDescription entity) {
|
58
|
return entity.getScopes();
|
59
|
}
|
60
|
|
61
|
@Override
|
62
|
public Comparator<DefinedTerm> getComparator() {
|
63
|
return new DefaultCdmBaseComparator<>();
|
64
|
}
|
65
|
|
66
|
@Override
|
67
|
public DefinedTerm addExisting() {
|
68
|
return null;
|
69
|
}
|
70
|
|
71
|
@Override
|
72
|
public boolean allowAddExisting() {
|
73
|
return false;
|
74
|
}
|
75
|
}
|