Revision 593915d2
Added by Patrick Plitzner over 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/OnlyApplicableIfEntityCollectionSection.java | ||
---|---|---|
13 | 13 |
import java.util.Comparator; |
14 | 14 |
|
15 | 15 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
16 |
import eu.etaxonomy.cdm.model.description.State; |
|
16 |
import eu.etaxonomy.cdm.model.description.FeatureState;
|
|
17 | 17 |
import eu.etaxonomy.cdm.model.term.TermNode; |
18 | 18 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
19 | 19 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
20 |
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection; |
|
20 | 21 |
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator; |
21 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection; |
|
22 | 22 |
|
23 | 23 |
/** |
24 | 24 |
* @author pplitzner |
25 | 25 |
* @date 06.03.2018 |
26 | 26 |
* |
27 | 27 |
*/ |
28 |
public class OnlyApplicableIfEntityCollectionSection extends AbstractUnboundEntityCollectionSection<TermNode, State>{
|
|
28 |
public class OnlyApplicableIfEntityCollectionSection extends AbstractEntityCollectionSection<TermNode, FeatureState>{
|
|
29 | 29 |
|
30 | 30 |
public OnlyApplicableIfEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, |
31 | 31 |
ICdmFormElement parentElement, int style) { |
... | ... | |
36 | 36 |
* {@inheritDoc} |
37 | 37 |
*/ |
38 | 38 |
@Override |
39 |
protected Collection<State> getEntityCollection(TermNode entity) {
|
|
39 |
public Collection<FeatureState> getCollection(TermNode entity) {
|
|
40 | 40 |
return entity.getOnlyApplicableIf(); |
41 | 41 |
} |
42 | 42 |
|
... | ... | |
44 | 44 |
* {@inheritDoc} |
45 | 45 |
*/ |
46 | 46 |
@Override |
47 |
public Comparator<State> getComparator() { |
|
47 |
public Comparator<FeatureState> getComparator() {
|
|
48 | 48 |
return new DefaultCdmBaseComparator<>(); |
49 | 49 |
} |
50 | 50 |
|
... | ... | |
52 | 52 |
* {@inheritDoc} |
53 | 53 |
*/ |
54 | 54 |
@Override |
55 |
public State createNewElement() { |
|
56 |
return State.NewInstance(); |
|
55 |
public FeatureState createNewElement() {
|
|
56 |
return FeatureState.NewInstance();
|
|
57 | 57 |
} |
58 | 58 |
|
59 | 59 |
/** |
60 | 60 |
* {@inheritDoc} |
61 | 61 |
*/ |
62 | 62 |
@Override |
63 |
public void addElement(State element) { |
|
64 |
//never called
|
|
63 |
public void addElement(FeatureState element) {
|
|
64 |
getEntity().addApplicableState(element);
|
|
65 | 65 |
} |
66 | 66 |
|
67 | 67 |
/** |
68 | 68 |
* {@inheritDoc} |
69 | 69 |
*/ |
70 | 70 |
@Override |
71 |
public State addExisting() { |
|
71 |
public FeatureState addExisting() {
|
|
72 | 72 |
return null; |
73 | 73 |
} |
74 | 74 |
|
... | ... | |
84 | 84 |
* {@inheritDoc} |
85 | 85 |
*/ |
86 | 86 |
@Override |
87 |
public void removeElement(State element) { |
|
87 |
public void removeElement(FeatureState element) {
|
|
88 | 88 |
getEntity().removeApplicableState(element); |
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
/** {@inheritDoc} */ |
92 | 92 |
@Override |
93 | 93 |
public String getEmptyString() { |
94 |
return "No state added yet."; |
|
94 |
return "No feature state added yet.";
|
|
95 | 95 |
} |
96 | 96 |
|
97 | 97 |
/** {@inheritDoc} */ |
98 | 98 |
@Override |
99 | 99 |
protected String getTooltipString() { |
100 |
return "Add a state"; |
|
100 |
return "Add a feature state";
|
|
101 | 101 |
} |
102 | 102 |
|
103 | 103 |
} |
Also available in: Unified diff
ref #8475 First (unstable) implementation of FeatureState details