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