From 4508543ce784722824a61c6bfeb9f8b32081bd40 Mon Sep 17 00:00:00 2001 From: Patric Plitzner Date: Mon, 27 Apr 2015 14:57:44 +0000 Subject: [PATCH 1/1] - added collection section for state vocabularies (#4448) --- .gitattributes | 1 + .../StateVocabularyCollectionSection.java | 89 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/StateVocabularyCollectionSection.java diff --git a/.gitattributes b/.gitattributes index 8799c507c..707e0c1ea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 index 000000000..a7b4b6f35 --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/StateVocabularyCollectionSection.java @@ -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> { + + 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> getEntityCollection(Feature entity) { + return entity.getSupportedCategoricalEnumerations(); + } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement() + */ + /** {@inheritDoc} */ + @Override + public TermVocabulary createNewElement() { + return null; + } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity) + */ + /** {@inheritDoc} */ + @Override + public void addElement(TermVocabulary 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 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"; + } + + +} -- 2.34.1