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.group;
|
12
|
|
13
|
import java.util.Collection;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
16
|
import eu.etaxonomy.cdm.model.common.Group;
|
17
|
import eu.etaxonomy.cdm.model.common.User;
|
18
|
import eu.etaxonomy.taxeditor.ui.dialog.selection.UserSelectionDialog;
|
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
|
|
23
|
/**
|
24
|
* @author n.hoffmann
|
25
|
* @created Mar 9, 2011
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class MemberDetailSection extends AbstractEntityCollectionSection<Group, User> {
|
29
|
|
30
|
/**
|
31
|
* @param formFactory
|
32
|
* @param conversation
|
33
|
* @param parentElement
|
34
|
* @param title
|
35
|
* @param style
|
36
|
*/
|
37
|
public MemberDetailSection(CdmFormFactory formFactory,
|
38
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
39
|
int style) {
|
40
|
super(formFactory, conversation, parentElement, "Members", style);
|
41
|
}
|
42
|
|
43
|
/* (non-Javadoc)
|
44
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
|
45
|
*/
|
46
|
@Override
|
47
|
public Collection<User> getCollection(Group entity) {
|
48
|
return entity.getMembers();
|
49
|
}
|
50
|
|
51
|
/* (non-Javadoc)
|
52
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
|
53
|
*/
|
54
|
@Override
|
55
|
public User createNewElement() {
|
56
|
User selection = UserSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
|
57
|
return selection;
|
58
|
}
|
59
|
|
60
|
/* (non-Javadoc)
|
61
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
62
|
*/
|
63
|
@Override
|
64
|
public void addElement(User element) {
|
65
|
getEntity().addMember(element);
|
66
|
}
|
67
|
|
68
|
/* (non-Javadoc)
|
69
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
70
|
*/
|
71
|
@Override
|
72
|
public void removeElement(User element) {
|
73
|
getEntity().removeMember(element);
|
74
|
}
|
75
|
|
76
|
/* (non-Javadoc)
|
77
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
|
78
|
*/
|
79
|
@Override
|
80
|
public String getEmptyString() {
|
81
|
return "No members yet.";
|
82
|
}
|
83
|
|
84
|
/* (non-Javadoc)
|
85
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
|
86
|
*/
|
87
|
@Override
|
88
|
protected String getTooltipString() {
|
89
|
return "Add a memeber to this group";
|
90
|
}
|
91
|
|
92
|
|
93
|
|
94
|
}
|