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
.people
.PeopleException
;
11 import org
.argeo
.connect
.people
.PeopleService
;
12 import org
.argeo
.connect
.people
.web
.parts
.PeopleSearchCmp
;
13 import org
.argeo
.eclipse
.ui
.EclipseUiUtils
;
14 import org
.eclipse
.jface
.viewers
.DoubleClickEvent
;
15 import org
.eclipse
.jface
.viewers
.IDoubleClickListener
;
16 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
17 import org
.eclipse
.jface
.viewers
.TableViewer
;
18 import org
.eclipse
.jface
.viewers
.Viewer
;
19 import org
.eclipse
.swt
.SWT
;
20 import org
.eclipse
.swt
.custom
.SashForm
;
21 import org
.eclipse
.swt
.layout
.GridLayout
;
22 import org
.eclipse
.swt
.widgets
.Composite
;
23 import org
.eclipse
.swt
.widgets
.Control
;
24 import org
.eclipse
.swt
.widgets
.Label
;
26 /** Default dashboard layout for Argeo Suite */
27 public class DefaultDashboard
implements CmsUiProvider
{
29 private PeopleService peopleService
;
30 private Map
<String
, String
> peopleIconPaths
;
33 // private CmsUiProvider orgPage;
35 public DefaultDashboard(PeopleService peopleService
, Map
<String
, String
> peopleIconPaths
) {
36 this.peopleService
= peopleService
;
37 this.peopleIconPaths
= peopleIconPaths
;
39 // orgPage = new OrgPage(peopleService);
43 public Control
createUi(Composite parent
, Node context
) throws RepositoryException
{
44 parent
.setLayout(EclipseUiUtils
.noSpaceGridLayout());
45 SashForm form
= new SashForm(parent
, SWT
.HORIZONTAL
);
46 form
.setLayoutData(EclipseUiUtils
.fillAll());
47 Composite leftPannelCmp
= new Composite(form
, SWT
.NO_FOCUS
);
48 Composite rightPannelCmp
= new Composite(form
, SWT
.NO_FOCUS
);
49 form
.setWeights(new int[] { 2, 5 });
51 // A search on the left and the display on the right
52 populateSearch(leftPannelCmp
, context
, rightPannelCmp
);
53 populateDefaultDisplay(rightPannelCmp
, context
);
58 public Viewer
populateSearch(Composite parent
, Node context
, final Composite targetComposite
)
59 throws RepositoryException
{
60 parent
.setLayout(EclipseUiUtils
.noSpaceGridLayout());
61 Composite titleCmp
= new Composite(parent
, SWT
.NO_FOCUS
);
62 titleCmp
.setLayoutData(EclipseUiUtils
.fillWidth());
63 titleCmp
.setLayout(new GridLayout());
64 Label titleLbl
= new Label(titleCmp
, SWT
.CENTER
);
65 titleLbl
.setLayoutData(EclipseUiUtils
.fillWidth());
66 titleLbl
.setText("My Tasks");
67 titleLbl
.setFont(EclipseUiUtils
.getBoldFont(titleCmp
));
69 PeopleSearchCmp searchComp
= new PeopleSearchCmp(parent
, SWT
.NO_FOCUS
, peopleService
, peopleIconPaths
);
70 searchComp
.populate(context
, true);
71 searchComp
.setLayoutData(EclipseUiUtils
.fillAll());
73 TableViewer viewer
= searchComp
.getViewer();
74 viewer
.addDoubleClickListener(new IDoubleClickListener() {
76 public void doubleClick(DoubleClickEvent event
) {
77 Object firstObj
= ((IStructuredSelection
) event
.getSelection()).getFirstElement();
79 Node node
= (Node
) firstObj
;
80 String path
= node
.getPath();
81 CmsUtils
.getCmsView().navigateTo(path
);
82 } catch (RepositoryException e
) {
83 throw new PeopleException("Unable to refresh display for " + context
, e
);
90 public Control
populateDefaultDisplay(Composite parent
, Node context
) throws RepositoryException
{
91 parent
.setLayout(new GridLayout());
92 Label lbl
= new Label(parent
, SWT
.NONE
);
93 lbl
.setText("Implement a default display");