]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms/src/org/argeo/cms/users/UserViewer.java
8badedb12c4017aa3a0767e5d037c4653f10045c
1 package org
.argeo
.cms
.users
;
3 import static org
.eclipse
.swt
.SWT
.NONE
;
6 import javax
.jcr
.RepositoryException
;
8 import org
.argeo
.cms
.CmsEditable
;
9 import org
.argeo
.cms
.util
.CmsUtils
;
10 import org
.argeo
.cms
.viewers
.AbstractPageViewer
;
11 import org
.argeo
.cms
.viewers
.EditablePart
;
12 import org
.argeo
.cms
.viewers
.Section
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.events
.MouseAdapter
;
15 import org
.eclipse
.swt
.events
.MouseEvent
;
16 import org
.eclipse
.swt
.events
.MouseListener
;
17 import org
.eclipse
.swt
.graphics
.Point
;
18 import org
.eclipse
.swt
.widgets
.Composite
;
19 import org
.eclipse
.swt
.widgets
.Control
;
21 public class UserViewer
extends AbstractPageViewer
{
22 private static final long serialVersionUID
= -717973369525981931L;
23 private UserPart userPart
;
25 public UserViewer(Composite parent
, int style
, Node userNode
,
26 CmsEditable cmsEditable
) throws RepositoryException
{
27 this(new UserPart(parent
, SWT
.NO_BACKGROUND
, userNode
), style
,
28 userNode
, cmsEditable
);
31 private UserViewer(UserPart userPart
, int style
, Node userNode
,
32 CmsEditable cmsEditable
) throws RepositoryException
{
33 super(new Section(userPart
, NONE
, userNode
), style
, cmsEditable
);
34 this.userPart
= userPart
;
35 userPart
.createControl(userPart
, "cms_test");
36 userPart
.setStyle("cms_test");
38 userPart
.setLayoutData(CmsUtils
.fillWidth());
39 userPart
.setMouseListener(getMouseListener());
42 // userRolesPart.createControl(userPart,"cms_test");
43 // userPart.setStyle("cms_test");
45 // userPart.setLayoutData(CmsUtils.fillWidth());
46 // userPart.setMouseListener(getMouseListener());
50 // private JcrComposite createParents(Composite parent, Node userNode)
51 // throws RepositoryException {
53 // return this.parent;
57 public Control
getControl() {
63 protected MouseListener
createMouseListener() {
67 private class ML
extends MouseAdapter
{
68 private static final long serialVersionUID
= 8526890859876770905L;
71 public void mouseDoubleClick(MouseEvent e
) {
73 Control source
= (Control
) e
.getSource();
74 if (getCmsEditable().canEdit()) {
75 getCmsEditable().startEditing();
76 EditablePart composite
= findDataParent(source
);
77 Point point
= new Point(e
.x
, e
.y
);
78 edit(composite
, source
.toDisplay(point
));
84 protected void updateContent(EditablePart part
) throws RepositoryException
{
85 if (part
instanceof UserPart
)
86 ((UserPart
) part
).refresh();
89 protected void refresh(Control control
) throws RepositoryException
{
90 if (control
instanceof UserPart
)
91 ((UserPart
) control
).refresh();