1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.ui.section.name;
|
11
|
|
12
|
import java.util.Collection;
|
13
|
|
14
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
15
|
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
|
16
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
|
17
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
18
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
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
|
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
|
23
|
|
24
|
/**
|
25
|
* <p>NomenclaturalStatusSection class.</p>
|
26
|
*
|
27
|
* @author n.hoffmann
|
28
|
*/
|
29
|
public class NomenclaturalStatusSection extends AbstractEntityCollectionSection<TaxonName, NomenclaturalStatus> implements ITaxonBaseDetailSection{
|
30
|
|
31
|
private TaxonBase taxonBase;
|
32
|
|
33
|
/**
|
34
|
* <p>Constructor for NomenclaturalStatusSection.</p>
|
35
|
*
|
36
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
37
|
* @param style a int.
|
38
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
39
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
40
|
*/
|
41
|
public NomenclaturalStatusSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
|
42
|
int style) {
|
43
|
super(cdmFormFactory, conversation, parentElement, "Nomenclatural Status", style);
|
44
|
}
|
45
|
|
46
|
/** {@inheritDoc} */
|
47
|
@Override
|
48
|
public Collection<NomenclaturalStatus> getCollection(TaxonName entity) {
|
49
|
return entity.getStatus();
|
50
|
}
|
51
|
|
52
|
/** {@inheritDoc} */
|
53
|
@Override
|
54
|
public String getEmptyString() {
|
55
|
return "No nomenclatural status yet.";
|
56
|
}
|
57
|
|
58
|
/** {@inheritDoc} */
|
59
|
@Override
|
60
|
public NomenclaturalStatus createNewElement() {
|
61
|
return NomenclaturalStatus.NewInstance(null);
|
62
|
}
|
63
|
|
64
|
/** {@inheritDoc} */
|
65
|
@Override
|
66
|
protected String getTooltipString() {
|
67
|
return "Create a new nomenclatural status";
|
68
|
}
|
69
|
|
70
|
/** {@inheritDoc} */
|
71
|
@Override
|
72
|
public void addElement(NomenclaturalStatus element) {
|
73
|
getEntity().addStatus(element);
|
74
|
}
|
75
|
|
76
|
/** {@inheritDoc} */
|
77
|
@Override
|
78
|
public void removeElement(NomenclaturalStatus element) {
|
79
|
getEntity().removeStatus(element);
|
80
|
}
|
81
|
|
82
|
/** {@inheritDoc} */
|
83
|
@Override
|
84
|
public void setTaxonBase(TaxonBase entity) {
|
85
|
this.taxonBase = entity;
|
86
|
TaxonName nonViralName = HibernateProxyHelper.deproxy(entity.getName());
|
87
|
setEntity(nonViralName);
|
88
|
}
|
89
|
|
90
|
@Override
|
91
|
public TaxonBase getTaxonBase() {
|
92
|
return taxonBase;
|
93
|
}
|
94
|
|
95
|
/**
|
96
|
* {@inheritDoc}
|
97
|
*/
|
98
|
@Override
|
99
|
public NomenclaturalStatus addExisting() {
|
100
|
return null;
|
101
|
}
|
102
|
|
103
|
/**
|
104
|
* {@inheritDoc}
|
105
|
*/
|
106
|
@Override
|
107
|
public boolean allowAddExisting() {
|
108
|
return false;
|
109
|
}
|
110
|
|
111
|
}
|