]>
git.argeo.org Git - gpl/argeo-suite.git/blob - DefaultLeadPane.java
48e6149d6af6aba132523a1b28e4cacf0356f890
1 package org
.argeo
.suite
.ui
;
3 import java
.util
.HashMap
;
7 import javax
.jcr
.RepositoryException
;
9 import org
.apache
.commons
.logging
.Log
;
10 import org
.apache
.commons
.logging
.LogFactory
;
11 import org
.argeo
.cms
.Localized
;
12 import org
.argeo
.cms
.ui
.CmsTheme
;
13 import org
.argeo
.cms
.ui
.CmsUiProvider
;
14 import org
.argeo
.cms
.ui
.CmsView
;
15 import org
.argeo
.cms
.ui
.util
.CmsIcon
;
16 import org
.argeo
.cms
.ui
.util
.CmsUiUtils
;
17 import org
.argeo
.eclipse
.ui
.Selected
;
18 import org
.eclipse
.swt
.SWT
;
19 import org
.eclipse
.swt
.layout
.GridLayout
;
20 import org
.eclipse
.swt
.widgets
.Button
;
21 import org
.eclipse
.swt
.widgets
.Composite
;
22 import org
.eclipse
.swt
.widgets
.Control
;
23 import org
.osgi
.service
.event
.Event
;
24 import org
.osgi
.service
.event
.EventAdmin
;
26 /** Side pane listing various perspectives. */
27 public class DefaultLeadPane
implements CmsUiProvider
{
28 private final static Log log
= LogFactory
.getLog(DefaultLeadPane
.class);
29 private EventAdmin eventAdmin
;
32 public Control
createUi(Composite parent
, Node node
) throws RepositoryException
{
33 CmsView cmsView
= CmsView
.getCmsView(parent
);
34 GridLayout layout
= new GridLayout();
35 layout
.verticalSpacing
= 10;
36 layout
.marginTop
= 10;
37 layout
.marginLeft
= 10;
38 layout
.marginRight
= 10;
39 parent
.setLayout(layout
);
41 Button dashboardB
= createButton(parent
, SuiteMsg
.dashboard
.name(), SuiteMsg
.dashboard
, SuiteIcon
.dashboard
);
42 if (!cmsView
.isAnonymous()) {
43 createButton(parent
, SuiteMsg
.documents
.name(), SuiteMsg
.documents
, SuiteIcon
.documents
);
44 createButton(parent
, SuiteMsg
.people
.name(), SuiteMsg
.people
, SuiteIcon
.people
);
45 createButton(parent
, SuiteMsg
.locations
.name(), SuiteMsg
.locations
, SuiteIcon
.location
);
50 protected Button
createButton(Composite parent
, String layer
, Localized msg
, CmsIcon icon
) {
51 CmsTheme theme
= CmsTheme
.getCmsTheme(parent
);
52 Button button
= new Button(parent
, SWT
.PUSH
);
53 CmsUiUtils
.style(button
, SuiteStyle
.leadPane
);
54 button
.setToolTipText(msg
.lead());
55 button
.setImage(icon
.getBigIcon(theme
));
56 CmsUiUtils
.sendEventOnSelect(button
, SuiteEvent
.switchLayer
.topic(), SuiteEvent
.LAYER_PARAM
, layer
);
60 public void init(Map
<String
, String
> properties
) {
64 public void setEventAdmin(EventAdmin eventAdmin
) {
65 this.eventAdmin
= eventAdmin
;