Reformatted these files to match our standards.

2005-11-16  Anthony Balkissoon  <[EMAIL PROTECTED]>

        * javax/swing/JSplitPane.java: Reformatted file.
        * javax/swing/plaf/basic/BasicSplitPaneUI.java: Reformatted file.

--Tony

Index: javax/swing/JSplitPane.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JSplitPane.java,v
retrieving revision 1.9
diff -u -r1.9 JSplitPane.java
--- javax/swing/JSplitPane.java	16 Nov 2005 21:48:24 -0000	1.9
+++ javax/swing/JSplitPane.java	16 Nov 2005 22:18:29 -0000
@@ -170,13 +170,15 @@
   public static final int HORIZONTAL_SPLIT = 1;
 
   /** The property fired when the last divider location property changes. */
-  public static final String LAST_DIVIDER_LOCATION_PROPERTY = "lastDividerLocation";
+  public static final String LAST_DIVIDER_LOCATION_PROPERTY = 
+    "lastDividerLocation";
 
   /** The constraints string used to add components to the left. */
   public static final String LEFT = "left";
 
   /** The property fired when the one touch expandable property changes. */
-  public static final String ONE_TOUCH_EXPANDABLE_PROPERTY = "oneTouchExpandable";
+  public static final String ONE_TOUCH_EXPANDABLE_PROPERTY = 
+    "oneTouchExpandable";
 
   /** The property fired when the orientation property changes. */
   public static final String ORIENTATION_PROPERTY = "orientation";
@@ -199,7 +201,8 @@
   /** Whether the JSplitPane uses one touch expandable buttons. */
   protected boolean oneTouchExpandable = false;
 
-  // This is the master dividerSize variable and sets the BasicSplitPaneDivider one accordingly
+  // This is the master dividerSize variable and sets the 
+  // BasicSplitPaneDivider one accordingly
 
   /** The size of the divider. */
   protected int dividerSize = 10;
@@ -301,7 +304,8 @@
    * @param constraints The constraints string to use.
    * @param index Where to place to component in the list of components.
    *
-   * @throws IllegalArgumentException When the constraints is not a known identifier.
+   * @throws IllegalArgumentException When the constraints is not a known 
+   * identifier.
    */
   protected void addImpl(Component comp, Object constraints, int index)
   {
@@ -311,34 +315,35 @@
     int place;
     if (constraints == null)
       {
-	if (leftComponent == null)
-	  constraints = LEFT;
-	else if (rightComponent == null)
-	  constraints = RIGHT;
+        if (leftComponent == null)
+          constraints = LEFT;
+        else if (rightComponent == null)
+          constraints = RIGHT;
       }
 
     if (constraints instanceof String)
       {
-	String placement = (String) constraints;
+        String placement = (String) constraints;
 
-	if (placement.equals(BOTTOM) || placement.equals(RIGHT))
-	  {
-	    if (rightComponent != null)
-		remove(rightComponent);
-	    rightComponent = comp;
-	  }
-	else if (placement.equals(LEFT) || placement.equals(TOP))
-	  {
-	    if (leftComponent != null)
-	      remove(leftComponent);
-	    leftComponent = comp;
-	  }
-	else if (placement.equals(DIVIDER))
-	  constraints = null;
-	else
-	  throw new IllegalArgumentException("Constraints is not a known identifier.");
+        if (placement.equals(BOTTOM) || placement.equals(RIGHT))
+          {
+            if (rightComponent != null)
+              remove(rightComponent);
+            rightComponent = comp;
+          }
+        else if (placement.equals(LEFT) || placement.equals(TOP))
+          {
+            if (leftComponent != null)
+              remove(leftComponent);
+            leftComponent = comp;
+          }
+        else if (placement.equals(DIVIDER))
+          constraints = null;
+        else
+          throw new 
+            IllegalArgumentException("Constraints is not a known identifier.");
 
-	super.addImpl(comp, constraints, index);
+        super.addImpl(comp, constraints, index);
       }
     invalidate();
     layout();
@@ -615,10 +620,10 @@
   {
     if (newContinuousLayout != continuousLayout)
       {
-	boolean oldValue = continuousLayout;
-	continuousLayout = newContinuousLayout;
-	firePropertyChange(CONTINUOUS_LAYOUT_PROPERTY, oldValue,
-	                   continuousLayout);
+        boolean oldValue = continuousLayout;
+        continuousLayout = newContinuousLayout;
+        firePropertyChange(CONTINUOUS_LAYOUT_PROPERTY, oldValue,
+                           continuousLayout);
       }
   }
 
@@ -635,7 +640,8 @@
   public void setDividerLocation(double proportionalLocation)
   {
     if (proportionalLocation > 1 || proportionalLocation < 0)
-      throw new IllegalArgumentException("proportion has to be between 0 and 1.");
+      throw new IllegalArgumentException
+        ("proportion has to be between 0 and 1.");
 
     int max = (orientation == HORIZONTAL_SPLIT) ? getWidth() : getHeight();
     setDividerLocation((int) (proportionalLocation * max));
@@ -650,9 +656,9 @@
   {
     if (ui != null && location != getDividerLocation())
       {
-	int oldLocation = getDividerLocation();
-	((SplitPaneUI) ui).setDividerLocation(this, location);
-	firePropertyChange(DIVIDER_LOCATION_PROPERTY, oldLocation, location);
+        int oldLocation = getDividerLocation();
+        ((SplitPaneUI) ui).setDividerLocation(this, location);
+        firePropertyChange(DIVIDER_LOCATION_PROPERTY, oldLocation, location);
       }
   }
 
@@ -665,9 +671,9 @@
   {
     if (newSize != dividerSize)
       {
-	int oldSize = dividerSize;
-	dividerSize = newSize;
-	firePropertyChange(DIVIDER_SIZE_PROPERTY, oldSize, dividerSize);
+        int oldSize = dividerSize;
+        dividerSize = newSize;
+        firePropertyChange(DIVIDER_SIZE_PROPERTY, oldSize, dividerSize);
       }
   }
 
@@ -684,10 +690,10 @@
   {
     if (newLastLocation != lastDividerLocation)
       {
-	int oldValue = lastDividerLocation;
-	lastDividerLocation = newLastLocation;
-	firePropertyChange(LAST_DIVIDER_LOCATION_PROPERTY, oldValue,
-	                   lastDividerLocation);
+        int oldValue = lastDividerLocation;
+        lastDividerLocation = newLastLocation;
+        firePropertyChange(LAST_DIVIDER_LOCATION_PROPERTY, oldValue,
+                           lastDividerLocation);
       }
   }
 
@@ -716,10 +722,10 @@
   {
     if (newValue != oneTouchExpandable)
       {
-	boolean oldValue = oneTouchExpandable;
-	oneTouchExpandable = newValue;
-	firePropertyChange(ONE_TOUCH_EXPANDABLE_PROPERTY, oldValue,
-	                   oneTouchExpandable);
+        boolean oldValue = oneTouchExpandable;
+        oneTouchExpandable = newValue;
+        firePropertyChange(ONE_TOUCH_EXPANDABLE_PROPERTY, oldValue,
+                           oneTouchExpandable);
       }
   }
 
@@ -733,13 +739,14 @@
   public void setOrientation(int orientation)
   {
     if (orientation != HORIZONTAL_SPLIT && orientation != VERTICAL_SPLIT)
-      throw new IllegalArgumentException("orientation must be one of VERTICAL_SPLIT, HORIZONTAL_SPLIT");
+      throw new IllegalArgumentException
+        ("orientation must be one of VERTICAL_SPLIT, HORIZONTAL_SPLIT");
     if (orientation != this.orientation)
       {
-	int oldOrientation = this.orientation;
-	this.orientation = orientation;
-	firePropertyChange(ORIENTATION_PROPERTY, oldOrientation,
-	                   this.orientation);
+        int oldOrientation = this.orientation;
+        this.orientation = orientation;
+        firePropertyChange(ORIENTATION_PROPERTY, oldOrientation,
+                           this.orientation);
       }
   }
 
Index: javax/swing/plaf/basic/BasicSplitPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java,v
retrieving revision 1.22
diff -u -r1.22 BasicSplitPaneUI.java
--- javax/swing/plaf/basic/BasicSplitPaneUI.java	16 Nov 2005 21:48:24 -0000	1.22
+++ javax/swing/plaf/basic/BasicSplitPaneUI.java	16 Nov 2005 22:18:29 -0000
@@ -126,14 +126,14 @@
     {
       int i = 0;
       if (place == null)
-	i = 2;
+        i = 2;
       else if (place.equals(JSplitPane.TOP) || place.equals(JSplitPane.LEFT))
-	i = 0;
+        i = 0;
       else if (place.equals(JSplitPane.BOTTOM)
                || place.equals(JSplitPane.RIGHT))
-	i = 1;
+        i = 1;
       else
-	throw new IllegalArgumentException("Illegal placement in JSplitPane");
+        throw new IllegalArgumentException("Illegal placement in JSplitPane");
       components[i] = component;
       resetSizeAt(i);
       splitPane.revalidate();
@@ -164,7 +164,7 @@
     protected int getInitialLocation(Insets insets)
     {
       if (insets != null)
-	return insets.left;
+        return insets.left;
       return 0;
     }
 
@@ -205,7 +205,7 @@
     {
       Dimension dims = c.getPreferredSize();
       if (dims != null)
-	return dims.width;
+        return dims.width;
       return 0;
     }
 
@@ -250,23 +250,23 @@
     {
       if (container instanceof JSplitPane)
         {
-	  JSplitPane split = (JSplitPane) container;
-	  distributeExtraSpace();
-	  Insets insets = split.getInsets();
-	  int width = getInitialLocation(insets);
-	  Dimension dims = split.getSize();
-	  for (int i = 0; i < components.length; i += 2)
-	    {
-	      if (components[i] == null)
-		continue;
-	      setComponentToSize(components[i], sizes[i], width, insets, dims);
-	      width += sizes[i];
-	    }
-	  if (components[1] != null)
-	    {
-	      setComponentToSize(components[1], sizes[1], width, insets, dims);
-	      width += sizes[1];
-	    }
+          JSplitPane split = (JSplitPane) container;
+          distributeExtraSpace();
+          Insets insets = split.getInsets();
+          int width = getInitialLocation(insets);
+          Dimension dims = split.getSize();
+          for (int i = 0; i < components.length; i += 2)
+            {
+              if (components[i] == null)
+                continue;
+              setComponentToSize(components[i], sizes[i], width, insets, dims);
+              width += sizes[i];
+            }
+          if (components[1] != null)
+            {
+              setComponentToSize(components[1], sizes[1], width, insets, dims);
+              width += sizes[1];
+            }
         }
     }
 
@@ -297,23 +297,23 @@
     {
       if (target instanceof JSplitPane)
         {
-	  JSplitPane split = (JSplitPane) target;
-	  Insets insets = target.getInsets();
+          JSplitPane split = (JSplitPane) target;
+          Insets insets = target.getInsets();
 
-	  int height = 0;
-	  int width = 0;
-	  for (int i = 0; i < components.length; i++)
-	    {
-	      if (components[i] == null)
-		continue;
-	      Dimension dims = components[i].getMinimumSize();
-	      if (dims != null)
-	        {
-		  width += dims.width;
-		  height = Math.max(height, dims.height);
-	        }
-	    }
-	  return new Dimension(width, height);
+          int height = 0;
+          int width = 0;
+          for (int i = 0; i < components.length; i++)
+            {
+              if (components[i] == null)
+                continue;
+              Dimension dims = components[i].getMinimumSize();
+              if (dims != null)
+                {
+                  width += dims.width;
+                  height = Math.max(height, dims.height);
+                }
+            }
+          return new Dimension(width, height);
         }
       return null;
     }
@@ -331,24 +331,24 @@
     {
       if (target instanceof JSplitPane)
         {
-	  JSplitPane split = (JSplitPane) target;
-	  Insets insets = target.getInsets();
+          JSplitPane split = (JSplitPane) target;
+          Insets insets = target.getInsets();
 
-	  int height = 0;
-	  int width = 0;
-	  for (int i = 0; i < components.length; i++)
-	    {
-	      if (components[i] == null)
-		continue;
-	      Dimension dims = components[i].getPreferredSize();
-	      if (dims != null)
-	        {
-		  width += dims.width;
-		  if (! (components[i] instanceof BasicSplitPaneDivider))
-		    height = Math.max(height, dims.height);
-	        }
-	    }
-	  return new Dimension(width, height);	
+          int height = 0;
+          int width = 0;
+          for (int i = 0; i < components.length; i++)
+            {
+              if (components[i] == null)
+                continue;
+              Dimension dims = components[i].getPreferredSize();
+              if (dims != null)
+                {
+                  width += dims.width;
+                  if (!(components[i] instanceof BasicSplitPaneDivider))
+                    height = Math.max(height, dims.height);
+                }
+            }
+          return new Dimension(width, height);
         }
       return null;
     }
@@ -362,11 +362,11 @@
     {
       for (int i = 0; i < components.length; i++)
         {
-	  if (component == components[i])
-	    {
-	      components[i] = null;
-	      sizes[i] = 0;
-	    }
+          if (component == components[i])
+            {
+              components[i] = null;
+              sizes[i] = 0;
+            }
         }
     }
 
@@ -378,7 +378,7 @@
     protected void resetSizeAt(int index)
     {
       if (components[index] != null)
-	sizes[index] = getPreferredSizeOfComponent(components[index]);
+        sizes[index] = getPreferredSizeOfComponent(components[index]);
     }
 
     /**
@@ -387,7 +387,7 @@
     public void resetToPreferredSizes()
     {
       for (int i = 0; i < components.length; i++)
-	resetSizeAt(i);
+        resetSizeAt(i);
     }
 
     /**
@@ -433,13 +433,13 @@
 
       if (left != null)
         {
-	  components[0] = left;
-	  resetSizeAt(0);
+          components[0] = left;
+          resetSizeAt(0);
         }
       if (right != null)
         {
-	  components[1] = right;
-	  resetSizeAt(1);
+          components[1] = right;
+          resetSizeAt(1);
         }
       components[2] = divider;
       resetSizeAt(2);
@@ -480,9 +480,9 @@
     {
       Dimension dims = components[index].getMinimumSize();
       if (dims != null)
-	return dims.width;
+        return dims.width;
       else
-	return 0;
+        return 0;
     }
   } //end BasicHorizontalLayoutManager
 
@@ -534,7 +534,7 @@
     {
       Dimension dims = c.getPreferredSize();
       if (dims != null)
-	return dims.height;
+        return dims.height;
       return 0;
     }
 
@@ -563,23 +563,23 @@
     {
       if (container instanceof JSplitPane)
         {
-	  JSplitPane split = (JSplitPane) container;
-	  Insets insets = container.getInsets();
+          JSplitPane split = (JSplitPane) container;
+          Insets insets = container.getInsets();
 
-	  int height = 0;
-	  int width = 0;
-	  for (int i = 0; i < components.length; i++)
-	    {
-	      if (components[i] == null)
-		continue;
-	      Dimension dims = components[i].getMinimumSize();
-	      if (dims != null)
-	        {
-		  height += dims.height;
-		  width = Math.max(width, dims.width);
-	        }
-	    }
-	  return new Dimension(width, height);
+          int height = 0;
+          int width = 0;
+          for (int i = 0; i < components.length; i++)
+            {
+              if (components[i] == null)
+                continue;
+              Dimension dims = components[i].getMinimumSize();
+              if (dims != null)
+                {
+                  height += dims.height;
+                  width = Math.max(width, dims.width);
+                }
+            }
+          return new Dimension(width, height);
         }
       return null;
     }
@@ -597,23 +597,23 @@
     {
       if (container instanceof JSplitPane)
         {
-	  JSplitPane split = (JSplitPane) container;
-	  Insets insets = container.getInsets();
+          JSplitPane split = (JSplitPane) container;
+          Insets insets = container.getInsets();
 
-	  int height = 0;
-	  int width = 0;
-	  for (int i = 0; i < components.length; i++)
-	    {
-	      if (components[i] == null)
-		continue;
-	      Dimension dims = components[i].getPreferredSize();
-	      if (dims != null)
-	        {
-		  height += dims.height;
-		  width = Math.max(width, dims.width);
-	        }
-	    }
-	  return new Dimension(width, height);
+          int height = 0;
+          int width = 0;
+          for (int i = 0; i < components.length; i++)
+            {
+              if (components[i] == null)
+                continue;
+              Dimension dims = components[i].getPreferredSize();
+              if (dims != null)
+                {
+                  height += dims.height;
+                  width = Math.max(width, dims.width);
+                }
+            }
+          return new Dimension(width, height);
         }
       return null;
     }
@@ -652,9 +652,9 @@
     {
       Dimension dims = components[index].getMinimumSize();
       if (dims != null)
-	return dims.height;
+        return dims.height;
       else
-	return 0;
+        return 0;
     }
   }
 
@@ -813,27 +813,27 @@
     {
       if (e.getPropertyName().equals(JSplitPane.DIVIDER_SIZE_PROPERTY))
         {
-	  int newSize = splitPane.getDividerSize();
-	  int[] tmpSizes = layoutManager.getSizes();
-	  dividerSize = tmpSizes[2];
-      int newSpace = newSize - tmpSizes[2];
-	  tmpSizes[2] = newSize;
+          int newSize = splitPane.getDividerSize();
+          int[] tmpSizes = layoutManager.getSizes();
+          dividerSize = tmpSizes[2];
+          int newSpace = newSize - tmpSizes[2];
+          tmpSizes[2] = newSize;
 
-	  tmpSizes[0] += newSpace / 2;
-	  tmpSizes[1] += newSpace / 2;
+          tmpSizes[0] += newSpace / 2;
+          tmpSizes[1] += newSpace / 2;
       
-	  layoutManager.setSizes(tmpSizes);
+          layoutManager.setSizes(tmpSizes);
         }
       else if (e.getPropertyName().equals(JSplitPane.ORIENTATION_PROPERTY))
         {
-	  int max = layoutManager.getAvailableSize(splitPane.getSize(),
-	                                           splitPane.getInsets());
-	  int dividerLoc = getDividerLocation(splitPane);
-	  double prop = ((double) dividerLoc) / max;
-
-	  resetLayoutManager();
-	  if (prop <= 1 && prop >= 0)
-	    splitPane.setDividerLocation(prop);
+          int max = layoutManager.getAvailableSize(splitPane.getSize(),
+                                                   splitPane.getInsets());
+          int dividerLoc = getDividerLocation(splitPane);
+          double prop = ((double) dividerLoc) / max;
+
+          resetLayoutManager();
+          if (prop <= 1 && prop >= 0)
+            splitPane.setDividerLocation(prop);
         }
       layoutManager.layoutContainer(splitPane);
       splitPane.repaint();
@@ -843,13 +843,13 @@
       // Don't have to deal with resize_weight (as there
       // will be no extra space associated with this
       // event - the changes to the weighting will
-      // be taken into account the next time the 
+      // be taken into account the next time the
       // sizes change.)
-      // Don't have to deal with divider_location 
+      // Don't have to deal with divider_location
       // The method in JSplitPane calls our setDividerLocation
       // so we'll know about those anyway.
       // Don't have to deal with last_divider_location
-      // Although I'm not sure why, it doesn't seem to 
+      // Although I'm not sure why, it doesn't seem to
       // have any effect on Sun's JSplitPane.
       // one_touch_expandable changes are dealt with
       // by our divider.
@@ -962,10 +962,10 @@
   {
     if (c instanceof JSplitPane)
       {
-	splitPane = (JSplitPane) c;
-	installDefaults();
-	installListeners();
-	installKeyboardActions();
+        splitPane = (JSplitPane) c;
+        installDefaults();
+        installListeners();
+        installKeyboardActions();
       }
   }
 
@@ -1218,8 +1218,8 @@
   {
     if (nonContinuousLayoutDivider == null)
       {
-	nonContinuousLayoutDivider = new Canvas();
-	nonContinuousLayoutDivider.setBackground(Color.DARK_GRAY);
+        nonContinuousLayoutDivider = new Canvas();
+        nonContinuousLayoutDivider.setBackground(Color.DARK_GRAY);
       }
     return nonContinuousLayoutDivider;
   }
@@ -1307,7 +1307,7 @@
     // check if the size has been set for the splitpane
     if (size.width == 0 && size.height == 0)
       size = jc.getPreferredSize();
-    
+
     if (getOrientation() == 0 && location > size.height)
       {
         location = size.height;
@@ -1326,11 +1326,11 @@
             p = p.getParent();
           }
       }
-    
+
     setLastDragLocation(getDividerLocation(splitPane));
     splitPane.setLastDividerLocation(getDividerLocation(splitPane));
     int[] tmpSizes = layoutManager.getSizes();
-    tmpSizes[0] = location 
+    tmpSizes[0] = location
                   - layoutManager.getInitialLocation(splitPane.getInsets());
     tmpSizes[1] = layoutManager.getAvailableSize(splitPane.getSize(),
                                                  splitPane.getInsets())
@@ -1498,8 +1498,8 @@
       nonContinuousLayoutDivider.setVisible(false);
     else
       {
-	nonContinuousLayoutDivider.setVisible(true);
-	nonContinuousLayoutDivider.setBounds(divider.getBounds());
+        nonContinuousLayoutDivider.setVisible(true);
+        nonContinuousLayoutDivider.setBounds(divider.getBounds());
       }
     splitPane.revalidate();
     splitPane.repaint();
@@ -1522,12 +1522,12 @@
       splitPane.setDividerLocation(location);
     else
       {
-	Point p = nonContinuousLayoutDivider.getLocation();
-	if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT)
-	  p.x = location;
-	else
-	  p.y = location;
-	nonContinuousLayoutDivider.setLocation(p);
+        Point p = nonContinuousLayoutDivider.getLocation();
+        if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT)
+          p.x = location;
+        else
+          p.y = location;
+        nonContinuousLayoutDivider.setLocation(p);
       }
     setLastDragLocation(location);
     splitPane.repaint();
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to