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.name;
|
12
|
|
13
|
import java.util.Collection;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
16
|
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
17
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
|
18
|
import eu.etaxonomy.cdm.model.name.NonViralName;
|
19
|
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
20
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
24
|
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
|
25
|
|
26
|
/**
|
27
|
* <p>NomenclaturalStatusSection class.</p>
|
28
|
*
|
29
|
* @author n.hoffmann
|
30
|
* @created Nov 5, 2009
|
31
|
* @version 1.0
|
32
|
*/
|
33
|
public class NomenclaturalStatusSection extends AbstractEntityCollectionSection<TaxonNameBase, NomenclaturalStatus> implements ITaxonBaseDetailSection{
|
34
|
|
35
|
private TaxonBase taxonBase;
|
36
|
|
37
|
/**
|
38
|
* <p>Constructor for NomenclaturalStatusSection.</p>
|
39
|
*
|
40
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
41
|
* @param style a int.
|
42
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
43
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
44
|
*/
|
45
|
public NomenclaturalStatusSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
|
46
|
int style) {
|
47
|
super(cdmFormFactory, conversation, parentElement, "Nomenclatural Status", style);
|
48
|
}
|
49
|
|
50
|
/** {@inheritDoc} */
|
51
|
@Override
|
52
|
public Collection<NomenclaturalStatus> getCollection(TaxonNameBase entity) {
|
53
|
return entity.getStatus();
|
54
|
}
|
55
|
|
56
|
/** {@inheritDoc} */
|
57
|
@Override
|
58
|
public String getEmptyString() {
|
59
|
return "No nomenclatural status yet.";
|
60
|
}
|
61
|
|
62
|
/** {@inheritDoc} */
|
63
|
@Override
|
64
|
public NomenclaturalStatus createNewElement() {
|
65
|
return NomenclaturalStatus.NewInstance(null);
|
66
|
}
|
67
|
|
68
|
/** {@inheritDoc} */
|
69
|
@Override
|
70
|
protected String getTooltipString() {
|
71
|
return "Create a new nomenclatural status";
|
72
|
}
|
73
|
|
74
|
/** {@inheritDoc} */
|
75
|
@Override
|
76
|
public void addElement(NomenclaturalStatus element) {
|
77
|
getEntity().addStatus(element);
|
78
|
}
|
79
|
|
80
|
/** {@inheritDoc} */
|
81
|
@Override
|
82
|
public void removeElement(NomenclaturalStatus element) {
|
83
|
getEntity().removeStatus(element);
|
84
|
}
|
85
|
|
86
|
/** {@inheritDoc} */
|
87
|
public void setTaxonBase(TaxonBase entity) {
|
88
|
this.taxonBase = entity;
|
89
|
NonViralName nonViralName = (NonViralName) HibernateProxyHelper.deproxy(entity.getName());
|
90
|
setEntity(nonViralName);
|
91
|
}
|
92
|
|
93
|
/* (non-Javadoc)
|
94
|
* @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
|
95
|
*/
|
96
|
@Override
|
97
|
public TaxonBase getTaxonBase() {
|
98
|
return taxonBase;
|
99
|
}
|
100
|
|
101
|
}
|