Basically fixes #2282. I will create new tickets for still open issues.
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / ui / section / group / MemberDetailElement.java
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 org.eclipse.swt.events.SelectionListener;
14
15 import eu.etaxonomy.cdm.model.common.User;
16 import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
17 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
19 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
20 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
21 import eu.etaxonomy.taxeditor.ui.selection.UserSelectionElement;
22
23 /**
24 * @author n.hoffmann
25 * @created Mar 9, 2011
26 * @version 1.0
27 */
28 public class MemberDetailElement extends AbstractEntityCollectionElement<User> {
29
30 private UserSelectionElement selection_user;
31
32 /**
33 * @param formFactory
34 * @param section
35 * @param entity
36 * @param removeListener
37 * @param backgroundColor
38 * @param style
39 */
40 public MemberDetailElement(CdmFormFactory formFactory,
41 AbstractFormSection section, User entity,
42 SelectionListener removeListener, int style) {
43 super(formFactory, section, entity, removeListener, null, style);
44 }
45
46 /* (non-Javadoc)
47 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
48 */
49 @Override
50 public void setEntity(User entity) {
51 selection_user.setEntity(entity);
52 }
53
54 /* (non-Javadoc)
55 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
56 */
57 @Override
58 public void createControls(ICdmFormElement element, int style) {
59 selection_user = (UserSelectionElement) formFactory.createSelectionElement(SelectionType.USER, getConversationHolder(), element, "Member", entity, style);
60 }
61
62 /* (non-Javadoc)
63 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
64 */
65 @Override
66 public void handleEvent(Object eventSource) {
67 if(eventSource == selection_user){
68 setEntity(selection_user.getEntity());
69 }
70 }
71
72
73 }