Author: jflesch
Date: 2006-07-18 17:43:23 +0000 (Tue, 18 Jul 2006)
New Revision: 9653

Modified:
   trunk/apps/Thaw/src/thaw/core/MainWindow.java
   trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
   trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
Log:
Make the detail panel hideable

Modified: trunk/apps/Thaw/src/thaw/core/MainWindow.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/MainWindow.java       2006-07-18 16:37:19 UTC 
(rev 9652)
+++ trunk/apps/Thaw/src/thaw/core/MainWindow.java       2006-07-18 17:43:23 UTC 
(rev 9653)
@@ -81,7 +81,6 @@
                mainWindow.getContentPane().setLayout(new BorderLayout());

                mainWindow.setJMenuBar(menuBar);
-               //mainWindow.getContentPane().add(menuBar, BorderLayout.NORTH);
                mainWindow.getContentPane().add(tabbedPane, 
BorderLayout.CENTER);
                mainWindow.getContentPane().add(statusBar, BorderLayout.SOUTH);


Modified: trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java  2006-07-18 16:37:19 UTC 
(rev 9652)
+++ trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java  2006-07-18 17:43:23 UTC 
(rev 9653)
@@ -10,6 +10,9 @@
 import java.util.Observable;
 import java.util.Vector;
 import java.util.Iterator;
+import javax.swing.JSplitPane;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeEvent;

 import thaw.core.*;
 import thaw.i18n.I18n;
@@ -17,15 +20,20 @@

 import thaw.fcp.*;

-public class QueueWatcher implements thaw.core.Plugin, Observer {
+public class QueueWatcher implements thaw.core.Plugin, Observer, 
PropertyChangeListener {
        private Core core;

-       private JPanel mainPanel;
+       //private JPanel mainPanel;
+       private JSplitPane mainPanel;

        private QueuePanel[] queuePanels = new QueuePanel[2];
        private DetailPanel detailPanel;
        private JPanel panel;

+       private final static int DIVIDER_LOCATION = -1;
+       private long lastChange = 0;
+       private boolean folded = false;
+
        public QueueWatcher() {

        }
@@ -36,10 +44,6 @@

                Logger.info(this, "Starting plugin \"QueueWatcher\" ...");

-               mainPanel = new JPanel();
-
-               mainPanel.setLayout(new BorderLayout());
-
                detailPanel = new DetailPanel(core);

                queuePanels[0] = new QueuePanel(core, detailPanel, false); /* 
download */
@@ -51,8 +55,6 @@
                layout.setVgap(10);
                panel.setLayout(layout);

-               mainPanel.add(panel, BorderLayout.CENTER);
-
                if(queuePanels[0].getPanel() != null)
                        panel.add(queuePanels[0].getPanel());

@@ -60,10 +62,22 @@
                        panel.add(queuePanels[1].getPanel());


-               if(detailPanel.getPanel() != null) {
-                       mainPanel.add(detailPanel.getPanel(), 
BorderLayout.EAST);
+               mainPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, 
detailPanel.getPanel(), panel);
+               
+               if(core.getConfig().getValue("detailPanelFolded") == null
+                  || ((new 
Boolean(core.getConfig().getValue("detailPanelFolded"))).booleanValue()) == 
true) {
+                       folded = true;
+                       mainPanel.setDividerLocation(1);
+                       detailPanel.getPanel().setVisible(false);
+               } else {
+                       folded = false;
+                       mainPanel.setDividerLocation(-1);
+                       detailPanel.getPanel().setVisible(true);
                }

+               mainPanel.addPropertyChangeListener(this);
+               mainPanel.setOneTouchExpandable(true);
+
                
core.getMainWindow().addTab(I18n.getMessage("thaw.common.status"), mainPanel);

                if(core.getQueueManager() != null)
@@ -77,10 +91,14 @@
                return true;
        }

+       

+
        public boolean stop() {
                Logger.info(this, "Stopping plugin \"QueueWatcher\" ...");

+               core.getConfig().setValue("detailPanelFolded", ((new 
Boolean(folded)).toString()));
+
                core.getMainWindow().removeTab(mainPanel);

                return true;
@@ -128,4 +146,29 @@

        }

+       public void propertyChange(PropertyChangeEvent evt) {
+
+               if(evt.getPropertyName().equals("dividerLocation")) {
+
+                       if(System.currentTimeMillis() - lastChange < 500) {
+                               lastChange = System.currentTimeMillis();
+                               return;
+                       }
+
+                       lastChange = System.currentTimeMillis();
+
+                       folded = !folded;
+
+                       if(folded)
+                               mainPanel.setDividerLocation(1);
+                       else
+                               mainPanel.setDividerLocation(-1);
+
+                       detailPanel.getPanel().setVisible(!folded);
+
+
+               }
+
+       }
+
 }

Modified: trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java        
2006-07-18 16:37:19 UTC (rev 9652)
+++ trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java        
2006-07-18 17:43:23 UTC (rev 9653)
@@ -159,7 +159,7 @@
                destinationField = new JTextField("");
                if(core.getConfig().getValue("lastDestinationDirectory") != 
null)
                        
destinationField.setText(core.getConfig().getValue("lastDestinationDirectory"));
-               destinationField.setEditable(false);
+               destinationField.setEditable(true);

                destinationButton = new 
JButton(I18n.getMessage("thaw.plugin.fetch.chooseDestination"));
                destinationButton.addActionListener(this);


Reply via email to