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 / 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.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.Scope;
17 import eu.etaxonomy.cdm.model.description.TaxonDescription;
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>ScopeSection class.</p>
24 *
25 * @author n.hoffmann
26 * @created Mar 18, 2010
27 * @version 1.0
28 */
29 public class ScopeSection extends AbstractEntityCollectionSection<TaxonDescription, Scope> {
30
31 /**
32 * <p>Constructor for ScopeSection.</p>
33 *
34 * @param cdmFormFactory 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 ScopeSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
40 super(cdmFormFactory, conversation, parentElement, "Scope", style);
41 }
42
43 /** {@inheritDoc} */
44 @Override
45 public void addElement(Scope element) {
46 getEntity().addScope(element);
47 }
48
49 /** {@inheritDoc} */
50 @Override
51 public Scope createNewElement() {
52 return Scope.NewInstance();
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public Collection<Scope> getCollection(TaxonDescription entity) {
58 return entity.getScopes();
59 }
60
61 /** {@inheritDoc} */
62 @Override
63 public String getEmptyString() {
64 return "No scopes yet.";
65 }
66
67 /** {@inheritDoc} */
68 @Override
69 protected String getTooltipString() {
70 return "Create a new scope";
71 }
72
73 /** {@inheritDoc} */
74 @Override
75 public void removeElement(Scope element) {
76 getEntity().removeScope(element);
77 }
78 }