Author: scooter
Date: 2011-08-02 16:28:08 -0700 (Tue, 02 Aug 2011)
New Revision: 26359

Modified:
   
cytoscape/trunk/application/src/main/java/cytoscape/view/cytopanels/CytoPanelImp.java
Log:
Another shot at fixing CytoPanel resizing issues


Modified: 
cytoscape/trunk/application/src/main/java/cytoscape/view/cytopanels/CytoPanelImp.java
===================================================================
--- 
cytoscape/trunk/application/src/main/java/cytoscape/view/cytopanels/CytoPanelImp.java
       2011-08-02 23:06:14 UTC (rev 26358)
+++ 
cytoscape/trunk/application/src/main/java/cytoscape/view/cytopanels/CytoPanelImp.java
       2011-08-02 23:28:08 UTC (rev 26359)
@@ -73,6 +73,7 @@
 import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
+import javax.swing.JSplitPane;
 import javax.swing.JTabbedPane;
 import javax.swing.SwingConstants;
 import javax.swing.border.EmptyBorder;
@@ -98,11 +99,13 @@
        /**
         * Minimum standards for CytoPanels.
         */
-       private static final int WEST_MIN_WIDTH = 250;
+       private static final int WEST_MIN_WIDTH = 100;
+       private static final int WEST_MAX_WIDTH = 400;
        private static final int WEST_MIN_HEIGHT = 500;
        private static final int SOUTH_MIN_WIDTH = 500;
        private static final int SOUTH_MIN_HEIGHT = 50;
        private static final int EAST_MIN_WIDTH = 100;
+       private static final int EAST_MAX_WIDTH = 500;
        private static final int EAST_MIN_HEIGHT = 100;
 
        /**
@@ -987,8 +990,15 @@
                                        Component panel = 
tabbedPane.getSelectedComponent();
                                        // Make sure we're not being notified 
that we've deleted
                                        // the last panel
-                                       if (panel != null)
-                                               
setMinimumSize(panel.getPreferredSize());
+                                       if (panel != null && cytoPanelContainer 
instanceof JSplitPane) {
+                                               int width = 
panel.getPreferredSize().width;
+                                               if (compassDirection == 
SwingConstants.WEST && width > WEST_MAX_WIDTH)
+                                                       width = WEST_MAX_WIDTH;
+                                               else if (compassDirection == 
SwingConstants.EAST && width > EAST_MAX_WIDTH)
+                                                       width = EAST_MAX_WIDTH;
+
+                                               
((JSplitPane)cytoPanelContainer).setDividerLocation(width);
+                                       }
                                
                                        int selectedIndex = 
tabbedPane.getSelectedIndex();
                                        
cytoPanelListener.onComponentSelected(selectedIndex);

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to