ref #6658: add calendar widget to dateElement
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / group / MemberDetailSection.java
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.group;
11
12 import java.util.Collection;
13
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;
21
22 /**
23 * @author n.hoffmann
24 * @created Mar 9, 2011
25 * @version 1.0
26 */
27 public class MemberDetailSection extends AbstractEntityCollectionSection<Group, User> {
28
29 /**
30 * @param formFactory
31 * @param conversation
32 * @param parentElement
33 * @param title
34 * @param style
35 */
36 public MemberDetailSection(CdmFormFactory formFactory,
37 ConversationHolder conversation, ICdmFormElement parentElement,
38 int style) {
39 super(formFactory, conversation, parentElement, "Members", style);
40 }
41
42 /* (non-Javadoc)
43 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
44 */
45 @Override
46 public Collection<User> getCollection(Group entity) {
47 return entity.getMembers();
48 }
49
50 /* (non-Javadoc)
51 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
52 */
53 @Override
54 public User createNewElement() {
55 User selection = UserSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
56 return selection;
57 }
58
59 /* (non-Javadoc)
60 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
61 */
62 @Override
63 public void addElement(User element) {
64 getEntity().addMember(element);
65 }
66
67 /* (non-Javadoc)
68 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
69 */
70 @Override
71 public void removeElement(User element) {
72 getEntity().removeMember(element);
73 }
74
75 /* (non-Javadoc)
76 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
77 */
78 @Override
79 public String getEmptyString() {
80 return "No members yet.";
81 }
82
83 /* (non-Javadoc)
84 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
85 */
86 @Override
87 protected String getTooltipString() {
88 return "Add a memeber to this group";
89 }
90
91 /**
92 * {@inheritDoc}
93 */
94 @Override
95 public User addExisting() {
96 // TODO Auto-generated method stub
97 return null;
98 }
99
100 /**
101 * {@inheritDoc}
102 */
103 @Override
104 public boolean allowAddExisting() {
105 // TODO Auto-generated method stub
106 return false;
107 }
108
109
110
111 }