- cleaned up package structure
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / CollectingAreasDetailSection.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10
11 package eu.etaxonomy.taxeditor.ui.section.occurrence;
12
13 import java.util.Collection;
14
15 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
17 import eu.etaxonomy.cdm.model.location.NamedArea;
18 import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
19 import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
20 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
21 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
22
23 /**
24 * <p>
25 * CollectingAreasDetailSection class.
26 * </p>
27 *
28 * @author n.hoffmann
29 * @created Oct 14, 2010
30 * @version 1.0
31 */
32 public class CollectingAreasDetailSection extends AbstractEntityCollectionSection<DerivedUnitFacade, NamedArea> {
33
34 /**
35 * <p>Constructor for CollectingAreasDetailSection.</p>
36 *
37 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
38 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
39 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
40 * @param style a int.
41 */
42 public CollectingAreasDetailSection(CdmFormFactory formFactory,
43 ConversationHolder conversation, ICdmFormElement parentElement, int style) {
44 super(formFactory, conversation, parentElement, "Collecting Areas", style);
45 }
46
47 /* (non-Javadoc)
48 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
49 */
50 /** {@inheritDoc} */
51 @Override
52 public Collection<NamedArea> getCollection(DerivedUnitFacade entity) {
53 return entity.getCollectingAreas();
54 }
55
56 /* (non-Javadoc)
57 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
58 */
59 /** {@inheritDoc} */
60 @Override
61 public NamedArea createNewElement() {
62 NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
63
64 return selection;
65 }
66
67 /* (non-Javadoc)
68 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
69 */
70 /** {@inheritDoc} */
71 @Override
72 public void addElement(NamedArea element) {
73 getEntity().addCollectingArea(element);
74 }
75
76 /* (non-Javadoc)
77 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
78 */
79 /** {@inheritDoc} */
80 @Override
81 public void removeElement(NamedArea element) {
82 getEntity().removeCollectingArea(element);
83 }
84
85 /* (non-Javadoc)
86 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
87 */
88 /** {@inheritDoc} */
89 @Override
90 public String getEmptyString() {
91 return "No collecting areas yet.";
92 }
93
94 /* (non-Javadoc)
95 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
96 */
97 /** {@inheritDoc} */
98 @Override
99 protected String getTooltipString() {
100 return "Add a collecting area";
101 }
102
103 }