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
|
import java.util.Comparator;
|
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.TaxonName;
|
19
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
23
|
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
|
24
|
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
|
25
|
|
26
|
/**
|
27
|
* <p>NomenclaturalStatusSection class.</p>
|
28
|
*
|
29
|
* @author n.hoffmann
|
30
|
*/
|
31
|
public class NomenclaturalStatusSection extends AbstractEntityCollectionSection<TaxonName, NomenclaturalStatus> implements ITaxonBaseDetailSection{
|
32
|
|
33
|
private TaxonBase taxonBase;
|
34
|
|
35
|
/**
|
36
|
* <p>Constructor for NomenclaturalStatusSection.</p>
|
37
|
*
|
38
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
39
|
* @param style a int.
|
40
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
41
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
42
|
*/
|
43
|
public NomenclaturalStatusSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
|
44
|
int style) {
|
45
|
super(cdmFormFactory, conversation, parentElement, "Nomenclatural Status", style);
|
46
|
}
|
47
|
|
48
|
/** {@inheritDoc} */
|
49
|
@Override
|
50
|
public Collection<NomenclaturalStatus> getCollection(TaxonName entity) {
|
51
|
return entity.getStatus();
|
52
|
}
|
53
|
|
54
|
@Override
|
55
|
public Comparator<NomenclaturalStatus> getComparator() {
|
56
|
return new DefaultCdmBaseComparator<>();
|
57
|
}
|
58
|
|
59
|
/** {@inheritDoc} */
|
60
|
@Override
|
61
|
public String getEmptyString() {
|
62
|
return "No nomenclatural status yet.";
|
63
|
}
|
64
|
|
65
|
/** {@inheritDoc} */
|
66
|
@Override
|
67
|
public NomenclaturalStatus createNewElement() {
|
68
|
return NomenclaturalStatus.NewInstance(null);
|
69
|
}
|
70
|
|
71
|
/** {@inheritDoc} */
|
72
|
@Override
|
73
|
protected String getTooltipString() {
|
74
|
return "Create a new nomenclatural status";
|
75
|
}
|
76
|
|
77
|
/** {@inheritDoc} */
|
78
|
@Override
|
79
|
public void addElement(NomenclaturalStatus element) {
|
80
|
getEntity().addStatus(element);
|
81
|
}
|
82
|
|
83
|
/** {@inheritDoc} */
|
84
|
@Override
|
85
|
public void removeElement(NomenclaturalStatus element) {
|
86
|
getEntity().removeStatus(element);
|
87
|
}
|
88
|
|
89
|
/** {@inheritDoc} */
|
90
|
@Override
|
91
|
public void setTaxonBase(TaxonBase entity) {
|
92
|
this.taxonBase = entity;
|
93
|
TaxonName nonViralName = HibernateProxyHelper.deproxy(entity.getName());
|
94
|
setEntity(nonViralName);
|
95
|
}
|
96
|
|
97
|
@Override
|
98
|
public TaxonBase getTaxonBase() {
|
99
|
return taxonBase;
|
100
|
}
|
101
|
|
102
|
/**
|
103
|
* {@inheritDoc}
|
104
|
*/
|
105
|
@Override
|
106
|
public NomenclaturalStatus addExisting() {
|
107
|
return null;
|
108
|
}
|
109
|
|
110
|
/**
|
111
|
* {@inheritDoc}
|
112
|
*/
|
113
|
@Override
|
114
|
public boolean allowAddExisting() {
|
115
|
return false;
|
116
|
}
|
117
|
|
118
|
}
|