2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.group
;
12 import java
.util
.Collection
;
14 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
15 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
16 import eu
.etaxonomy
.cdm
.model
.common
.User
;
17 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.UserSelectionDialog
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
24 * @created Mar 9, 2011
27 public class MemberDetailSection
extends AbstractEntityCollectionSection
<Group
, User
> {
32 * @param parentElement
36 public MemberDetailSection(CdmFormFactory formFactory
,
37 ConversationHolder conversation
, ICdmFormElement parentElement
,
39 super(formFactory
, conversation
, parentElement
, "Members", style
);
43 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
46 public Collection
<User
> getCollection(Group entity
) {
47 return entity
.getMembers();
51 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
54 public User
createNewElement() {
55 User selection
= UserSelectionDialog
.select(getLayoutComposite().getShell(), getConversationHolder(), null);
60 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
63 public void addElement(User element
) {
64 getEntity().addMember(element
);
68 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
71 public void removeElement(User element
) {
72 getEntity().removeMember(element
);
76 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
79 public String
getEmptyString() {
80 return "No members yet.";
84 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
87 protected String
getTooltipString() {
88 return "Add a memeber to this group";