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.agent;
|
11
|
|
12
|
import java.util.Collection;
|
13
|
|
14
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
15
|
import eu.etaxonomy.cdm.model.agent.Person;
|
16
|
import eu.etaxonomy.cdm.model.agent.Team;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
|
20
|
|
21
|
/**
|
22
|
* <p>TeamMemberSection class.</p>
|
23
|
*
|
24
|
* @author n.hoffmann
|
25
|
* @created Apr 30, 2010
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class TeamMemberSection extends AbstractUnboundEntityCollectionSection<Team, Person> {
|
29
|
|
30
|
private boolean isNomenclaturalTeam = false;
|
31
|
|
32
|
/**
|
33
|
* <p>Constructor for TeamMemberSection.</p>
|
34
|
*
|
35
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
36
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
37
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
38
|
* @param style a int.
|
39
|
*/
|
40
|
public TeamMemberSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style, boolean isNomenclatural) {
|
41
|
super(cdmFormFactory, conversation, parentElement, null, style);
|
42
|
isNomenclaturalTeam = isNomenclatural;
|
43
|
}
|
44
|
|
45
|
/** {@inheritDoc} */
|
46
|
@Override
|
47
|
public String getTitleString() {
|
48
|
return "Team Members";
|
49
|
}
|
50
|
|
51
|
/** {@inheritDoc} */
|
52
|
@Override
|
53
|
public void addElement(Person element) {
|
54
|
getEntity().addTeamMember(element);
|
55
|
}
|
56
|
|
57
|
/** {@inheritDoc} */
|
58
|
@Override
|
59
|
public Person createNewElement() {
|
60
|
return Person.NewTitledInstance("");
|
61
|
}
|
62
|
|
63
|
/** {@inheritDoc} */
|
64
|
@Override
|
65
|
public String getEmptyString() {
|
66
|
return "No persons yet.";
|
67
|
}
|
68
|
|
69
|
/** {@inheritDoc} */
|
70
|
@Override
|
71
|
protected String getTooltipString() {
|
72
|
return "Add a member to this team";
|
73
|
}
|
74
|
|
75
|
/** {@inheritDoc} */
|
76
|
@Override
|
77
|
public void removeElement(Person element) {
|
78
|
getEntity().removeTeamMember(element);
|
79
|
}
|
80
|
|
81
|
@Override
|
82
|
protected Collection<Person> getEntityCollection(Team entity) {
|
83
|
return getEntity().getTeamMembers();
|
84
|
}
|
85
|
|
86
|
/**
|
87
|
* @return
|
88
|
*/
|
89
|
public boolean isNomenclaturalTeam() {
|
90
|
return isNomenclaturalTeam;
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* {@inheritDoc}
|
95
|
*/
|
96
|
@Override
|
97
|
public Person addExisting() {
|
98
|
return null;
|
99
|
}
|
100
|
|
101
|
/**
|
102
|
* {@inheritDoc}
|
103
|
*/
|
104
|
@Override
|
105
|
public boolean allowAddExisting() {
|
106
|
return false;
|
107
|
}
|
108
|
|
109
|
}
|