[jsword-svn] r1915 - in trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop: book/install desktop

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Mon Jul 28 13:51:44 MST 2008


Author: dmsmith
Date: 2008-07-28 13:51:44 -0700 (Mon, 28 Jul 2008)
New Revision: 1915

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
Log:
Simplified LayoutPersistence to one line per window and applied persistence to Options and Books.

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java	2008-07-28 20:51:39 UTC (rev 1914)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java	2008-07-28 20:51:44 UTC (rev 1915)
@@ -23,7 +23,6 @@
 
 import java.awt.BorderLayout;
 import java.awt.Component;
-import java.awt.Dimension;
 import java.awt.FlowLayout;
 import java.awt.Frame;
 import java.awt.event.WindowAdapter;
@@ -43,6 +42,7 @@
 import org.crosswire.common.progress.swing.JobsProgressBar;
 import org.crosswire.common.swing.ActionFactory;
 import org.crosswire.common.swing.GuiUtil;
+import org.crosswire.common.swing.desktop.LayoutPersistence;
 import org.crosswire.jsword.book.install.InstallManager;
 import org.crosswire.jsword.book.install.Installer;
 import org.crosswire.jsword.book.install.InstallerEvent;
@@ -136,6 +136,7 @@
     {
         if (dlgMain != null)
         {
+            LayoutPersistence.instance().saveLayout(dlgMain);
             dlgMain.setVisible(false);
         }
     }
@@ -147,13 +148,14 @@
     {
         Frame root = JOptionPane.getFrameForComponent(parent);
         dlgMain = new JDialog(root);
-        dlgMain.setSize(new Dimension(750, 500));
         dlgMain.getContentPane().setLayout(new BorderLayout());
         dlgMain.getContentPane().add(this, BorderLayout.CENTER);
         dlgMain.getContentPane().add(createButtons(), BorderLayout.SOUTH);
         dlgMain.setTitle(Msg.AVAILABLE_BOOKS.toString());
         dlgMain.setResizable(true);
         //dlgMain.setModal(true);
+        // Set the name for Persistent Layout
+        dlgMain.setName("Sites"); //$NON-NLS-1$
         dlgMain.addWindowListener(new WindowAdapter()
         {
             /* (non-Javadoc)
@@ -166,6 +168,21 @@
             }
         });
         dlgMain.setLocationRelativeTo(parent);
+
+        // Restore window size, position, and layout if previously opened,
+        // otherwise use defaults.
+        LayoutPersistence layoutPersistence = LayoutPersistence.instance();
+        if (layoutPersistence.isLayoutPersisted(dlgMain))
+        {
+            layoutPersistence.restoreLayout(dlgMain);
+        }
+        else
+        {
+            dlgMain.setSize(750, 500);
+            GuiUtil.centerOnScreen(dlgMain);
+        }
+
+
         dlgMain.setVisible(true);
         dlgMain.toFront();
         GuiUtil.applyDefaultOrientation(dlgMain);

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java	2008-07-28 20:51:39 UTC (rev 1914)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java	2008-07-28 20:51:44 UTC (rev 1915)
@@ -155,6 +155,9 @@
      */
     public Desktop()
     {
+        // Set the name that is used for Layout Persistence
+        setName("Desktop"); //$NON-NLS-1$
+
         // The first thing that has to be done is to set the locale.
         Translations.instance().setLocale();
 




More information about the jsword-svn mailing list