]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - UserViewer.java
17cffe8f80a53db4836c07cb4193188d4838a6aa
1 package org
.argeo
.cms
.users
;
4 import javax
.jcr
.RepositoryException
;
6 import org
.argeo
.cms
.CmsEditable
;
7 import org
.argeo
.cms
.util
.CmsUtils
;
8 import org
.argeo
.cms
.viewers
.AbstractPageViewer
;
9 import org
.argeo
.cms
.viewers
.EditablePart
;
10 import org
.eclipse
.swt
.SWT
;
11 import org
.eclipse
.swt
.events
.MouseAdapter
;
12 import org
.eclipse
.swt
.events
.MouseEvent
;
13 import org
.eclipse
.swt
.events
.MouseListener
;
14 import org
.eclipse
.swt
.graphics
.Point
;
15 import org
.eclipse
.swt
.widgets
.Composite
;
16 import org
.eclipse
.swt
.widgets
.Control
;
18 public class UserViewer
extends AbstractPageViewer
{
19 private static final long serialVersionUID
= -717973369525981931L;
20 private UserPart userPart
;
22 public UserViewer(Composite parent
, int style
, Node userNode
,
23 CmsEditable cmsEditable
) throws RepositoryException
{
24 this(new UserPart(parent
, SWT
.NO_BACKGROUND
, userNode
), style
,
25 userNode
, cmsEditable
);
28 private UserViewer(UserPart userPart
, int style
, Node userNode
,
29 CmsEditable cmsEditable
) throws RepositoryException
{
30 super(userPart
, style
, cmsEditable
);
31 this.userPart
= userPart
;
32 userPart
.createControl(userPart
,"cms_test");
33 userPart
.setStyle("cms_test");
35 userPart
.setLayoutData(CmsUtils
.fillWidth());
36 userPart
.setMouseListener(getMouseListener());
39 // userRolesPart.createControl(userPart,"cms_test");
40 // userPart.setStyle("cms_test");
42 // userPart.setLayoutData(CmsUtils.fillWidth());
43 // userPart.setMouseListener(getMouseListener());
48 // private JcrComposite createParents(Composite parent, Node userNode)
49 // throws RepositoryException {
51 // return this.parent;
55 public Control
getControl() {
61 protected MouseListener
createMouseListener() {
65 private class ML
extends MouseAdapter
{
66 private static final long serialVersionUID
= 8526890859876770905L;
69 public void mouseDoubleClick(MouseEvent e
) {
71 Control source
= (Control
) e
.getSource();
72 if (getCmsEditable().canEdit()) {
73 getCmsEditable().startEditing();
74 EditablePart composite
= findDataParent(source
);
75 Point point
= new Point(e
.x
, e
.y
);
76 edit(composite
, source
.toDisplay(point
));
82 protected void updateContent(EditablePart part
) throws RepositoryException
{
83 if (part
instanceof UserPart
)
84 ((UserPart
) part
).refresh();
88 protected void refresh(Control control
) throws RepositoryException
{
89 if (control
instanceof UserPart
)
90 ((UserPart
) control
).refresh();