Author: jflesch
Date: 2006-10-20 18:09:26 +0000 (Fri, 20 Oct 2006)
New Revision: 10680

Modified:
   trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java
   trunk/apps/Thaw/src/thaw/plugins/IndexEditor.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexEditorPanel.java
   trunk/apps/Thaw/src/thaw/plugins/index/Tables.java
Log:
Split positions in index browser and editor are now saved in Thaw configuration

Modified: trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java  2006-10-20 06:33:09 UTC 
(rev 10679)
+++ trunk/apps/Thaw/src/thaw/plugins/IndexBrowser.java  2006-10-20 18:09:26 UTC 
(rev 10680)
@@ -33,19 +33,21 @@

                TableCreator.createTables(hsqldb);

-               browserPanel = new IndexBrowserPanel(hsqldb, 
core.getQueueManager());
+               browserPanel = new IndexBrowserPanel(hsqldb, 
core.getQueueManager(), core.getConfig());

                
core.getMainWindow().addTab(I18n.getMessage("thaw.plugin.index.browser"),
                                            IconBox.minIndexBrowser,
                                            browserPanel.getPanel());

+               browserPanel.restoreState();
+
                return true;
        }

        public boolean stop() {
                core.getMainWindow().removeTab(browserPanel.getPanel());

-               browserPanel.save();
+               browserPanel.saveState();

                hsqldb.unregisterChild(this);


Modified: trunk/apps/Thaw/src/thaw/plugins/IndexEditor.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/IndexEditor.java   2006-10-20 06:33:09 UTC 
(rev 10679)
+++ trunk/apps/Thaw/src/thaw/plugins/IndexEditor.java   2006-10-20 18:09:26 UTC 
(rev 10680)
@@ -38,13 +38,14 @@
                TableCreator.createTables(hsqldb);


-               editorPanel = new IndexEditorPanel(hsqldb, 
core.getQueueManager());
+               editorPanel = new IndexEditorPanel(hsqldb, 
core.getQueueManager(), core.getConfig());


                
core.getMainWindow().addTab(I18n.getMessage("thaw.plugin.index.editor"),
                                            IconBox.minIndexEditor,
                                            editorPanel.getPanel());
-                                           
+               
+               editorPanel.restoreState();

                return true;
        }
@@ -53,7 +54,7 @@
        public boolean stop() {
                core.getMainWindow().removeTab(editorPanel.getPanel());

-               editorPanel.save();
+               editorPanel.saveState();

                hsqldb.unregisterChild(this);


Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java       
2006-10-20 06:33:09 UTC (rev 10679)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java       
2006-10-20 18:09:26 UTC (rev 10680)
@@ -33,18 +33,19 @@

        private Hsqldb db;
        private FCPQueueManager queueManager;
+       private Config config;

-
-       public IndexBrowserPanel(Hsqldb db, FCPQueueManager queueManager) {
+       public IndexBrowserPanel(Hsqldb db, FCPQueueManager queueManager, 
Config config) {
                this.db = db;
                this.queueManager = queueManager;
+               this.config = config;

                indexTree = new 
IndexTree(I18n.getMessage("thaw.plugin.index.indexes"), false, false, 
queueManager, db);

                listAndDetails = new JPanel();
                listAndDetails.setLayout(new BorderLayout(10, 10));

-               tables = new Tables(false, db, queueManager, indexTree);
+               tables = new Tables(false, db, queueManager, indexTree, config);
                fileDetails = new FileDetailsEditor(false);

                listAndDetails.add(tables.getPanel(), BorderLayout.CENTER);
@@ -55,15 +56,22 @@
                                       listAndDetails);

                indexTree.addTreeSelectionListener(this);
+       }

+       public void restoreState() {
+               if (config.getValue("indexBrowserPanelSplitPosition") != null)
+                       
split.setDividerLocation(Integer.parseInt(config.getValue("indexBrowserPanelSplitPosition")));
+               tables.restoreState();
        }

        public JSplitPane getPanel() {
                return split;
        }

-       public void save() {
+       public void saveState() {
                indexTree.save();
+               config.setValue("indexBrowserPanelSplitPosition", 
Integer.toString(split.getDividerLocation()));
+               tables.saveState();
        }



Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexEditorPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexEditorPanel.java        
2006-10-20 06:33:09 UTC (rev 10679)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexEditorPanel.java        
2006-10-20 18:09:26 UTC (rev 10680)
@@ -43,11 +43,12 @@

        private Hsqldb db;
        private FCPQueueManager queueManager;
-
-
-       public IndexEditorPanel(Hsqldb db, FCPQueueManager queueManager) {
+       private Config config;
+       
+       public IndexEditorPanel(Hsqldb db, FCPQueueManager queueManager, Config 
config) {
                this.db = db;
                this.queueManager = queueManager;
+               this.config = config;

                indexTree = new 
IndexTree(I18n.getMessage("thaw.plugin.index.yourIndexes"), true, false, 
queueManager, db);

@@ -72,7 +73,7 @@
                toolBar.addSeparator();
                toolBar.add(linkButton);

-               tables = new Tables(true, db, queueManager, indexTree);
+               tables = new Tables(true, db, queueManager, indexTree, config);
                fileDetails = new FileDetailsEditor(true);

                listAndDetails = new JPanel();
@@ -90,12 +91,20 @@

        }

+       public void restoreState() {
+               if (config.getValue("indexEditorPanelSplitPosition") != null)
+                       
split.setDividerLocation(Integer.parseInt(config.getValue("indexEditorPanelSplitPosition")));
+               tables.restoreState();
+       }
+       
        public JSplitPane getPanel() {
                return split;
        }

-       public void save() {
+       public void saveState() {
                indexTree.save();
+               config.setValue("indexEditorPanelSplitPosition", 
Integer.toString(split.getDividerLocation()));
+               tables.saveState();
        }

        public void buttonsEnabled(boolean a) {

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Tables.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Tables.java  2006-10-20 06:33:09 UTC 
(rev 10679)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Tables.java  2006-10-20 18:09:26 UTC 
(rev 10680)
@@ -6,6 +6,7 @@

 import thaw.fcp.FCPQueueManager;

+import thaw.core.Config;
 import thaw.plugins.Hsqldb;

 /**
@@ -18,7 +19,12 @@
        private FileTable fileTable;
        private LinkTable linkTable;

-       public Tables(boolean modifiables, Hsqldb db, FCPQueueManager 
queueManager, IndexTree tree) {
+       private JSplitPane split;
+       private Config config;
+
+       public Tables(boolean modifiables, Hsqldb db, FCPQueueManager 
queueManager, IndexTree tree, Config config) {
+               this.config = config;
+
                panel = new JPanel();
                panel.setLayout(new BorderLayout(10, 10));

@@ -27,13 +33,27 @@

                searchBar = new SearchBar(db, tree, this);

+               split = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+                                        linkTable.getPanel(),
+                                      fileTable.getPanel());
+
                panel.add(searchBar.getPanel(), BorderLayout.NORTH);
-               panel.add(new JSplitPane(JSplitPane.VERTICAL_SPLIT,
-                                        linkTable.getPanel(),
-                                        fileTable.getPanel()));
+               panel.add(split, BorderLayout.CENTER);
        }

+       public JPanel getPanel() {
+               return panel;
+       }

+       public void restoreState() {
+               if (config.getValue("indexFileLinkSplit") != null)
+                       
split.setDividerLocation(Integer.parseInt(config.getValue("indexFileLinkSplit")));
+       }
+
+       public void saveState() {
+               config.setValue("indexFileLinkSplit", 
Integer.toString(split.getDividerLocation()));
+       }
+
        protected FileTable getFileTable() {
                return fileTable;
        }
@@ -55,11 +75,4 @@
                setLinkList(l);
        }

-
-       public JPanel getPanel() {
-               return panel;
-       }
-
-
-
 }


Reply via email to