3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
;
13 import java
.util
.Collection
;
15 import org
.eclipse
.swt
.events
.SelectionListener
;
16 import org
.eclipse
.swt
.graphics
.Color
;
18 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
19 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
20 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
21 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.compatibility
.ICdmFormElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.NamedAreaSelectionDialog
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
28 * CollectingAreasDetailSection class.
32 * @created Oct 14, 2010
35 public class CollectingAreasDetailSection
extends AbstractEntityCollectionSection
<DerivedUnitFacade
, NamedArea
> {
38 * <p>Constructor for CollectingAreasDetailSection.</p>
40 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
41 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
42 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
45 public CollectingAreasDetailSection(CdmFormFactory formFactory
,
46 ConversationHolder conversation
, ICdmFormElement parentElement
, int style
) {
47 super(formFactory
, conversation
, parentElement
, "Collecting Areas", style
);
51 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
55 public Collection
<NamedArea
> getCollection(DerivedUnitFacade entity
) {
56 return entity
.getCollectingAreas();
60 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
64 public NamedArea
createNewElement() {
65 NamedArea selection
= NamedAreaSelectionDialog
.select(getLayoutComposite().getShell(), getConversationHolder(), null);
71 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
75 public void addElement(NamedArea element
) {
76 getEntity().addCollectingArea(element
);
80 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
84 public void removeElement(NamedArea element
) {
85 getEntity().removeCollectingArea(element
);
89 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
93 public String
getEmptyString() {
94 return "No collecting areas yet.";
98 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
102 protected String
getTooltipString() {
103 return "Add a collecting area";
107 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createElementComposite(java.lang.Object, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.graphics.Color)
110 protected void createElementComposite(NamedArea element
, SelectionListener removeListener
, Color backgroundColor
) {
111 formFactory
.createNamedAreaFieldController(this, element
, removeListener
);