You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/09/10 20:37:50 UTC

svn commit: r813540 - /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java

Author: tvolkert
Date: Thu Sep 10 18:37:49 2009
New Revision: 813540

URL: http://svn.apache.org/viewvc?rev=813540&view=rev
Log:
PIVOT-289 :: Add location and size persistence to DesktopApplicationContext

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java?rev=813540&r1=813539&r2=813540&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java Thu Sep 10 18:37:49 2009
@@ -29,6 +29,7 @@
 import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.prefs.Preferences;
 
 import org.apache.pivot.collections.HashMap;
 import org.apache.pivot.collections.immutable.ImmutableMap;
@@ -259,6 +260,16 @@
         }
 
         if (!cancelShutdown) {
+            try {
+                Preferences preferences = Preferences.userNodeForPackage(DesktopApplicationContext.class);
+                preferences.putInt(X_ARGUMENT, windowedHostFrame.getX());
+                preferences.putInt(Y_ARGUMENT, windowedHostFrame.getY());
+                preferences.putInt(WIDTH_ARGUMENT, windowedHostFrame.getWidth());
+                preferences.putInt(HEIGHT_ARGUMENT, windowedHostFrame.getHeight());
+            } catch (SecurityException exception) {
+                // No-op
+            }
+
             windowedHostFrame.dispose();
             fullScreenHostFrame.dispose();
         }
@@ -277,6 +288,7 @@
         // Get the application class name
         if (args.length == 0) {
             System.err.println("Application class name is required.");
+            return;
         }
 
         applicationClassName = args[0];
@@ -292,6 +304,16 @@
         boolean resizable = true;
         boolean fullScreen = false;
 
+        try {
+            Preferences preferences = Preferences.userNodeForPackage(DesktopApplicationContext.class);
+            x = preferences.getInt(X_ARGUMENT, x);
+            y = preferences.getInt(Y_ARGUMENT, y);
+            width = preferences.getInt(WIDTH_ARGUMENT, width);
+            height = preferences.getInt(HEIGHT_ARGUMENT, height);
+        } catch (SecurityException exception) {
+            // No-op
+        }
+
         for (int i = 1, n = args.length; i < n; i++) {
             String arg = args[i];