]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - rcp/org.argeo.minidesktop/src/org/argeo/minidesktop/MiniDesktopManager.java
[maven-release-plugin] prepare for next development iteration
[gpl/argeo-slc.git] / rcp / org.argeo.minidesktop / src / org / argeo / minidesktop / MiniDesktopManager.java
index fa66a8e76db0058c0e7dafb8cddf2fe8e717d15a..e0f483d49f06ef52657aaadd9ccf1e674e39af16 100644 (file)
@@ -1,5 +1,6 @@
 package org.argeo.minidesktop;
 
+import java.lang.management.ManagementFactory;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.file.Path;
@@ -52,6 +53,10 @@ public class MiniDesktopManager {
                        throw new IllegalStateException("Already a display " + display);
                display = new Display();
 
+               if (display.getTouchEnabled()) {
+                       System.out.println("Touch enabled.");
+               }
+
                images = new MiniDesktopImages(display);
 
                int toolBarSize = 48;
@@ -60,6 +65,7 @@ public class MiniDesktopManager {
                        rootShell = new Shell(display, SWT.NO_TRIM);
                        rootShell.setFullScreen(true);
                        Rectangle bounds = display.getBounds();
+                       rootShell.setLocation(0, 0);
                        rootShell.setSize(bounds.width, bounds.height);
                } else {
                        rootShell = new Shell(display, SWT.CLOSE | SWT.RESIZE);
@@ -93,10 +99,6 @@ public class MiniDesktopManager {
 
                        Color selectionBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION);
                        tabFolder.setSelectionBackground(selectionBackground);
-//                     tabFolder.setSelectionForeground(selectionBackground);
-//                     tabFolder.setSelectionBackground(
-//                                     new Color[] { display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_BLUE) },
-//                                     new int[] { 100 }, true);
 
                        // background
                        Control background = createBackground(tabFolder);
@@ -106,19 +108,20 @@ public class MiniDesktopManager {
                        homeTabItem.setControl(background);
                        tabFolder.setFocus();
                } else {
-                       if (isFullscreen())
-                               createBackground(rootShell);
-                       else
-                               rootShell.pack();
+                       createBackground(rootShell);
                }
 
                rootShell.open();
                // rootShell.layout(true, true);
 
                if (toolBarShell != null) {
-                       toolBarShell.setLocation(new Point(0, 0));
+                       int toolBarShellY = (display.getBounds().height - toolBar.getSize().y) / 2;
+                       toolBarShell.setLocation(0, toolBarShellY);
                        toolBarShell.open();
                }
+
+               long jvmUptime = ManagementFactory.getRuntimeMXBean().getUptime();
+               System.out.println("SWT Mini Desktop Manager available in " + jvmUptime + " ms.");
        }
 
        protected void createDock(ToolBar toolBar) {
@@ -224,7 +227,8 @@ public class MiniDesktopManager {
                        item.setControl(appParent);
                        return new AppContext(item);
                } else {
-                       Shell shell = new Shell(rootShell.getDisplay(), SWT.SHELL_TRIM);
+                       Shell shell = isFullscreen() ? new Shell(rootShell, SWT.SHELL_TRIM)
+                                       : new Shell(rootShell.getDisplay(), SWT.SHELL_TRIM);
                        shell.setImage(icon);
                        return new AppContext(shell);
                }
@@ -250,6 +254,14 @@ public class MiniDesktopManager {
        }
 
        protected void initBackground(Composite backgroundArea) {
+               MiniHomePart homePart = new MiniHomePart() {
+
+                       @Override
+                       protected void fillAppsToolBar(ToolBar toolBar) {
+                               createDock(toolBar);
+                       }
+               };
+               homePart.createUiPart(backgroundArea, null);
        }
 
        public void run() {