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 org.eclipse.swt.events.SelectionListener;
|
13
|
|
14
|
import eu.etaxonomy.cdm.model.permission.User;
|
15
|
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
|
19
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
20
|
|
21
|
/**
|
22
|
* @author n.hoffmann
|
23
|
* @created Mar 9, 2011
|
24
|
* @version 1.0
|
25
|
*/
|
26
|
public class MemberDetailElement extends AbstractEntityCollectionElement<User> {
|
27
|
|
28
|
private EntitySelectionElement<User> selection_user;
|
29
|
|
30
|
/**
|
31
|
* @param formFactory
|
32
|
* @param section
|
33
|
* @param entity
|
34
|
* @param removeListener
|
35
|
* @param backgroundColor
|
36
|
* @param style
|
37
|
*/
|
38
|
public MemberDetailElement(CdmFormFactory formFactory,
|
39
|
AbstractFormSection section, User entity,
|
40
|
SelectionListener removeListener, int style) {
|
41
|
super(formFactory, section, entity, removeListener, null, style);
|
42
|
}
|
43
|
|
44
|
/*
|
45
|
* (non-Javadoc)
|
46
|
*
|
47
|
* @see
|
48
|
* eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity
|
49
|
* (java.lang.Object)
|
50
|
*/
|
51
|
@Override
|
52
|
public void setEntity(User entity) {
|
53
|
this.entity = entity;
|
54
|
if (selection_user!= null){
|
55
|
selection_user.setEntity(entity);
|
56
|
}
|
57
|
}
|
58
|
|
59
|
/*
|
60
|
* (non-Javadoc)
|
61
|
*
|
62
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#
|
63
|
* createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
|
64
|
*/
|
65
|
@Override
|
66
|
public void createControls(ICdmFormElement element, int style) {
|
67
|
selection_user = formFactory
|
68
|
.createSelectionElement(User.class,//getConversationHolder(),
|
69
|
element, "", entity,
|
70
|
EntitySelectionElement.EDITABLE, style);
|
71
|
if (entity != null){
|
72
|
setEntity(entity);
|
73
|
}
|
74
|
}
|
75
|
|
76
|
/*
|
77
|
* (non-Javadoc)
|
78
|
*
|
79
|
* @see
|
80
|
* eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent
|
81
|
* (java.lang.Object)
|
82
|
*/
|
83
|
@Override
|
84
|
public void handleEvent(Object eventSource) {
|
85
|
if (eventSource == selection_user) {
|
86
|
setEntity(selection_user.getEntity());
|
87
|
}
|
88
|
}
|
89
|
|
90
|
}
|