Author: jflesch
Date: 2007-01-13 23:02:41 +0000 (Sat, 13 Jan 2007)
New Revision: 11597
Modified:
trunk/apps/Thaw/src/thaw/core/MainWindow.java
trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
Log:
Thaw now remember the window size and the exact position of the separators
Modified: trunk/apps/Thaw/src/thaw/core/MainWindow.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/MainWindow.java 2007-01-12 22:45:58 UTC
(rev 11596)
+++ trunk/apps/Thaw/src/thaw/core/MainWindow.java 2007-01-13 23:02:41 UTC
(rev 11597)
@@ -187,6 +187,17 @@
mainWindow.addWindowListener(this);
core.getConnectionManager().addObserver(this);
+
+ if (core.getConfig().getValue("mainWindowSizeX") != null
+ && core.getConfig().getValue("mainWindowSizeY") != null) {
+ try {
+
mainWindow.setSize(Integer.parseInt(core.getConfig().getValue("mainWindowSizeX")),
+
Integer.parseInt(core.getConfig().getValue("mainWindowSizeY")));
+ } catch(NumberFormatException e) {
+ Logger.warning(this, "Exception while setting
the main window size");
+ }
+ }
+
}
@@ -401,7 +412,7 @@
}
if(e.getSource() == quitButton) {
- core.exit();
+ endOfTheWorld();
}
if(e.getSource() == reconnectionFileMenuItem) {
@@ -462,6 +473,15 @@
* Called when window is closed or 'quit' is choosed is the menu.
*/
public void endOfTheWorld() {
+ if (mainWindow != null) {
+ java.awt.Dimension size = mainWindow.getSize();
+
+ core.getConfig().setValue("mainWindowSizeX",
+ Integer.toString((new
Double(size.getWidth())).intValue()));
+ core.getConfig().setValue("mainWindowSizeY",
+ Integer.toString((new
Double(size.getHeight())).intValue()));
+ }
+
if(core == null) {
Logger.error(this, "Warning, no ref to core, exiting
brutaly");
System.exit(0);
Modified: trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java 2007-01-12 22:45:58 UTC
(rev 11596)
+++ trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java 2007-01-13 23:02:41 UTC
(rev 11597)
@@ -37,7 +37,7 @@
private JSplitPane split;
- private final static int DIVIDER_LOCATION = 310;
+ private final static int DIVIDER_LOCATION = 310; /* about the details
panel */
private long lastChange = 0;
private boolean folded = false;
@@ -102,7 +102,7 @@
split.setDividerLocation((0.5));
} else {
try {
-
split.setDividerLocation(Double.parseDouble(core.getConfig().getValue("queuePanelSplitLocation")));
+
split.setDividerLocation(Integer.parseInt(core.getConfig().getValue("queuePanelSplitLocation")));
} catch(java.lang.IllegalArgumentException e) { /*
TODO: Shouldn't happen ! */
Logger.error(this, "Error while setting split
bar position: "+e.toString());
}
@@ -134,14 +134,15 @@
public boolean stop() {
Logger.info(this, "Stopping plugin \"QueueWatcher\" ...");
- double splitLocation;
+ int splitLocation;
core.getMainWindow().getTabbedPane().removeChangeListener(this);
- splitLocation = ((double)split.getDividerLocation() -
((double)split.getMinimumDividerLocation())) /
(((double)split.getMaximumDividerLocation()) -
((double)split.getMinimumDividerLocation()));
+ splitLocation = split.getDividerLocation();
+
core.getConfig().setValue("queuePanelSplitLocation",
- Double.toString(splitLocation));
+ Integer.toString(splitLocation));
core.getConfig().setValue("detailPanelFolded", ((new
Boolean(folded)).toString()));
core.getMainWindow().removeTab(panelAdded);
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
2007-01-12 22:45:58 UTC (rev 11596)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexBrowserPanel.java
2007-01-13 23:02:41 UTC (rev 11597)
@@ -84,7 +84,7 @@
leftSplit.setDividerLocation((0.5));
} else {
try {
-
leftSplit.setDividerLocation(Double.parseDouble(config.getValue("indexTreeUnknownListSplitLocation")));
+
leftSplit.setDividerLocation(Integer.parseInt(config.getValue("indexTreeUnknownListSplitLocation")));
} catch(java.lang.IllegalArgumentException e) { /*
TODO: Find why it happens */
Logger.error(this, "Exception while setting
indexTree split location");
}
@@ -131,9 +131,9 @@
public void saveState() {
indexTree.save();
config.setValue("indexBrowserPanelSplitPosition",
Integer.toString(split.getDividerLocation()));
- double splitLocation;
+ int splitLocation;
- splitLocation = ((double)leftSplit.getDividerLocation() -
((double)leftSplit.getMinimumDividerLocation())) /
(((double)leftSplit.getMaximumDividerLocation()) -
((double)leftSplit.getMinimumDividerLocation()));
+ splitLocation = leftSplit.getDividerLocation();
config.setValue("indexTreeUnknownListSplitLocation",
Double.toString(splitLocation));