1 |
f211dd28
|
n.hoffmann
|
/**
|
2 |
|
|
*
|
3 |
|
|
*/
|
4 |
|
|
package eu.etaxonomy.taxeditor.ui.section.user;
|
5 |
|
|
|
6 |
a60842d7
|
n.hoffmann
|
import java.util.Collection;
|
7 |
f211dd28
|
n.hoffmann
|
|
8 |
|
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
9 |
a60842d7
|
n.hoffmann
|
import eu.etaxonomy.cdm.model.common.Group;
|
10 |
f211dd28
|
n.hoffmann
|
import eu.etaxonomy.cdm.model.common.User;
|
11 |
78222507
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.ui.dialog.selection.GroupSelectionDialog;
|
12 |
|
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
13 |
dacb59c9
|
Patric Plitzner
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
14 |
a60842d7
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
15 |
f211dd28
|
n.hoffmann
|
|
16 |
|
|
/**
|
17 |
|
|
* @author n.hoffmann
|
18 |
|
|
*
|
19 |
|
|
*/
|
20 |
a60842d7
|
n.hoffmann
|
public class GroupsByUserDetailSection extends AbstractEntityCollectionSection<User, Group> {
|
21 |
f211dd28
|
n.hoffmann
|
|
22 |
a60842d7
|
n.hoffmann
|
/**
|
23 |
|
|
* @param formFactory
|
24 |
|
|
* @param conversation
|
25 |
|
|
* @param parentElement
|
26 |
|
|
* @param title
|
27 |
|
|
* @param style
|
28 |
|
|
*/
|
29 |
f211dd28
|
n.hoffmann
|
public GroupsByUserDetailSection(CdmFormFactory formFactory,
|
30 |
|
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
31 |
a60842d7
|
n.hoffmann
|
int style) {
|
32 |
|
|
super(formFactory, conversation, parentElement, "Groups", style);
|
33 |
f211dd28
|
n.hoffmann
|
}
|
34 |
|
|
|
35 |
a60842d7
|
n.hoffmann
|
/* (non-Javadoc)
|
36 |
|
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
|
37 |
|
|
*/
|
38 |
f211dd28
|
n.hoffmann
|
@Override
|
39 |
a60842d7
|
n.hoffmann
|
public Collection<Group> getCollection(User entity) {
|
40 |
|
|
return entity.getGroups();
|
41 |
f211dd28
|
n.hoffmann
|
}
|
42 |
|
|
|
43 |
a60842d7
|
n.hoffmann
|
/* (non-Javadoc)
|
44 |
|
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
|
45 |
|
|
*/
|
46 |
f211dd28
|
n.hoffmann
|
@Override
|
47 |
a60842d7
|
n.hoffmann
|
public Group createNewElement() {
|
48 |
|
|
Group selectedGroup = GroupSelectionDialog.select(getShell(), getConversationHolder(), null);
|
49 |
|
|
return selectedGroup;
|
50 |
f211dd28
|
n.hoffmann
|
}
|
51 |
|
|
|
52 |
a60842d7
|
n.hoffmann
|
/* (non-Javadoc)
|
53 |
|
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
|
54 |
|
|
*/
|
55 |
|
|
@Override
|
56 |
|
|
public void addElement(Group element) {
|
57 |
|
|
element.addMember(getEntity());
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
/* (non-Javadoc)
|
61 |
|
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
|
62 |
|
|
*/
|
63 |
|
|
@Override
|
64 |
|
|
public void removeElement(Group element) {
|
65 |
|
|
element.removeMember(getEntity());
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
/* (non-Javadoc)
|
69 |
|
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
|
70 |
|
|
*/
|
71 |
|
|
@Override
|
72 |
|
|
public String getEmptyString() {
|
73 |
|
|
return "No groups yet.";
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
/* (non-Javadoc)
|
77 |
|
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
|
78 |
|
|
*/
|
79 |
|
|
@Override
|
80 |
|
|
protected String getTooltipString() {
|
81 |
|
|
return "Add this user to a group";
|
82 |
|
|
}
|
83 |
f211dd28
|
n.hoffmann
|
|
84 |
|
|
}
|