- added collection section for state vocabularies (#4448)
authorPatric Plitzner <p.plitzner@bgbm.org>
Mon, 27 Apr 2015 14:57:44 +0000 (14:57 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Mon, 27 Apr 2015 14:57:44 +0000 (14:57 +0000)
.gitattributes
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/StateVocabularyCollectionSection.java [new file with mode: 0644]

index 8799c507cefaa058072d472974946c790a9f7041..707e0c1eaaacfd5858151869d7bfba0ce14085f8 100644 (file)
@@ -1760,6 +1760,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/voc
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaLevelDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/StateVocabularyCollectionSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EditFromSelectionWizard.java -text
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/StateVocabularyCollectionSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/StateVocabularyCollectionSection.java
new file mode 100644 (file)
index 0000000..a7b4b6f
--- /dev/null
@@ -0,0 +1,89 @@
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.section.vocabulary;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.State;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
+
+/**
+ * @author pplitzner
+ * @date Apr 27, 2015
+ *
+ */
+public class StateVocabularyCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, TermVocabulary<State>> {
+
+    public StateVocabularyCollectionSection(CdmFormFactory formFactory,
+            ConversationHolder conversation, ICdmFormElement parentElement, int style) {
+        super(formFactory, conversation, parentElement, "Supported state vocabularies", style);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
+     */
+    /** {@inheritDoc} */
+    @Override
+    protected Collection<TermVocabulary<State>> getEntityCollection(Feature entity) {
+        return entity.getSupportedCategoricalEnumerations();
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
+     */
+    /** {@inheritDoc} */
+    @Override
+    public TermVocabulary<State> createNewElement() {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void addElement(TermVocabulary<State> element) {
+        //never gets called
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void removeElement(TermVocabulary<State> element) {
+        getEntity().removeSupportedCategoricalEnumeration(element);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
+     */
+    /** {@inheritDoc} */
+    @Override
+    public String getEmptyString() {
+        return "No state vocabularies yet.";
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
+     */
+    /** {@inheritDoc} */
+    @Override
+    protected String getTooltipString() {
+        return "Add a state vocabulary";
+    }
+
+
+}