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