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