1 package org
.argeo
.suite
.web
;
6 import javax
.jcr
.RepositoryException
;
8 import org
.argeo
.cms
.ui
.CmsUiProvider
;
9 import org
.argeo
.cms
.util
.CmsUtils
;
10 import org
.argeo
.connect
.resources
.ResourcesService
;
11 import org
.argeo
.eclipse
.ui
.EclipseUiUtils
;
12 import org
.argeo
.people
.PeopleException
;
13 import org
.argeo
.people
.PeopleService
;
14 import org
.argeo
.people
.web
.parts
.PeopleSearchCmp
;
15 import org
.eclipse
.jface
.viewers
.DoubleClickEvent
;
16 import org
.eclipse
.jface
.viewers
.IDoubleClickListener
;
17 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
18 import org
.eclipse
.jface
.viewers
.TableViewer
;
19 import org
.eclipse
.jface
.viewers
.Viewer
;
20 import org
.eclipse
.swt
.SWT
;
21 import org
.eclipse
.swt
.custom
.SashForm
;
22 import org
.eclipse
.swt
.layout
.GridLayout
;
23 import org
.eclipse
.swt
.widgets
.Composite
;
24 import org
.eclipse
.swt
.widgets
.Control
;
25 import org
.eclipse
.swt
.widgets
.Label
;
27 /** Default dashboard layout for Argeo Suite */
28 public class DefaultDashboard
implements CmsUiProvider
{
30 private ResourcesService resourceService
;
31 private PeopleService peopleService
;
32 private Map
<String
, String
> peopleIconPaths
;
35 // private CmsUiProvider orgPage;
37 public DefaultDashboard(ResourcesService resourceService
, PeopleService peopleService
, Map
<String
, String
> peopleIconPaths
) {
38 this.resourceService
= resourceService
;
39 this.peopleService
= peopleService
;
40 this.peopleIconPaths
= peopleIconPaths
;
42 // orgPage = new OrgPage(peopleService);
46 public Control
createUi(Composite parent
, Node context
) throws RepositoryException
{
47 parent
.setLayout(EclipseUiUtils
.noSpaceGridLayout());
48 SashForm form
= new SashForm(parent
, SWT
.HORIZONTAL
);
49 form
.setLayoutData(EclipseUiUtils
.fillAll());
50 Composite leftPannelCmp
= new Composite(form
, SWT
.NO_FOCUS
);
51 Composite rightPannelCmp
= new Composite(form
, SWT
.NO_FOCUS
);
52 form
.setWeights(new int[] { 2, 5 });
54 // A search on the left and the display on the right
55 populateSearch(leftPannelCmp
, context
, rightPannelCmp
);
56 populateDefaultDisplay(rightPannelCmp
, context
);
61 public Viewer
populateSearch(Composite parent
, Node context
, final Composite targetComposite
)
62 throws RepositoryException
{
63 parent
.setLayout(EclipseUiUtils
.noSpaceGridLayout());
64 Composite titleCmp
= new Composite(parent
, SWT
.NO_FOCUS
);
65 titleCmp
.setLayoutData(EclipseUiUtils
.fillWidth());
66 titleCmp
.setLayout(new GridLayout());
67 Label titleLbl
= new Label(titleCmp
, SWT
.CENTER
);
68 titleLbl
.setLayoutData(EclipseUiUtils
.fillWidth());
69 titleLbl
.setText("My Tasks");
70 titleLbl
.setFont(EclipseUiUtils
.getBoldFont(titleCmp
));
72 PeopleSearchCmp searchComp
= new PeopleSearchCmp(parent
, SWT
.NO_FOCUS
, resourceService
, peopleService
, peopleIconPaths
);
73 searchComp
.populate(context
, true);
74 searchComp
.setLayoutData(EclipseUiUtils
.fillAll());
76 TableViewer viewer
= searchComp
.getViewer();
77 viewer
.addDoubleClickListener(new IDoubleClickListener() {
79 public void doubleClick(DoubleClickEvent event
) {
80 Object firstObj
= ((IStructuredSelection
) event
.getSelection()).getFirstElement();
82 Node node
= (Node
) firstObj
;
83 String path
= node
.getPath();
84 CmsUtils
.getCmsView().navigateTo(path
);
85 } catch (RepositoryException e
) {
86 throw new PeopleException("Unable to refresh display for " + context
, e
);
93 public Control
populateDefaultDisplay(Composite parent
, Node context
) throws RepositoryException
{
94 parent
.setLayout(new GridLayout());
95 Label lbl
= new Label(parent
, SWT
.NONE
);
96 lbl
.setText("Implement a default display");