add default comparator to all term combos without own comparator
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / StateDataSection.java
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.CategoricalData;
17 import eu.etaxonomy.cdm.model.description.StateData;
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>StateDataSection class.</p>
25 *
26 * @author n.hoffmann
27 * @created Sep 15, 2010
28 * @version 1.0
29 */
30 public class StateDataSection extends AbstractEntityCollectionSection<CategoricalData, StateData> {
31
32 /**
33 * <p>Constructor for StateDataSection.</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 StateDataSection(CdmFormFactory formFactory,
41 ConversationHolder conversation, ICdmFormElement parentElement,
42 int style) {
43 super(formFactory, conversation, parentElement, "State Data", style);
44 }
45
46 /** {@inheritDoc} */
47 @Override
48 public Collection<StateData> getCollection(CategoricalData entity) {
49 return entity.getStateData();
50 }
51
52 @Override
53 public Comparator<StateData> getComparator() {
54 return new DefaultCdmBaseComparator<>();
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 public StateData createNewElement() {
60 return StateData.NewInstance();
61 }
62
63 /** {@inheritDoc} */
64 @Override
65 public void addElement(StateData element) {
66 getEntity().addStateData(element);
67 }
68
69 /** {@inheritDoc} */
70 @Override
71 public void removeElement(StateData element) {
72 getEntity().removeStateData(element);
73 }
74
75 /** {@inheritDoc} */
76 @Override
77 public String getEmptyString() {
78 return "No state data yet.";
79 }
80
81 /** {@inheritDoc} */
82 @Override
83 protected String getTooltipString() {
84 return "Create new state data";
85 }
86
87 /**
88 * {@inheritDoc}
89 */
90 @Override
91 public StateData addExisting() {
92 return null;
93 }
94
95 /**
96 * {@inheritDoc}
97 */
98 @Override
99 public boolean allowAddExisting() {
100 return false;
101 }
102
103
104 }