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
;
13 import java
.util
.Comparator
;
15 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
16 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
18 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.NamedAreaSelectionDialog
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
22 import eu
.etaxonomy
.taxeditor
.ui
.section
.DefaultCdmBaseComparator
;
26 * CollectingAreasDetailSection class.
30 * @created Oct 14, 2010
33 public class GeoScopeDetailSection
extends AbstractEntityCollectionSection
<Classification
, NamedArea
> {
36 * <p>Constructor for CollectingAreasDetailSection.</p>
38 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
39 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
40 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
43 public GeoScopeDetailSection(CdmFormFactory formFactory
,
44 ConversationHolder conversation
, ICdmFormElement parentElement
, int style
) {
45 super(formFactory
, conversation
, parentElement
, "Geo Scopes", style
);
49 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
53 public Collection
<NamedArea
> getCollection(Classification entity
) {
54 return entity
.getGeoScopes();
58 public Comparator
<NamedArea
> getComparator() {
59 return new DefaultCdmBaseComparator
<>();
63 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
67 public NamedArea
createNewElement() {
68 NamedArea selection
= NamedAreaSelectionDialog
.select(getLayoutComposite().getShell(), //getConversationHolder(),
69 null, Classification
.class.getCanonicalName());
75 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
79 public void addElement(NamedArea element
) {
80 getEntity().addGeoScope(element
);
84 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
88 public void removeElement(NamedArea element
) {
89 getEntity().removeGeoScope(element
);
93 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
97 public String
getEmptyString() {
98 return "No geo scopes yet.";
102 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
106 protected String
getTooltipString() {
107 return "Add a geo scope";
114 public NamedArea
addExisting() {
122 public boolean allowAddExisting() {
123 // TODO Auto-generated method stub