2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
;
12 import java
.util
.Collection
;
14 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
15 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
17 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.NamedAreaSelectionDialog
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
24 * CollectingAreasDetailSection class.
28 * @created Oct 14, 2010
31 public class GeoScopeDetailSection
extends AbstractEntityCollectionSection
<Classification
, NamedArea
> {
34 * <p>Constructor for CollectingAreasDetailSection.</p>
36 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
37 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
38 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
41 public GeoScopeDetailSection(CdmFormFactory formFactory
,
42 ConversationHolder conversation
, ICdmFormElement parentElement
, int style
) {
43 super(formFactory
, conversation
, parentElement
, "Geo Scopes", style
);
47 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
51 public Collection
<NamedArea
> getCollection(Classification entity
) {
52 return entity
.getGeoScopes();
56 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
60 public NamedArea
createNewElement() {
61 NamedArea selection
= NamedAreaSelectionDialog
.select(getLayoutComposite().getShell(), getConversationHolder(), null, Classification
.class.getCanonicalName());
67 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
71 public void addElement(NamedArea element
) {
72 getEntity().addGeoScope(element
);
76 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
80 public void removeElement(NamedArea element
) {
81 getEntity().removeGeoScope(element
);
85 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
89 public String
getEmptyString() {
90 return "No geo scopes yet.";
94 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
98 protected String
getTooltipString() {
99 return "Add a geo scope";