This patch (committed) fixes a few deviations from our coding style (pointed out by Checkstyle) in the javax.swing.tree.* package:

2006-05-23  David Gilbert  <[EMAIL PROTECTED]>

        * javax/swing/tree/AbstractLayoutCache.java: Coding style fixes,
        * javax/swing/tree/DefaultMutableTreeNode.java: Likewise,
        * javax/swing/tree/DefaultTreeCellRenderer.java: Likewise,
        * javax/swing/tree/DefaultTreeModel.java: Likewise,
        * javax/swing/tree/DefaultTreeSelectionModel.java: Likewise,
        * javax/swing/tree/ExpandVetoException.java: Likewise,
        * javax/swing/tree/FixedHeightLayoutCache.java: Likewise,
        * javax/swing/tree/RowMapper.java: Likewise,
        * javax/swing/tree/TreeNode.java: Likewise,
        * javax/swing/tree/TreeSelectionModel.java: Likewise,
        * javax/swing/tree/VariableHeightLayoutCache.java: Likewise.

Regards,

Dave
Index: javax/swing/tree/AbstractLayoutCache.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/tree/AbstractLayoutCache.java,v
retrieving revision 1.11
diff -u -r1.11 AbstractLayoutCache.java
--- javax/swing/tree/AbstractLayoutCache.java   21 Apr 2006 10:13:12 -0000      
1.11
+++ javax/swing/tree/AbstractLayoutCache.java   23 May 2006 15:53:44 -0000
@@ -1,5 +1,5 @@
 /* AbstractLayoutCache.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,13 +38,10 @@
 
 package javax.swing.tree;
 
-import gnu.classpath.NotImplementedException;
-
 import java.awt.Rectangle;
 import java.util.Enumeration;
 
 import javax.swing.event.TreeModelEvent;
-import javax.swing.tree.VariableHeightLayoutCache.NodeRecord;
 
 /**
  * class AbstractLayoutCache
@@ -275,7 +272,7 @@
     for (int i = 0; i < n; i++)
       {
         TreePath path = getPathForRow(i);
-        r.setBounds(0,0,0,0);        
+        r.setBounds(0, 0, 0, 0);        
         r = getBounds(path, r);
         if (r.x + r.width > maximalWidth)
           maximalWidth = r.x + r.width;
Index: javax/swing/tree/DefaultMutableTreeNode.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/tree/DefaultMutableTreeNode.java,v
retrieving revision 1.16
diff -u -r1.16 DefaultMutableTreeNode.java
--- javax/swing/tree/DefaultMutableTreeNode.java        26 Apr 2006 09:03:10 
-0000      1.16
+++ javax/swing/tree/DefaultMutableTreeNode.java        23 May 2006 15:53:45 
-0000
@@ -887,8 +887,7 @@
       return false;
     if (node == this)
       return true;
-    return (node.getParent() == getParent()
-            && getParent() != null);
+    return node.getParent() == getParent() && getParent() != null;
   }
 
   /**
@@ -1070,7 +1069,7 @@
 
       public Object nextElement()
       {
-          if(queue.isEmpty())
+          if (queue.isEmpty())
               throw new NoSuchElementException("No more elements left.");
 
           TreeNode node = (TreeNode) queue.removeFirst();
@@ -1105,7 +1104,7 @@
 
       public Object nextElement()
       {
-          if( next == null )
+          if (next == null)
               throw new NoSuchElementException("No more elements left.");
 
           Object current = next;
@@ -1121,7 +1120,7 @@
       private TreeNode traverse(Enumeration children)
       {
           // If more children are available step down.
-          if( children.hasMoreElements() )
+          if (children.hasMoreElements())
           {
               TreeNode child = (TreeNode) children.nextElement();
               childrenEnums.push(child.children());
@@ -1134,7 +1133,7 @@
 
           // If there are no more levels left, there is no next
           // element to return.
-          if ( childrenEnums.isEmpty() )
+          if (childrenEnums.isEmpty())
               return null;
           else
           {
@@ -1165,7 +1164,7 @@
 
        public Object nextElement()
        {
-           if( nodes.isEmpty() )
+           if (nodes.isEmpty())
                throw new NoSuchElementException("No more elements left!");
 
            Enumeration children = (Enumeration) childrenEnums.peek();
@@ -1175,7 +1174,7 @@
 
        private Object traverse(Enumeration children)
        {
-           if ( children.hasMoreElements() )
+           if (children.hasMoreElements())
            {
                TreeNode node = (TreeNode) children.nextElement();
                nodes.push(node);
Index: javax/swing/tree/DefaultTreeCellRenderer.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/tree/DefaultTreeCellRenderer.java,v
retrieving revision 1.25
diff -u -r1.25 DefaultTreeCellRenderer.java
--- javax/swing/tree/DefaultTreeCellRenderer.java       23 May 2006 15:27:19 
-0000      1.25
+++ javax/swing/tree/DefaultTreeCellRenderer.java       23 May 2006 15:53:46 
-0000
@@ -510,7 +510,7 @@
       insets = border.getBorderInsets(this);
 
     FontMetrics fm = getToolkit().getFontMetrics(getFont());
-    SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(),
+    SwingUtilities.layoutCompoundLabel((JLabel) this, fm, getText(),
                                        getIcon(), getVerticalAlignment(),
                                        getHorizontalAlignment(),
                                        getVerticalTextPosition(),
@@ -521,7 +521,7 @@
     Rectangle bounds = getBounds(ir);
     
     bounds.x = tr.x - insets.left;
-    bounds.width = tr.width + insets.left+insets.right;
+    bounds.width = tr.width + insets.left + insets.right;
     
     g.setColor(super.getBackground());
     g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
@@ -552,7 +552,7 @@
     Rectangle tr = new Rectangle();
 
     FontMetrics fm = getToolkit().getFontMetrics(getFont());
-    SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(),
+    SwingUtilities.layoutCompoundLabel((JLabel) this, fm, getText(),
                                        getIcon(), getVerticalAlignment(),
                                        getHorizontalAlignment(),
                                        getVerticalTextPosition(),
Index: javax/swing/tree/DefaultTreeModel.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/tree/DefaultTreeModel.java,v
retrieving revision 1.22
diff -u -r1.22 DefaultTreeModel.java
--- javax/swing/tree/DefaultTreeModel.java      2 May 2006 20:31:08 -0000       
1.22
+++ javax/swing/tree/DefaultTreeModel.java      23 May 2006 15:53:47 -0000
@@ -1,5 +1,5 @@
 /* DefaultTreeModel.java -- 
-   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
  
 This file is part of GNU Classpath.
 
@@ -37,8 +37,6 @@
 
 package javax.swing.tree;
 
-import gnu.classpath.NotImplementedException;
-
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
@@ -62,7 +60,7 @@
   /**
    * root
    */
-  protected TreeNode root = null;
+  protected TreeNode root;
 
   /**
    * listenerList
Index: javax/swing/tree/DefaultTreeSelectionModel.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/tree/DefaultTreeSelectionModel.java,v
retrieving revision 1.31
diff -u -r1.31 DefaultTreeSelectionModel.java
--- javax/swing/tree/DefaultTreeSelectionModel.java     13 May 2006 10:10:42 
-0000      1.31
+++ javax/swing/tree/DefaultTreeSelectionModel.java     23 May 2006 15:53:48 
-0000
@@ -147,9 +147,9 @@
     
     // Clone the selection and the list selection model.
     cloned.selection = (TreePath[]) selection.clone();
-    if (listSelectionModel!=null)
-      cloned.listSelectionModel = 
-        (DefaultListSelectionModel) listSelectionModel.clone();
+    if (listSelectionModel != null)
+      cloned.listSelectionModel 
+        = (DefaultListSelectionModel) listSelectionModel.clone();
     return cloned;
   }
 
@@ -171,7 +171,7 @@
             b.append(getRow(selection[i]));
             b.append(' ');
           }
-        b.append(", lead "+getLeadSelectionRow());
+        b.append(", lead " + getLeadSelectionRow());
         return b.toString();
       }
   }
@@ -360,7 +360,7 @@
           }
       }
     
-     if (path!=leadPath)
+     if (path != leadPath)
        {
         TreePath oldLead = leadPath;
         leadPath = path;
@@ -445,7 +445,7 @@
         
         // If the removed path was the lead path, set the lead path to null.
         TreePath oldLead = leadPath;
-        if (path!=null && leadPath!=null && path.equals(leadPath))
+        if (path != null && leadPath != null && path.equals(leadPath))
           leadPath = null;
 
         fireValueChanged(new TreeSelectionEvent(this, path, false, oldLead,
@@ -564,7 +564,7 @@
    */
   public boolean isSelectionEmpty()
   {
-    return ((selection == null) || (selection.length == 0));
+    return (selection == null) || (selection.length == 0);
   }
 
   /**
@@ -841,7 +841,7 @@
     if (leadIndex > 0 && leadIndex < selection.length)
       setSelectionPath(selection[leadIndex]);
     else
-      setSelectionPath(selection[selection.length -1]);
+      setSelectionPath(selection[selection.length - 1]);
   }
   
   /**
@@ -882,7 +882,7 @@
 
     for (int i = 1; i < rows.length; i++)
       {
-        if (rows[i-1] != rows[i] - 1)
+        if (rows[i - 1] != rows[i] - 1)
           return false;
       }
     return true;
Index: javax/swing/tree/ExpandVetoException.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/tree/ExpandVetoException.java,v
retrieving revision 1.2
diff -u -r1.2 ExpandVetoException.java
--- javax/swing/tree/ExpandVetoException.java   2 Jul 2005 20:32:52 -0000       
1.2
+++ javax/swing/tree/ExpandVetoException.java   23 May 2006 15:53:48 -0000
@@ -1,5 +1,5 @@
 /* ExpandVetoException.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -37,47 +37,40 @@
 
 package javax.swing.tree;
 
-// Imports
 import javax.swing.event.TreeExpansionEvent;
 
 /**
  * ExpandVetoException
  * @author Andrew Selkirk
  */
-public class ExpandVetoException extends Exception {
+public class ExpandVetoException extends Exception 
+{
 
-       //-------------------------------------------------------------
-       // Variables --------------------------------------------------
-       //-------------------------------------------------------------
-       
-       /**
-        * event
-        */
-       protected TreeExpansionEvent    event   = null;
-
-
-       //-------------------------------------------------------------
-       // Initialization ---------------------------------------------
-       //-------------------------------------------------------------
-
-       /**
-        * Constructor ExpandVetoException
-        * @param event Tree Expansion Event
-        */
-       public ExpandVetoException(TreeExpansionEvent event) {
-               super();
-               this.event = event;
-       } // ExpandVetoException()
-
-       /**
-        * Constructor ExpandVetoException
-        * @param event Tree Expansion Event
-        * @param message Message
-        */
-       public ExpandVetoException(TreeExpansionEvent event, String message) {
-               super(message);
-               this.event = event;
-       } // ExpandVetoException()
+  /**
+   * event
+   */
+  protected TreeExpansionEvent event;
+
+
+  /**
+   * Constructor ExpandVetoException
+   * @param event Tree Expansion Event
+   */
+  public ExpandVetoException(TreeExpansionEvent event) 
+  {
+    super();
+    this.event = event;
+  } 
+
+  /**
+   * Constructor ExpandVetoException
+   * @param event Tree Expansion Event
+   * @param message Message
+   */
+  public ExpandVetoException(TreeExpansionEvent event, String message) 
+  {
+    super(message);
+    this.event = event;
+  } 
 
-
-} // ExpandVetoException
+} 
Index: javax/swing/tree/FixedHeightLayoutCache.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/tree/FixedHeightLayoutCache.java,v
retrieving revision 1.16
diff -u -r1.16 FixedHeightLayoutCache.java
--- javax/swing/tree/FixedHeightLayoutCache.java        27 Apr 2006 08:23:45 
-0000      1.16
+++ javax/swing/tree/FixedHeightLayoutCache.java        23 May 2006 15:53:48 
-0000
@@ -163,7 +163,7 @@
     {
       // This method may be called in the context when the tree rectangle is
       // not known. To work around this, it is assumed near infinitely large.
-      if (bounds==null)
+      if (bounds == null)
         bounds = getNodeDimensions(node, row, depth, isExpanded, 
                                    new Rectangle());
       return bounds;      
@@ -266,7 +266,7 @@
     if (expanded.contains(node))
       {
         int sc = treeModel.getChildCount(node);
-        int deeper = depth+1;
+        int deeper = depth + 1;
         for (int i = 0; i < sc; i++)
           {
             Object child = treeModel.getChild(node, i);
@@ -283,7 +283,7 @@
   public void invalidatePathBounds(TreePath path)
   {
     NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent());
-    if (r!=null)
+    if (r != null)
       r.bounds = null;
   } 
 
Index: javax/swing/tree/RowMapper.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/tree/RowMapper.java,v
retrieving revision 1.3
diff -u -r1.3 RowMapper.java
--- javax/swing/tree/RowMapper.java     2 Jul 2005 20:32:52 -0000       1.3
+++ javax/swing/tree/RowMapper.java     23 May 2006 15:53:48 -0000
@@ -1,5 +1,5 @@
 /* RowMapper.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,14 +41,14 @@
  * RowMapper public interface
  * @author Andrew Selkirk
  */
-public interface RowMapper {
+public interface RowMapper 
+{
 
-       /**
-        * getRowsForPaths
-        * @param path TreePath
-        * @return TODO
-        */
-       int[] getRowsForPaths(TreePath[] path);
+  /**
+   * getRowsForPaths
+   * @param path TreePath
+   * @return TODO
+   */
+  int[] getRowsForPaths(TreePath[] path);
 
-
-} // RowMapper
+} 
\ No newline at end of file
Index: javax/swing/tree/TreeNode.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/tree/TreeNode.java,v
retrieving revision 1.7
diff -u -r1.7 TreeNode.java
--- javax/swing/tree/TreeNode.java      14 Mar 2006 10:41:22 -0000      1.7
+++ javax/swing/tree/TreeNode.java      23 May 2006 15:53:50 -0000
@@ -45,7 +45,8 @@
  * 
  * @author Andrew Selkirk
  */
-public interface TreeNode {
+public interface TreeNode 
+{
 
   /**
    * Returns the parent node for this tree node, or <code>null</code> if this
Index: javax/swing/tree/TreeSelectionModel.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/tree/TreeSelectionModel.java,v
retrieving revision 1.5
diff -u -r1.5 TreeSelectionModel.java
--- javax/swing/tree/TreeSelectionModel.java    2 Jul 2005 20:32:52 -0000       
1.5
+++ javax/swing/tree/TreeSelectionModel.java    23 May 2006 15:53:50 -0000
@@ -1,5 +1,5 @@
 /* TreeSelectionModel.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -46,39 +46,67 @@
  * TreeSelectionModel public interface
  * @author Andrew Selkirk
  */
-public interface TreeSelectionModel {
+public interface TreeSelectionModel 
+{
 
-       int SINGLE_TREE_SELECTION                       = 1;
-       int CONTIGUOUS_TREE_SELECTION           = 2;
-       int DISCONTIGUOUS_TREE_SELECTION        = 4;
-
-       void setSelectionMode(int mode);
-       int getSelectionMode();
-       void setSelectionPath(TreePath path);
-       void setSelectionPaths(TreePath[] paths);
-       void addSelectionPath(TreePath path);
-       void addSelectionPaths(TreePath[] paths);
-       void removeSelectionPath(TreePath path);
-       void removeSelectionPaths(TreePath[] paths);
-       TreePath getSelectionPath();
-       TreePath[] getSelectionPaths();
-       int getSelectionCount();
-       boolean isPathSelected(TreePath path);
-       boolean isSelectionEmpty();
-       void clearSelection();
-       void setRowMapper(RowMapper newMapper);
-       RowMapper getRowMapper();
-       int[] getSelectionRows();
-       int getMinSelectionRow();
-       int getMaxSelectionRow();
-       boolean isRowSelected(int row);
-       void resetRowSelection();
-       int getLeadSelectionRow();
-       TreePath getLeadSelectionPath();
-       void addPropertyChangeListener(PropertyChangeListener listener);
-       void removePropertyChangeListener(PropertyChangeListener listener);
-       void addTreeSelectionListener(TreeSelectionListener x);
-       void removeTreeSelectionListener(TreeSelectionListener x);
+  int SINGLE_TREE_SELECTION = 1;
 
+  int CONTIGUOUS_TREE_SELECTION = 2;
 
-} // TreeSelectionModel
+  int DISCONTIGUOUS_TREE_SELECTION = 4;
+
+  void setSelectionMode(int mode);
+
+  int getSelectionMode();
+
+  void setSelectionPath(TreePath path);
+
+  void setSelectionPaths(TreePath[] paths);
+
+  void addSelectionPath(TreePath path);
+
+  void addSelectionPaths(TreePath[] paths);
+
+  void removeSelectionPath(TreePath path);
+
+  void removeSelectionPaths(TreePath[] paths);
+
+  TreePath getSelectionPath();
+
+  TreePath[] getSelectionPaths();
+
+  int getSelectionCount();
+
+  boolean isPathSelected(TreePath path);
+
+  boolean isSelectionEmpty();
+
+  void clearSelection();
+
+  void setRowMapper(RowMapper newMapper);
+
+  RowMapper getRowMapper();
+
+  int[] getSelectionRows();
+
+  int getMinSelectionRow();
+
+  int getMaxSelectionRow();
+
+  boolean isRowSelected(int row);
+
+  void resetRowSelection();
+
+  int getLeadSelectionRow();
+
+  TreePath getLeadSelectionPath();
+
+  void addPropertyChangeListener(PropertyChangeListener listener);
+
+  void removePropertyChangeListener(PropertyChangeListener listener);
+
+  void addTreeSelectionListener(TreeSelectionListener x);
+
+  void removeTreeSelectionListener(TreeSelectionListener x);
+
+}
Index: javax/swing/tree/VariableHeightLayoutCache.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/tree/VariableHeightLayoutCache.java,v
retrieving revision 1.14
diff -u -r1.14 VariableHeightLayoutCache.java
--- javax/swing/tree/VariableHeightLayoutCache.java     27 Apr 2006 08:23:45 
-0000      1.14
+++ javax/swing/tree/VariableHeightLayoutCache.java     23 May 2006 15:53:50 
-0000
@@ -162,7 +162,7 @@
     {
       // This method may be called in the context when the tree rectangle is
       // not known. To work around this, it is assumed near infinitely large.
-      if (bounds==null)
+      if (bounds == null)
         bounds = getNodeDimensions(node, row, depth, isExpanded, 
                                    new Rectangle());
       return bounds;      
@@ -265,7 +265,7 @@
     if (expanded.contains(node))
       {
         int sc = treeModel.getChildCount(node);
-        int deeper = depth+1;
+        int deeper = depth + 1;
         for (int i = 0; i < sc; i++)
           {
             Object child = treeModel.getChild(node, i);
@@ -282,7 +282,7 @@
   public void invalidatePathBounds(TreePath path)
   {
     NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent());
-    if (r!=null)
+    if (r != null)
       r.bounds = null;
   } 
 

Reply via email to