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.CategoricalData;
|
15
|
import eu.etaxonomy.cdm.model.description.StateData;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
|
21
|
|
22
|
/**
|
23
|
* @author n.hoffmann
|
24
|
* @created Sep 15, 2010
|
25
|
*/
|
26
|
public class StateDataSection extends AbstractEntityCollectionSection<CategoricalData, StateData> implements IEnableableFormElement {
|
27
|
|
28
|
public StateDataSection(CdmFormFactory formFactory,
|
29
|
ICdmFormElement parentElement,
|
30
|
int style) {
|
31
|
super(formFactory, parentElement, "State Data", style);
|
32
|
}
|
33
|
|
34
|
@Override
|
35
|
public Collection<StateData> getCollection(CategoricalData entity) {
|
36
|
return entity.getStateData();
|
37
|
}
|
38
|
|
39
|
@Override
|
40
|
public Comparator<StateData> getComparator() {
|
41
|
return new DefaultCdmBaseComparator<>();
|
42
|
}
|
43
|
|
44
|
@Override
|
45
|
public StateData createNewElement() {
|
46
|
return StateData.NewInstance();
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
public void addElement(StateData element) {
|
51
|
getEntity().addStateData(element);
|
52
|
}
|
53
|
|
54
|
@Override
|
55
|
public void removeElement(StateData element) {
|
56
|
getEntity().removeStateData(element);
|
57
|
}
|
58
|
|
59
|
@Override
|
60
|
public String getEmptyString() {
|
61
|
return "No state data yet.";
|
62
|
}
|
63
|
|
64
|
@Override
|
65
|
protected String getTooltipString() {
|
66
|
return "Create new state data";
|
67
|
}
|
68
|
|
69
|
@Override
|
70
|
public StateData addExisting() {
|
71
|
return null;
|
72
|
}
|
73
|
|
74
|
@Override
|
75
|
public boolean allowAddExisting() {
|
76
|
return false;
|
77
|
}
|
78
|
}
|