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