Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / GeoScopeSection.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.taxeditor.ui.section.description;
11
12 import java.util.Collection;
13
14 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15 import eu.etaxonomy.cdm.model.description.TaxonDescription;
16 import eu.etaxonomy.cdm.model.location.NamedArea;
17 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
20
21 /**
22 * <p>GeoScopeSection class.</p>
23 *
24 * @author n.hoffmann
25 * @created Sep 17, 2010
26 * @version 1.0
27 */
28 public class GeoScopeSection extends AbstractEntityCollectionSection<TaxonDescription, NamedArea> {
29
30 /**
31 * <p>Constructor for GeoScopeSection.</p>
32 *
33 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
34 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
35 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
36 * @param style a int.
37 */
38 public GeoScopeSection(CdmFormFactory formFactory,
39 ConversationHolder conversation, ICdmFormElement parentElement, int style) {
40 super(formFactory, conversation, parentElement, "Geo Scope", style);
41 }
42
43 /** {@inheritDoc} */
44 @Override
45 public Collection<NamedArea> getCollection(TaxonDescription entity) {
46 return entity.getGeoScopes();
47 }
48
49 /** {@inheritDoc} */
50 @Override
51 public NamedArea createNewElement() {
52 return NamedArea.NewInstance();
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public void addElement(NamedArea element) {
58 getEntity().addGeoScope(element);
59 }
60
61 /** {@inheritDoc} */
62 @Override
63 public void removeElement(NamedArea element) {
64 getEntity().removeGeoScope(element);
65 }
66
67 /** {@inheritDoc} */
68 @Override
69 public String getEmptyString() {
70 return "No geo scopes yet.";
71 }
72
73 /** {@inheritDoc} */
74 @Override
75 protected String getTooltipString() {
76 return "Add a new geo scope.";
77 }
78 }