- moved ICdmFormElement to campanula.compatibility
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / key / TaxonomicScopeSection.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.key;
12
13 import java.util.Collection;
14
15 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 import eu.etaxonomy.cdm.model.description.PolytomousKey;
17 import eu.etaxonomy.cdm.model.taxon.Taxon;
18 import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonBaseSelectionDialog;
19 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
21 import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.ICdmFormElement;
22
23 /**
24 * @author n.hoffmann
25 * @created Mar 29, 2011
26 * @version 1.0
27 */
28 public class TaxonomicScopeSection extends
29 AbstractEntityCollectionSection<PolytomousKey, Taxon> {
30
31 /**
32 * @param formFactory
33 * @param conversation
34 * @param parentElement
35 * @param title
36 * @param style
37 */
38 public TaxonomicScopeSection(CdmFormFactory formFactory,
39 ConversationHolder conversation, ICdmFormElement parentElement,
40 int style) {
41 super(formFactory, conversation, parentElement, "Taxonomic Scope",
42 style);
43 }
44
45 /*
46 * (non-Javadoc)
47 *
48 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
49 * getCollection(java.lang.Object)
50 */
51 @Override
52 public Collection<Taxon> getCollection(PolytomousKey entity) {
53 return entity.getTaxonomicScope();
54 }
55
56 /*
57 * (non-Javadoc)
58 *
59 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
60 * createNewElement()
61 */
62 @Override
63 public Taxon createNewElement() {
64 Taxon selection = TaxonBaseSelectionDialog.selectTaxon(getShell(),
65 getConversationHolder(), null);
66
67 return selection;
68 }
69
70 /*
71 * (non-Javadoc)
72 *
73 * @see
74 * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement
75 * (java.lang.Object)
76 */
77 @Override
78 public void addElement(Taxon element) {
79 getEntity().addTaxonomicScope(element);
80 }
81
82 /*
83 * (non-Javadoc)
84 *
85 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
86 * removeElement(java.lang.Object)
87 */
88 @Override
89 public void removeElement(Taxon element) {
90 getEntity().removeTaxonomicScope(element);
91 }
92
93 /*
94 * (non-Javadoc)
95 *
96 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
97 * getEmptyString()
98 */
99 @Override
100 public String getEmptyString() {
101 return "No taxonomic scope yet.";
102 }
103
104 /*
105 * (non-Javadoc)
106 *
107 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
108 * getTooltipString()
109 */
110 @Override
111 protected String getTooltipString() {
112 return "Add a taxon to the scope of this key";
113 }
114
115 }