had to rename the packages to make them compliant with buckminster
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / DescriptionSourceSection.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.common.IdentifiableSource;
17 import eu.etaxonomy.cdm.model.description.DescriptionBase;
18 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
19 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
20 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
21
22 /**
23 * <p>DescriptionSourceSection class.</p>
24 *
25 * @author n.hoffmann
26 * @created Mar 18, 2010
27 * @version 1.0
28 */
29 public class DescriptionSourceSection extends
30 AbstractEntityCollectionSection<DescriptionBase, IdentifiableSource>{
31
32 /**
33 * <p>Constructor for DescriptionSourceSection.</p>
34 *
35 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
36 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
37 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
38 * @param style a int.
39 */
40 public DescriptionSourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
41 ICdmFormElement parentElement, int style) {
42 super(cdmFormFactory, conversation, parentElement, "Description Sources", style);
43 }
44
45
46
47 /** {@inheritDoc} */
48 @Override
49 public void addElement(IdentifiableSource element) {
50 getEntity().addSource(element);
51 }
52
53 /** {@inheritDoc} */
54 @Override
55 public IdentifiableSource createNewElement() {
56 return IdentifiableSource.NewInstance();
57 }
58
59 /** {@inheritDoc} */
60 @Override
61 public Collection<IdentifiableSource> getCollection(DescriptionBase entity) {
62 return entity.getSources();
63 }
64
65 /** {@inheritDoc} */
66 @Override
67 public String getEmptyString() {
68 return "No description sources yet.";
69 }
70
71 /** {@inheritDoc} */
72 @Override
73 protected String getTooltipString() {
74 return "Add a reference as source for this description";
75 }
76
77 /** {@inheritDoc} */
78 @Override
79 public void removeElement(IdentifiableSource element) {
80 getEntity().removeSource(element);
81 }
82 }