+// $Id$
+/**
+* Copyright (C) 2007 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.occurrence;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ *
+ * @author pplitzner
+ * @date Sep 21, 2015
+ *
+ */
+public class GeoScopePolyKeyDetailSection extends AbstractEntityCollectionSection<PolytomousKey, NamedArea> {
+
+ public GeoScopePolyKeyDetailSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement, int style) {
+ super(formFactory, conversation, parentElement, "Geo Scopes", style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Collection<NamedArea> getCollection(PolytomousKey entity) {
+ return entity.getGeographicalScope();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public NamedArea createNewElement() {
+ NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
+
+ return selection;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addElement(NamedArea element) {
+ getEntity().addGeographicalScope(element);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void removeElement(NamedArea element) {
+ getEntity().removeGeographicalScope(element);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getEmptyString() {
+ return "No geo scopes yet.";
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected String getTooltipString() {
+ return "Add a geo scope";
+ }
+
+}