Work on styling.
[gpl/argeo-suite.git] / org.argeo.suite.ui / src / org / argeo / suite / ui / DefaultLeadPane.java
index 7f2fe9fb53d6a6f5019d87817783d94601b8af15..a207e7a7453da85272bd20a88efedb183256d111 100644 (file)
@@ -13,19 +13,13 @@ import org.apache.commons.logging.LogFactory;
 import org.argeo.api.NodeConstants;
 import org.argeo.cms.Localized;
 import org.argeo.cms.auth.CurrentUser;
-import org.argeo.cms.ui.CmsTheme;
 import org.argeo.cms.ui.CmsUiProvider;
 import org.argeo.cms.ui.CmsView;
-import org.argeo.cms.ui.util.CmsIcon;
-import org.argeo.cms.ui.util.CmsUiUtils;
 import org.argeo.suite.RankedObject;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
 import org.osgi.framework.Constants;
 
 /** Side pane listing various perspectives. */
@@ -66,7 +60,7 @@ public class DefaultLeadPane implements CmsUiProvider {
                                if (iconName != null)
                                        icon = SuiteIcon.valueOf(iconName);
 
-                               Button b = createButton(parent, layerId, title, icon);
+                               Button b = SuiteUiUtils.createLayerButton(parent, layerId, title, icon);
                                if (first == null)
                                        first = b;
                        }
@@ -90,7 +84,7 @@ public class DefaultLeadPane implements CmsUiProvider {
                                        if (iconName != null)
                                                icon = SuiteIcon.valueOf(iconName);
 
-                                       Button b = createButton(parent, layerId, title, icon);
+                                       Button b = SuiteUiUtils.createLayerButton(parent, layerId, title, icon);
                                        if (first == null)
                                                first = b;
                                }
@@ -105,24 +99,6 @@ public class DefaultLeadPane implements CmsUiProvider {
                return first;
        }
 
-       protected Button createButton(Composite parent, String layer, Localized msg, CmsIcon icon) {
-               CmsTheme theme = CmsTheme.getCmsTheme(parent);
-               Button button = new Button(parent, SWT.PUSH);
-               CmsUiUtils.style(button, SuiteStyle.leadPane);
-               if (icon != null)
-                       button.setImage(icon.getBigIcon(theme));
-               button.setLayoutData(new GridData(SWT.CENTER, SWT.BOTTOM, true, false));
-               // button.setToolTipText(msg.lead());
-               if (msg != null) {
-                       Label lbl = new Label(parent, SWT.NONE);
-                       CmsUiUtils.style(lbl, SuiteStyle.leadPane);
-                       lbl.setText(msg.lead());
-                       lbl.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));
-               }
-               CmsUiUtils.sendEventOnSelect(button, SuiteEvent.switchLayer.topic(), SuiteEvent.LAYER, layer);
-               return button;
-       }
-
        public void init(Map<String, Object> properties) {
                defaultLayers = (String[]) properties.get(Property.defaultLayers.toString());
                if (defaultLayers == null)