Project

General

Profile

Download (2.46 KB) Statistics
| Branch: | Tag: | Revision:
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.agent;
12

    
13
import java.util.Collection;
14

    
15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16
import eu.etaxonomy.cdm.model.agent.Person;
17
import eu.etaxonomy.cdm.model.agent.Team;
18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
21

    
22
/**
23
 * <p>TeamMemberSection class.</p>
24
 *
25
 * @author n.hoffmann
26
 * @created Apr 30, 2010
27
 * @version 1.0
28
 */
29
public class TeamMemberSection extends AbstractUnboundEntityCollectionSection<Team, Person> {
30

    
31
    private boolean isNomenclaturalTeam = false;
32

    
33
	/**
34
	 * <p>Constructor for TeamMemberSection.</p>
35
	 *
36
	 * @param cdmFormFactory 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 TeamMemberSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style, boolean isNomenclatural) {
42
		super(cdmFormFactory, conversation, parentElement, null, style);
43
		isNomenclaturalTeam = isNomenclatural;
44
	}
45

    
46
	/** {@inheritDoc} */
47
	@Override
48
	public String getTitleString() {
49
		return "Team Members";
50
	}
51

    
52
	/** {@inheritDoc} */
53
	@Override
54
	public void addElement(Person element) {
55
		getEntity().addTeamMember(element);
56
	}
57

    
58
	/** {@inheritDoc} */
59
	@Override
60
	public Person createNewElement() {
61
		return Person.NewTitledInstance("");
62
	}
63

    
64
	/** {@inheritDoc} */
65
	@Override
66
	public String getEmptyString() {
67
		return "No persons yet.";
68
	}
69

    
70
	/** {@inheritDoc} */
71
	@Override
72
	protected String getTooltipString() {
73
		return "Add a member to this team";
74
	}
75

    
76
	/** {@inheritDoc} */
77
	@Override
78
	public void removeElement(Person element) {
79
		getEntity().removeTeamMember(element);
80
	}
81

    
82
    @Override
83
    protected Collection<Person> getEntityCollection(Team entity) {
84
        return getEntity().getTeamMembers();
85
    }
86

    
87
    /**
88
     * @return
89
     */
90
    public boolean isNomenclaturalTeam() {
91
       return isNomenclaturalTeam;
92
    }
93

    
94

    
95
}
(10-10/12)