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.occurrence;
|
12
|
|
13
|
import java.util.Collection;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
16
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
|
17
|
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
|
18
|
import eu.etaxonomy.taxeditor.forms.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.forms.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection;
|
21
|
|
22
|
/**
|
23
|
* <p>SourceCollectionDetailSection class.</p>
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created Oct 15, 2010
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class SourceCollectionDetailSection extends
|
30
|
AbstractEntityCollectionSection<DerivedUnitFacade, IdentifiableSource> {
|
31
|
|
32
|
/**
|
33
|
* <p>Constructor for SourceCollectionDetailSection.</p>
|
34
|
*
|
35
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object.
|
36
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
37
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
|
38
|
* @param style a int.
|
39
|
*/
|
40
|
public SourceCollectionDetailSection(CdmFormFactory formFactory,
|
41
|
ConversationHolder conversation, ICdmFormElement parentElement, int style) {
|
42
|
super(formFactory, conversation, parentElement, "Sources", style);
|
43
|
}
|
44
|
|
45
|
/* (non-Javadoc)
|
46
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
|
47
|
*/
|
48
|
/** {@inheritDoc} */
|
49
|
@Override
|
50
|
public Collection<IdentifiableSource> getCollection(DerivedUnitFacade entity) {
|
51
|
return entity.getSources();
|
52
|
}
|
53
|
|
54
|
/* (non-Javadoc)
|
55
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
|
56
|
*/
|
57
|
/** {@inheritDoc} */
|
58
|
@Override
|
59
|
public IdentifiableSource createNewElement() {
|
60
|
return IdentifiableSource.NewInstance();
|
61
|
}
|
62
|
|
63
|
/* (non-Javadoc)
|
64
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
65
|
*/
|
66
|
/** {@inheritDoc} */
|
67
|
@Override
|
68
|
public void addElement(IdentifiableSource element) {
|
69
|
getEntity().addSource(element);
|
70
|
}
|
71
|
|
72
|
/* (non-Javadoc)
|
73
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
74
|
*/
|
75
|
/** {@inheritDoc} */
|
76
|
@Override
|
77
|
public void removeElement(IdentifiableSource element) {
|
78
|
getEntity().removeSource(element);
|
79
|
}
|
80
|
|
81
|
/* (non-Javadoc)
|
82
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
|
83
|
*/
|
84
|
/** {@inheritDoc} */
|
85
|
@Override
|
86
|
public String getEmptyString() {
|
87
|
return "No sources yet.";
|
88
|
}
|
89
|
|
90
|
/* (non-Javadoc)
|
91
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
|
92
|
*/
|
93
|
/** {@inheritDoc} */
|
94
|
@Override
|
95
|
protected String getTooltipString() {
|
96
|
return "Add source";
|
97
|
}
|
98
|
|
99
|
}
|