fix #6330 Add default sorting for all entity collections
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / vocabulary / RecommendedModifierVocabulariesCollectionSection.java
1 /**
2 * Copyright (C) 2015 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.vocabulary;
10
11 import java.util.Collection;
12 import java.util.Comparator;
13
14 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15 import eu.etaxonomy.cdm.model.common.DefinedTerm;
16 import eu.etaxonomy.cdm.model.common.TermType;
17 import eu.etaxonomy.cdm.model.common.TermVocabulary;
18 import eu.etaxonomy.cdm.model.description.Feature;
19 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21 import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
22 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
23
24 /**
25 * @author pplitzner
26 * @date Apr 27, 2015
27 *
28 */
29 public class RecommendedModifierVocabulariesCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, TermVocabulary<DefinedTerm>> {
30
31 public RecommendedModifierVocabulariesCollectionSection(CdmFormFactory formFactory,
32 ConversationHolder conversation, ICdmFormElement parentElement, int style) {
33 super(formFactory, conversation, parentElement, "Recommended modifier vocabularies", style);
34 }
35
36 /* (non-Javadoc)
37 * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
38 */
39 /** {@inheritDoc} */
40 @Override
41 protected Collection<TermVocabulary<DefinedTerm>> getEntityCollection(Feature entity) {
42 return entity.getRecommendedModifierEnumeration();
43 }
44
45 @Override
46 public Comparator<TermVocabulary<DefinedTerm>> getComparator() {
47 return new DefaultCdmBaseComparator<>();
48 }
49
50 /* (non-Javadoc)
51 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
52 */
53 /** {@inheritDoc} */
54 @Override
55 public TermVocabulary<DefinedTerm> createNewElement() {
56 return TermVocabulary.NewInstance(TermType.Modifier);
57 }
58
59 /* (non-Javadoc)
60 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
61 */
62 /** {@inheritDoc} */
63 @Override
64 public void addElement(TermVocabulary<DefinedTerm> element) {
65 //never gets called
66 }
67
68 /* (non-Javadoc)
69 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
70 */
71 /** {@inheritDoc} */
72 @Override
73 public void removeElement(TermVocabulary<DefinedTerm> element) {
74 getEntity().removeRecommendedModifierEnumeration(element);
75 }
76
77 /* (non-Javadoc)
78 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
79 */
80 /** {@inheritDoc} */
81 @Override
82 public String getEmptyString() {
83 return "No modifiers vocabularies yet.";
84 }
85
86 /* (non-Javadoc)
87 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
88 */
89 /** {@inheritDoc} */
90 @Override
91 protected String getTooltipString() {
92 return "Add a modifier vocabulary";
93 }
94
95 /**
96 * {@inheritDoc}
97 */
98 @Override
99 public TermVocabulary<DefinedTerm> addExisting() {
100 // TODO Auto-generated method stub
101 return null;
102 }
103
104 /**
105 * {@inheritDoc}
106 */
107 @Override
108 public boolean allowAddExisting() {
109 // TODO Auto-generated method stub
110 return false;
111 }
112
113
114 }