Author: jfuerth
Date: Fri May 15 11:28:48 2009
New Revision: 3046
Modified:
trunk/src/ca/sqlpower/architect/swingui/olap/OLAPEditSession.java
Log:
Benjamin pointed out the tree in the olap editor is too narrow. This change
makes it bigger by default, and also tracks the current location in prefs
so it can be restored next time you launch the app.
Modified: trunk/src/ca/sqlpower/architect/swingui/olap/OLAPEditSession.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/OLAPEditSession.java
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/olap/OLAPEditSession.java Fri
May 15 11:28:48 2009
@@ -22,6 +22,7 @@
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.prefs.Preferences;
import javax.swing.AbstractAction;
import javax.swing.JFrame;
@@ -78,6 +79,16 @@
private JFrame frame;
/**
+ * The preferences node for OLAP user settings.
+ */
+ private final Preferences prefs =
Preferences.userNodeForPackage(OLAPEditSession.class);
+
+ private static enum PrefKeys {
+ /** The current split pane divider location. */
+ DIVIDER_LOCATION
+ }
+
+ /**
* The scroll pane of which the PlayPen is in.
*/
private JScrollPane ppScrollPane;
@@ -227,12 +238,17 @@
ppScrollPane = new JScrollPane(pp);
JPanel panel = new JPanel(new BorderLayout());
- panel.add(
- new JSplitPane(
- JSplitPane.HORIZONTAL_SPLIT,
- new JScrollPane(tree),
- ppScrollPane),
- BorderLayout.CENTER);
+ final JSplitPane splitPane = new JSplitPane(
+ JSplitPane.HORIZONTAL_SPLIT,
+ new JScrollPane(tree),
+ ppScrollPane);
+
splitPane.setDividerLocation(prefs.getInt(PrefKeys.DIVIDER_LOCATION.name(),
240));
+ splitPane.addPropertyChangeListener("dividerLocation", new
PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ prefs.putInt(PrefKeys.DIVIDER_LOCATION.name(),
splitPane.getDividerLocation());
+ }
+ });
+ panel.add(splitPane, BorderLayout.CENTER);
panel.add(toolbar, BorderLayout.EAST);
frame = new JFrame(generateDialogTitle());