harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r478753 [2/3] - in /harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing: JComboBox.java JMenu.java JMenuBar.java JSpinner.java JTabbedPane.java JTree.java ProgressMonitor.java
Date Fri, 24 Nov 2006 02:41:16 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTabbedPane.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTabbedPane.java?view=diff&rev=478753&r1=478752&r2=478753
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTabbedPane.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTabbedPane.java Thu Nov 23 18:41:15 2006
@@ -15,113 +15,124 @@
  *  limitations under the License.
  */
 
-/**
- * @author Vadim Bogdanov
- * @version $Revision$
- */
-
 package javax.swing;
 
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Point;
 import java.awt.Rectangle;
-
 import java.awt.event.InputEvent;
 import java.awt.event.MouseEvent;
-
 import java.io.Serializable;
 import java.util.Vector;
-
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleSelection;
-
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
-
 import javax.swing.plaf.TabbedPaneUI;
 import javax.swing.plaf.UIResource;
-
+import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.x.swing.StringConstants;
 
-public class JTabbedPane extends JComponent
-    implements Serializable, Accessible, SwingConstants {
+/**
+ * <p>
+ * <i>JTabbedPane</i>
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as guarantee of serialization compatibility.</li>
+ * </ul>
+ */
+public class JTabbedPane extends JComponent implements Serializable, Accessible, SwingConstants {
+    private static final long serialVersionUID = 1671634173365704280L;
 
     // TODO: implement
-    protected class AccessibleJTabbedPane extends AccessibleJComponent
-            implements AccessibleSelection, ChangeListener {
+    protected class AccessibleJTabbedPane extends AccessibleJComponent implements
+            AccessibleSelection, ChangeListener {
+        private static final long serialVersionUID = 8645220594633986096L;
 
         public AccessibleJTabbedPane() {
         }
 
-        public void addAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void addAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public void clearAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
-        public Accessible getAccessibleAt(final Point p) {
-            throw new UnsupportedOperationException("Not implemented");
+        @Override
+        public Accessible getAccessibleAt(Point p) {
+            throw new NotImplementedException();
         }
 
-        public Accessible getAccessibleChild(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        @Override
+        public Accessible getAccessibleChild(int i) {
+            throw new NotImplementedException();
         }
 
+        @Override
         public int getAccessibleChildrenCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
+        @Override
         public AccessibleSelection getAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
-        public Accessible getAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public Accessible getAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public int getAccessibleSelectionCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
-        public boolean isAccessibleChildSelected(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public boolean isAccessibleChildSelected(int i) {
+            throw new NotImplementedException();
         }
 
-        public void removeAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void removeAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public void selectAllAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
-        public void stateChanged(final ChangeEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void stateChanged(ChangeEvent e) {
+            throw new NotImplementedException();
         }
     }
 
     protected class ModelListener implements ChangeListener, Serializable {
-        public void stateChanged(final ChangeEvent e) {
+        private static final long serialVersionUID = 1L;
+
+        public void stateChanged(ChangeEvent e) {
             fireStateChanged();
         }
     }
 
     private class JTabInfo extends AbstractButton {
+        private static final long serialVersionUID = 1L;
+
         private Component comp;
+
         private boolean enabled = true;
+
         private Icon disabledIcon;
 
-        public JTabInfo(final String title, final Icon icon,
-                 final Component comp, final String tip) {
+        public JTabInfo(String title, Icon icon, Component comp, String tip) {
             setModel(new DefaultButtonModel());
             setText(title);
             setIcon(icon);
@@ -132,7 +143,7 @@
             setMnemonic(-1);
         }
 
-        public void setComp(final Component comp) {
+        public void setComp(Component comp) {
             this.comp = comp;
         }
 
@@ -140,18 +151,22 @@
             return comp;
         }
 
+        @Override
         public boolean isEnabled() {
             return enabled;
         }
 
-        public void setEnabled(final boolean enabled) {
+        @Override
+        public void setEnabled(boolean enabled) {
             this.enabled = enabled;
         }
 
-        public void setDisabledIcon(final Icon icon) {
+        @Override
+        public void setDisabledIcon(Icon icon) {
             disabledIcon = icon;
         }
 
+        @Override
         public Icon getDisabledIcon() {
             return disabledIcon;
         }
@@ -170,22 +185,22 @@
     protected int tabPlacement = TOP;
 
     private int tabLayoutPolicy = WRAP_TAB_LAYOUT;
-    private Vector tabInfos = new Vector(2);
+
+    private Vector<JTabInfo> tabInfos = new Vector<JTabInfo>(2);
 
     public JTabbedPane() {
         this(TOP, WRAP_TAB_LAYOUT);
     }
 
-    public JTabbedPane(final int tabPlacement) {
+    public JTabbedPane(int tabPlacement) {
         this(tabPlacement, WRAP_TAB_LAYOUT);
     }
 
-    public JTabbedPane(final int tabPlacement, final int tabLayoutPolicy) {
+    public JTabbedPane(int tabPlacement, int tabLayoutPolicy) {
         setModel(new DefaultSingleSelectionModel());
         setTabPlacement(tabPlacement);
         setTabLayoutPolicy(tabLayoutPolicy);
         ToolTipManager.sharedInstance().registerComponent(this);
-
         updateUI();
     }
 
@@ -194,7 +209,8 @@
      * it is added to the tabbed pane without creating a new tab. It can be
      * used in UI's to add custom components.
      */
-    public Component add(final Component component) {
+    @Override
+    public Component add(Component component) {
         if (component instanceof UIResource) {
             addImpl(component, null, -1);
         } else {
@@ -203,60 +219,59 @@
         return component;
     }
 
-    public Component add(final Component component, final int index) {
+    @Override
+    public Component add(Component component, int index) {
         insertTab(component.getName(), null, component, null, index);
         return component;
     }
 
-    public void add(final Component component, final Object constraints) {
+    @Override
+    public void add(Component component, Object constraints) {
         add(component, constraints, getTabCount());
     }
 
-    public void add(final Component component,
-                    final Object constraints,
-                    final int index) {
+    @Override
+    public void add(Component component, Object constraints, int index) {
         Icon icon = null;
         String title = null;
         if (constraints instanceof Icon) {
-            icon = (Icon)constraints;
+            icon = (Icon) constraints;
         } else if (constraints instanceof String) {
-            title = (String)constraints;
+            title = (String) constraints;
         } else {
             title = component.getName();
         }
-
         insertTab(title, icon, component, null, index);
     }
 
-    public Component add(final String title, final Component component) {
+    @Override
+    public Component add(String title, Component component) {
         insertTab(title, null, component, null, getTabCount());
         return component;
     }
 
-    public void addTab(final String title, final Component component) {
+    public void addTab(String title, Component component) {
         insertTab(title, null, component, null, getTabCount());
     }
 
-    public void addTab(final String title, final Icon icon,
-                       final Component component) {
+    public void addTab(String title, Icon icon, Component component) {
         insertTab(title, icon, component, null, getTabCount());
     }
 
-    public void addTab(final String title, final Icon icon,
-                       final Component component, final String tip) {
+    public void addTab(String title, Icon icon, Component component, String tip) {
         insertTab(title, icon, component, tip, getTabCount());
     }
 
-    public void addChangeListener(final ChangeListener l) {
+    public void addChangeListener(ChangeListener l) {
         listenerList.add(ChangeListener.class, l);
     }
 
-    public void removeChangeListener(final ChangeListener l) {
+    public void removeChangeListener(ChangeListener l) {
         listenerList.remove(ChangeListener.class, l);
     }
 
     public ChangeListener[] getChangeListeners() {
-        return (ChangeListener[])listenerList.getListeners(ChangeListener.class);
+        return listenerList.getListeners(ChangeListener.class);
     }
 
     protected ChangeListener createChangeListener() {
@@ -270,23 +285,22 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
-        return accessibleContext == null
-            ? (accessibleContext = new AccessibleJTabbedPane())
-            : accessibleContext;
+        return accessibleContext == null ? (accessibleContext = new AccessibleJTabbedPane())
+                : accessibleContext;
     }
 
-    public Rectangle getBoundsAt(final int index) {
+    public Rectangle getBoundsAt(int index) {
         return getUI() != null ? getUI().getTabBounds(this, index) : null;
     }
 
-    public void setComponentAt(final int index, final Component comp) {
+    public void setComponentAt(int index, Component comp) {
         int oldIndex = indexOfComponent(comp);
         if (oldIndex == index) {
             return;
         }
         JTabInfo tabInfo = getTabAt(index);
-
         if (oldIndex != -1) {
             removeTabAt(oldIndex);
         }
@@ -297,7 +311,7 @@
         tabInfo.setComp(comp);
     }
 
-    public Component getComponentAt(final int index) {
+    public Component getComponentAt(int index) {
         return getTabAt(index).getComp();
     }
 
@@ -309,33 +323,34 @@
         return getUI() != null ? getUI().getTabRunCount(this) : 0;
     }
 
-    public void setTitleAt(final int index, final String title) {
+    public void setTitleAt(int index, String title) {
         getTabAt(index).setText(title);
         repaint();
     }
 
-    public String getTitleAt(final int index) {
+    public String getTitleAt(int index) {
         return getTabAt(index).getText();
     }
 
-    public String getToolTipText(final MouseEvent event) {
+    @Override
+    public String getToolTipText(MouseEvent event) {
         int index = indexAtLocation(event.getX(), event.getY());
         return index > -1 ? getToolTipTextAt(index) : super.getToolTipText(event);
     }
 
-    public void setToolTipTextAt(final int index, final String toolTipText) {
+    public void setToolTipTextAt(int index, String toolTipText) {
         getTabAt(index).setToolTipText(toolTipText);
     }
 
-    public String getToolTipTextAt(final int index) {
+    public String getToolTipTextAt(int index) {
         return getTabAt(index).getToolTipText();
     }
 
-    public int indexAtLocation(final int x, final int y) {
+    public int indexAtLocation(int x, int y) {
         return getUI() != null ? getUI().tabForCoordinate(this, x, y) : -1;
     }
 
-    public int indexOfComponent(final Component comp) {
+    public int indexOfComponent(Component comp) {
         for (int i = 0; i < tabInfos.size(); i++) {
             if (comp == getComponentAt(i)) {
                 return i;
@@ -344,7 +359,7 @@
         return -1;
     }
 
-    public int indexOfTab(final Icon icon) {
+    public int indexOfTab(Icon icon) {
         for (int i = 0; i < tabInfos.size(); i++) {
             if (icon == getIconAt(i)) {
                 return i;
@@ -353,7 +368,7 @@
         return -1;
     }
 
-    public int indexOfTab(final String title) {
+    public int indexOfTab(String title) {
         for (int i = 0; i < tabInfos.size(); i++) {
             if (title == getTitleAt(i)) {
                 return i;
@@ -362,9 +377,7 @@
         return -1;
     }
 
-    public void insertTab(final String title, final Icon icon,
-                          final Component comp, final String tip,
-                          final int index) {
+    public void insertTab(String title, Icon icon, Component comp, String tip, int index) {
         int oldIndex = comp != null ? indexOfComponent(comp) : -1;
         if (oldIndex != -1) {
             tabInfos.remove(oldIndex);
@@ -372,20 +385,19 @@
         String realTitle = title == null ? "" : title;
         JTabInfo tabInfo = new JTabInfo(realTitle, icon, comp, tip);
         tabInfos.add(index, tabInfo);
-
         if (oldIndex == -1) {
             addComponentToContainer(comp);
         }
-
         if (getTabCount() == 1) {
             setSelectedIndex(0);
-        } else if (index <= getSelectedIndex() && (oldIndex == -1 || oldIndex > getSelectedIndex())) {
+        } else if (index <= getSelectedIndex()
+                && (oldIndex == -1 || oldIndex > getSelectedIndex())) {
             setSelectedIndex(getSelectedIndex() + 1);
         }
-
         repaint();
     }
 
+    @Override
     protected String paramString() {
         return super.paramString();
     }
@@ -394,12 +406,12 @@
      * If <code>component</code> is <code>instanceof UIResource</code>,
      * it is removed without removing any tab.
      */
-    public void remove(final Component comp) {
+    @Override
+    public void remove(Component comp) {
         if (comp instanceof UIResource) {
             removeComponentFromContainer(comp);
             return;
         }
-
         int index = indexOfComponent(comp);
         if (index != -1) {
             removeTabAt(index);
@@ -410,126 +422,115 @@
      * If <code>component</code> is <code>instanceof UIResource</code>,
      * it is removed without removing any tab.
      */
-    public void remove(final int index) {
+    @Override
+    public void remove(int index) {
         if (getComponent(index) instanceof UIResource) {
             super.remove(index);
             return;
         }
-
         removeTabAt(index);
     }
 
-    public void removeTabAt(final int index) {
+    public void removeTabAt(int index) {
         Component comp = getComponentAt(index);
-
         if (getSelectedIndex() >= getTabCount() - 1) {
             setSelectedIndex(getTabCount() - 2);
         }
-
         tabInfos.remove(index);
-
         removeComponentFromContainer(comp);
-
         comp.setVisible(true);
-
         repaint();
     }
 
+    @Override
     public void removeAll() {
         super.removeAll();
         tabInfos.removeAllElements();
     }
 
-    public void setBackgroundAt(final int index, final Color background) {
+    public void setBackgroundAt(int index, Color background) {
         Color realBackground = background == null ? getBackground() : background;
         getTabAt(index).setBackground(realBackground);
-
         repaint();
     }
 
-    public Color getBackgroundAt(final int index) {
+    public Color getBackgroundAt(int index) {
         return getTabAt(index).getBackground();
     }
 
-    public void setForegroundAt(final int index, final Color foreground) {
+    public void setForegroundAt(int index, Color foreground) {
         Color realForeground = foreground == null ? getForeground() : foreground;
         getTabAt(index).setForeground(realForeground);
         repaint();
     }
 
-    public Color getForegroundAt(final int index) {
+    public Color getForegroundAt(int index) {
         return getTabAt(index).getForeground();
     }
 
-    public void setDisabledIconAt(final int index, final Icon disabledIcon) {
+    public void setDisabledIconAt(int index, Icon disabledIcon) {
         getTabAt(index).setDisabledIcon(disabledIcon);
     }
 
-    public Icon getDisabledIconAt(final int index) {
+    public Icon getDisabledIconAt(int index) {
         return getTabAt(index).getDisabledIcon();
     }
 
-    public void setDisplayedMnemonicIndexAt(final int tabIndex,
-                                            final int mnemonicIndex) {
+    public void setDisplayedMnemonicIndexAt(int tabIndex, int mnemonicIndex) {
         getTabAt(tabIndex).setDisplayedMnemonicIndex(mnemonicIndex);
     }
 
-    public int getDisplayedMnemonicIndexAt(final int index) {
+    public int getDisplayedMnemonicIndexAt(int index) {
         return getTabAt(index).getDisplayedMnemonicIndex();
     }
 
-    public void setEnabledAt(final int index, final boolean enabled) {
+    public void setEnabledAt(int index, boolean enabled) {
         getTabAt(index).setEnabled(enabled);
         repaint();
     }
 
-    public boolean isEnabledAt(final int index) {
+    public boolean isEnabledAt(int index) {
         return getTabAt(index).isEnabled();
     }
 
-    public void setIconAt(final int index, final Icon icon) {
+    public void setIconAt(int index, Icon icon) {
         getTabAt(index).setIcon(icon);
         repaint();
     }
 
-    public Icon getIconAt(final int index) {
+    public Icon getIconAt(int index) {
         return getTabAt(index).getIcon();
     }
 
-    public void setMnemonicAt(final int tabIndex, final int mnemonic) {
+    public void setMnemonicAt(int tabIndex, int mnemonic) {
         int oldValue = getMnemonicAt(tabIndex);
         if (oldValue == mnemonic) {
             return;
         }
-
         InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW, true);
         inputMap.remove(KeyStroke.getKeyStroke(oldValue, InputEvent.ALT_DOWN_MASK));
         inputMap.put(KeyStroke.getKeyStroke(mnemonic, InputEvent.ALT_DOWN_MASK),
-                     StringConstants.MNEMONIC_ACTION);
-
+                StringConstants.MNEMONIC_ACTION);
         getTabAt(tabIndex).setMnemonic(mnemonic);
         repaint();
     }
 
-    public int getMnemonicAt(final int index) {
+    public int getMnemonicAt(int index) {
         return getTabAt(index).getMnemonic();
     }
 
-    public void setModel(final SingleSelectionModel model) {
+    public void setModel(SingleSelectionModel model) {
         if (changeListener == null) {
             changeListener = createChangeListener();
         }
-
         SingleSelectionModel oldValue = this.model;
         if (oldValue != null) {
             oldValue.removeChangeListener(changeListener);
         }
-
         this.model = model;
         if (model != null) {
             model.addChangeListener(changeListener);
         }
-
         firePropertyChange("model", oldValue, model);
     }
 
@@ -537,13 +538,11 @@
         return model;
     }
 
-    public void setSelectedComponent(final Component comp) {
+    public void setSelectedComponent(Component comp) {
         int index = indexOfComponent(comp);
         if (index == -1) {
-            throw new IllegalArgumentException(
-                "Component not found in the tabbed pane");
+            throw new IllegalArgumentException("Component not found in the tabbed pane");
         }
-
         setSelectedIndex(index);
     }
 
@@ -551,11 +550,10 @@
         return getModel().isSelected() ? getComponentAt(getSelectedIndex()) : null;
     }
 
-    public void setSelectedIndex(final int index) {
+    public void setSelectedIndex(int index) {
         if (index < -1 || index >= getTabCount()) {
             throw new IndexOutOfBoundsException("index < -1 || index >= tab count");
         }
-
         getModel().setSelectedIndex(index);
     }
 
@@ -563,12 +561,10 @@
         return getModel().getSelectedIndex();
     }
 
-    public void setTabLayoutPolicy(final int tabLayoutPolicy) {
-        if (tabLayoutPolicy != WRAP_TAB_LAYOUT
-                && tabLayoutPolicy != SCROLL_TAB_LAYOUT) {
+    public void setTabLayoutPolicy(int tabLayoutPolicy) {
+        if (tabLayoutPolicy != WRAP_TAB_LAYOUT && tabLayoutPolicy != SCROLL_TAB_LAYOUT) {
             throw new IllegalArgumentException("invalid tabLayoutPolicy");
         }
-
         int oldValue = this.tabLayoutPolicy;
         this.tabLayoutPolicy = tabLayoutPolicy;
         firePropertyChange("tabLayoutPolicy", oldValue, tabLayoutPolicy);
@@ -578,14 +574,11 @@
         return tabLayoutPolicy;
     }
 
-    public void setTabPlacement(final int tabPlacement) {
-        if (tabPlacement != TOP
-                && tabPlacement != BOTTOM
-                && tabPlacement != LEFT
+    public void setTabPlacement(int tabPlacement) {
+        if (tabPlacement != TOP && tabPlacement != BOTTOM && tabPlacement != LEFT
                 && tabPlacement != RIGHT) {
             throw new IllegalArgumentException("invalid tabPlacement");
         }
-
         int oldValue = this.tabPlacement;
         this.tabPlacement = tabPlacement;
         firePropertyChange("tabPlacement", oldValue, tabPlacement);
@@ -595,27 +588,29 @@
         return tabPlacement;
     }
 
-    public void setUI(final TabbedPaneUI ui) {
+    public void setUI(TabbedPaneUI ui) {
         super.setUI(ui);
     }
 
     public TabbedPaneUI getUI() {
-        return (TabbedPaneUI)ui;
+        return (TabbedPaneUI) ui;
     }
 
+    @Override
     public String getUIClassID() {
         return "TabbedPaneUI";
     }
 
+    @Override
     public void updateUI() {
-        setUI((TabbedPaneUI)UIManager.getUI(this));
+        setUI((TabbedPaneUI) UIManager.getUI(this));
     }
 
-    private JTabInfo getTabAt(final int index) {
-        return (JTabInfo)tabInfos.get(index);
+    private JTabInfo getTabAt(int index) {
+        return tabInfos.get(index);
     }
 
-    private void addComponentToContainer(final Component comp) {
+    private void addComponentToContainer(Component comp) {
         if (comp != null) {
             comp.setVisible(false);
             if (getComponentZOrder(comp) == -1) {
@@ -624,7 +619,7 @@
         }
     }
 
-    private void removeComponentFromContainer(final Component comp) {
+    private void removeComponentFromContainer(Component comp) {
         int componentIndex = getComponentZOrder(comp);
         if (componentIndex != -1) {
             super.remove(componentIndex);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java?view=diff&rev=478753&r1=478752&r2=478753
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java Thu Nov 23 18:41:15 2006
@@ -14,10 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Anton Avtamonov
- * @version $Revision$
- */
+
 package javax.swing;
 
 import java.awt.Color;
@@ -46,7 +43,6 @@
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Vector;
-
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleComponent;
@@ -75,377 +71,392 @@
 import javax.swing.tree.TreeNode;
 import javax.swing.tree.TreePath;
 import javax.swing.tree.TreeSelectionModel;
+import org.apache.harmony.luni.util.NotImplementedException;
 
+/**
+ * <p>
+ * <i>JTree</i>
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as guarantee of serialization compatibility.</li>
+ * </ul>
+ */
 public class JTree extends JComponent implements Scrollable, Accessible {
     private static final long serialVersionUID = -3884445419090632712L;
-    
-    protected class AccessibleJTree extends AccessibleJComponent implements AccessibleSelection, TreeSelectionListener, TreeModelListener, TreeExpansionListener {
+
+    protected class AccessibleJTree extends AccessibleJComponent implements
+            AccessibleSelection, TreeSelectionListener, TreeModelListener,
+            TreeExpansionListener {
         private static final long serialVersionUID = -8714565563782619758L;
-        
-        protected class AccessibleJTreeNode extends AccessibleContext implements Accessible, AccessibleComponent, AccessibleSelection, AccessibleAction {
+
+        protected class AccessibleJTreeNode extends AccessibleContext implements Accessible,
+                AccessibleComponent, AccessibleSelection, AccessibleAction {
             public AccessibleJTreeNode(JTree t, TreePath p, Accessible ap) {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             public AccessibleContext getAccessibleContext() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public String getAccessibleName() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
-            public void setAccessibleName(final String s) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setAccessibleName(String s) {
+                throw new NotImplementedException();
             }
 
             @Override
             public String getAccessibleDescription() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
-            public void setAccessibleDescription(final String s) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setAccessibleDescription(String s) {
+                throw new NotImplementedException();
             }
 
             @Override
             public AccessibleRole getAccessibleRole() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public AccessibleStateSet getAccessibleStateSet() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public Accessible getAccessibleParent() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public int getAccessibleIndexInParent() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public int getAccessibleChildrenCount() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
-            public Accessible getAccessibleChild(final int i) {
-                throw new UnsupportedOperationException("Not implemented");
+            public Accessible getAccessibleChild(int i) {
+                throw new NotImplementedException();
             }
 
             @Override
             public Locale getLocale() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
-            public void addPropertyChangeListener(final PropertyChangeListener l) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void addPropertyChangeListener(PropertyChangeListener l) {
+                throw new NotImplementedException();
             }
 
             @Override
-            public void removePropertyChangeListener(final PropertyChangeListener l) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void removePropertyChangeListener(PropertyChangeListener l) {
+                throw new NotImplementedException();
             }
 
             @Override
             public AccessibleAction getAccessibleAction() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public AccessibleComponent getAccessibleComponent() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public AccessibleSelection getAccessibleSelection() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public AccessibleText getAccessibleText() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             @Override
             public AccessibleValue getAccessibleValue() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             public Color getBackground() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setBackground(final Color c) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setBackground(Color c) {
+                throw new NotImplementedException();
             }
 
             public Color getForeground() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setForeground(final Color c) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setForeground(Color c) {
+                throw new NotImplementedException();
             }
 
             public Cursor getCursor() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setCursor(final Cursor c) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setCursor(Cursor c) {
+                throw new NotImplementedException();
             }
 
             public Font getFont() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setFont(final Font f) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setFont(Font f) {
+                throw new NotImplementedException();
             }
 
-            public FontMetrics getFontMetrics(final Font f) {
-                throw new UnsupportedOperationException("Not implemented");
+            public FontMetrics getFontMetrics(Font f) {
+                throw new NotImplementedException();
             }
 
             public boolean isEnabled() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setEnabled(final boolean b) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setEnabled(boolean b) {
+                throw new NotImplementedException();
             }
 
             public boolean isVisible() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setVisible(final boolean b) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setVisible(boolean b) {
+                throw new NotImplementedException();
             }
 
             public boolean isShowing() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public boolean contains(final Point p) {
-                throw new UnsupportedOperationException("Not implemented");
+            public boolean contains(Point p) {
+                throw new NotImplementedException();
             }
 
             public Point getLocationOnScreen() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             protected Point getLocationInJTree() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             public Point getLocation() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setLocation(final Point p) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setLocation(Point p) {
+                throw new NotImplementedException();
             }
 
             public Rectangle getBounds() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setBounds(final Rectangle r) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setBounds(Rectangle r) {
+                throw new NotImplementedException();
             }
 
             public Dimension getSize() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void setSize(final Dimension d) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void setSize(Dimension d) {
+                throw new NotImplementedException();
             }
 
-            public Accessible getAccessibleAt(final Point p) {
-                throw new UnsupportedOperationException("Not implemented");
+            public Accessible getAccessibleAt(Point p) {
+                throw new NotImplementedException();
             }
 
             public boolean isFocusTraversable() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             public void requestFocus() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public void addFocusListener(final FocusListener l) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void addFocusListener(FocusListener l) {
+                throw new NotImplementedException();
             }
 
-            public void removeFocusListener(final FocusListener l) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void removeFocusListener(FocusListener l) {
+                throw new NotImplementedException();
             }
 
             public int getAccessibleSelectionCount() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public Accessible getAccessibleSelection(final int i) {
-                throw new UnsupportedOperationException("Not implemented");
+            public Accessible getAccessibleSelection(int i) {
+                throw new NotImplementedException();
             }
 
-            public boolean isAccessibleChildSelected(final int i) {
-                throw new UnsupportedOperationException("Not implemented");
+            public boolean isAccessibleChildSelected(int i) {
+                throw new NotImplementedException();
             }
 
-            public void addAccessibleSelection(final int i) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void addAccessibleSelection(int i) {
+                throw new NotImplementedException();
             }
 
-            public void removeAccessibleSelection(final int i) {
-                throw new UnsupportedOperationException("Not implemented");
+            public void removeAccessibleSelection(int i) {
+                throw new NotImplementedException();
             }
 
             public void clearAccessibleSelection() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             public void selectAllAccessibleSelection() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
             public int getAccessibleActionCount() {
-                throw new UnsupportedOperationException("Not implemented");
+                throw new NotImplementedException();
             }
 
-            public String getAccessibleActionDescription(final int i) {
-                throw new UnsupportedOperationException("Not implemented");
+            public String getAccessibleActionDescription(int i) {
+                throw new NotImplementedException();
             }
 
-            public boolean doAccessibleAction(final int i) {
-                throw new UnsupportedOperationException("Not implemented");
+            public boolean doAccessibleAction(int i) {
+                throw new NotImplementedException();
             }
         }
 
         public AccessibleJTree() {
-//            throw new UnsupportedOperationException("Not implemented");
+            super();
         }
 
-        public void valueChanged(final TreeSelectionEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void valueChanged(TreeSelectionEvent e) {
+            throw new NotImplementedException();
         }
 
         public void fireVisibleDataPropertyChange() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
-        public void treeNodesChanged(final TreeModelEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void treeNodesChanged(TreeModelEvent e) {
+            throw new NotImplementedException();
         }
 
-        public void treeNodesInserted(final TreeModelEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void treeNodesInserted(TreeModelEvent e) {
+            throw new NotImplementedException();
         }
 
-        public void treeNodesRemoved(final TreeModelEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void treeNodesRemoved(TreeModelEvent e) {
+            throw new NotImplementedException();
         }
 
-        public void treeStructureChanged(final TreeModelEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void treeStructureChanged(TreeModelEvent e) {
+            throw new NotImplementedException();
         }
 
-        public void treeCollapsed(final TreeExpansionEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void treeCollapsed(TreeExpansionEvent e) {
+            throw new NotImplementedException();
         }
 
-        public void treeExpanded(final TreeExpansionEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void treeExpanded(TreeExpansionEvent e) {
+            throw new NotImplementedException();
         }
 
         @Override
         public AccessibleRole getAccessibleRole() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
         @Override
-        public Accessible getAccessibleAt(final Point p) {
-            throw new UnsupportedOperationException("Not implemented");
+        public Accessible getAccessibleAt(Point p) {
+            throw new NotImplementedException();
         }
 
         @Override
         public int getAccessibleChildrenCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
         @Override
-        public Accessible getAccessibleChild(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public Accessible getAccessibleChild(int i) {
+            throw new NotImplementedException();
         }
 
         @Override
         public int getAccessibleIndexInParent() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
         @Override
         public AccessibleSelection getAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
         public int getAccessibleSelectionCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
-        public Accessible getAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public Accessible getAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
-        public boolean isAccessibleChildSelected(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public boolean isAccessibleChildSelected(int i) {
+            throw new NotImplementedException();
         }
 
-        public void addAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void addAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
-        public void removeAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void removeAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public void clearAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
         public void selectAllAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
     }
 
     public static class DynamicUtilTreeNode extends DefaultMutableTreeNode {
         private static final long serialVersionUID = -2795134038906279615L;
-        
+
         protected boolean hasChildren;
+
         protected Object childValue;
+
         protected boolean loadedChildren;
 
-        public static void createChildren(final DefaultMutableTreeNode parent, final Object children) {
+        public static void createChildren(DefaultMutableTreeNode parent, Object children) {
             loadChildren(parent, children);
         }
 
-        public DynamicUtilTreeNode(final Object value, final Object children) {
+        public DynamicUtilTreeNode(Object value, Object children) {
             super(value, false);
             childValue = children;
-            loadedChildren = !(children instanceof Object[])
-                             && !(children instanceof Vector)
-                             && !(children instanceof Hashtable);
+            loadedChildren = !(children instanceof Object[]) && !(children instanceof Vector)
+                    && !(children instanceof Hashtable);
             setAllowsChildren(!loadedChildren);
         }
 
@@ -466,7 +477,7 @@
         }
 
         @Override
-        public TreeNode getChildAt(final int index) {
+        public TreeNode getChildAt(int index) {
             loadChildrenIfRequired();
             return super.getChildAt(index);
         }
@@ -478,29 +489,29 @@
             return super.children();
         }
 
-
         private void loadChildrenIfRequired() {
             if (!loadedChildren) {
                 loadChildren();
             }
         }
 
-        private static void loadChildren(final DefaultMutableTreeNode node, final Object nodeChildren) {
+        private static void loadChildren(DefaultMutableTreeNode node, Object nodeChildren) {
             boolean hasChildren = false;
             if (nodeChildren instanceof Object[]) {
-                Object[] children = (Object[])nodeChildren;
+                Object[] children = (Object[]) nodeChildren;
                 for (Object element : children) {
                     node.add(new DynamicUtilTreeNode(element, element));
                     hasChildren = true;
                 }
             } else if (nodeChildren instanceof Vector) {
-                for (Iterator<?> it = ((Vector)nodeChildren).iterator(); it.hasNext(); ) {
+                for (Iterator<?> it = ((Vector) nodeChildren).iterator(); it.hasNext();) {
                     Object child = it.next();
                     node.add(new DynamicUtilTreeNode(child, child));
                     hasChildren = true;
                 }
             } else if (nodeChildren instanceof Hashtable) {
-                for (Iterator<?> it = ((Hashtable)nodeChildren).keySet().iterator(); it.hasNext(); ) {
+                for (Iterator<?> it = ((Hashtable) nodeChildren).keySet().iterator(); it
+                        .hasNext();) {
                     Object child = it.next();
                     node.add(new DynamicUtilTreeNode(child, child));
                     hasChildren = true;
@@ -514,7 +525,7 @@
 
     protected static class EmptySelectionModel extends DefaultTreeSelectionModel {
         private static final long serialVersionUID = -2866787372484669512L;
-        
+
         protected static final EmptySelectionModel sharedInstance = new EmptySelectionModel();
 
         public static EmptySelectionModel sharedInstance() {
@@ -522,28 +533,27 @@
         }
 
         @Override
-        public void setSelectionPaths(final TreePath[] pPaths) {
+        public void setSelectionPaths(TreePath[] pPaths) {
         }
 
         @Override
-        public void addSelectionPaths(final TreePath[] paths) {
+        public void addSelectionPaths(TreePath[] paths) {
         }
 
         @Override
-        public void removeSelectionPaths(final TreePath[] paths) {
+        public void removeSelectionPaths(TreePath[] paths) {
         }
     }
 
     protected class TreeModelHandler implements TreeModelListener {
-        public void treeNodesChanged(final TreeModelEvent e) {
+        public void treeNodesChanged(TreeModelEvent e) {
         }
 
-        public void treeNodesInserted(final TreeModelEvent e) {
+        public void treeNodesInserted(TreeModelEvent e) {
         }
 
-        public void treeNodesRemoved(final TreeModelEvent e) {
+        public void treeNodesRemoved(TreeModelEvent e) {
             TreePath parentPath = e.getTreePath();
-
             Object[] children = e.getChildren();
             if (parentPath == null || children == null) {
                 return;
@@ -552,16 +562,14 @@
                 TreePath childPath = parentPath.pathByAddingChild(element);
                 removeDescendantToggledPaths(getDescendantToggledPaths(childPath));
             }
-
             removeDescendantSelectedPaths(parentPath, false);
         }
 
-        public void treeStructureChanged(final TreeModelEvent e) {
+        public void treeStructureChanged(TreeModelEvent e) {
             TreePath parentPath = e.getTreePath();
             if (parentPath == null) {
                 return;
             }
-
             Object parentPathToggleStatus = togglePaths.get(parentPath);
             removeDescendantToggledPaths(getDescendantToggledPaths(parentPath));
             togglePaths.put(parentPath, parentPathToggleStatus);
@@ -571,52 +579,83 @@
 
     protected class TreeSelectionRedirector implements Serializable, TreeSelectionListener {
         private static final long serialVersionUID = -5457497600720267892L;
-        
-        public void valueChanged(final TreeSelectionEvent e) {
-            fireValueChanged((TreeSelectionEvent)e.cloneWithSource(JTree.this));
+
+        public void valueChanged(TreeSelectionEvent e) {
+            fireValueChanged((TreeSelectionEvent) e.cloneWithSource(JTree.this));
         }
     }
 
+    public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
 
-    public static final String CELL_RENDERER_PROPERTY  = "cellRenderer";
     public static final String TREE_MODEL_PROPERTY = "model";
+
     public static final String ROOT_VISIBLE_PROPERTY = "rootVisible";
+
     public static final String SHOWS_ROOT_HANDLES_PROPERTY = "showsRootHandles";
+
     public static final String ROW_HEIGHT_PROPERTY = "rowHeight";
+
     public static final String CELL_EDITOR_PROPERTY = "cellEditor";
+
     public static final String EDITABLE_PROPERTY = "editable";
+
     public static final String LARGE_MODEL_PROPERTY = "largeModel";
+
     public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
+
     public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
+
     public static final String INVOKES_STOP_CELL_EDITING_PROPERTY = "invokesStopCellEditing";
+
     public static final String SCROLLS_ON_EXPAND_PROPERTY = "scrollsOnExpand";
+
     public static final String TOGGLE_CLICK_COUNT_PROPERTY = "toggleClickCount";
+
     public static final String LEAD_SELECTION_PATH_PROPERTY = "leadSelectionPath";
+
     public static final String ANCHOR_SELECTION_PATH_PROPERTY = "anchorSelectionPath";
+
     public static final String EXPANDS_SELECTED_PATHS_PROPERTY = "expandsSelectedPaths";
 
     protected transient TreeModel treeModel;
+
     protected transient TreeSelectionModel selectionModel;
+
     protected boolean rootVisible;
+
     protected transient TreeCellRenderer cellRenderer;
+
     protected int rowHeight;
+
     protected boolean showsRootHandles;
+
     protected transient TreeSelectionRedirector selectionRedirector;
+
     protected transient TreeCellEditor cellEditor;
+
     protected boolean editable;
+
     protected boolean largeModel;
+
     protected int visibleRowCount;
+
     protected boolean invokesStopCellEditing;
+
     protected boolean scrollsOnExpand;
+
     protected int toggleClickCount;
+
     protected transient TreeModelListener treeModelListener = createTreeModelListener();
 
     private boolean expandsSelectedPaths;
+
     private boolean dragEnabled;
+
     private TreePath leadSelectionPath;
+
     private TreePath anchorSelectionPath;
-    private final Map<TreePath, Object> togglePaths = new HashMap<TreePath, Object>();
 
+    private final Map<TreePath, Object> togglePaths = new HashMap<TreePath, Object>();
 
     private static final String UI_CLASS_ID = "TreeUI";
 
@@ -624,50 +663,50 @@
         this(getDefaultTreeModel());
     }
 
-    public JTree(final Object[] value) {
+    public JTree(Object[] value) {
         this(createTreeModel(value));
         setRootVisible(false);
         setShowsRootHandles(true);
     }
 
-    public JTree(final Vector<?> value) {
+    public JTree(Vector<?> value) {
         this(createTreeModel(value));
         setRootVisible(false);
         setShowsRootHandles(true);
     }
 
-    public JTree(final Hashtable<?,?> value) {
+    public JTree(Hashtable<?, ?> value) {
         this(createTreeModel(value));
         setRootVisible(false);
         setShowsRootHandles(true);
     }
 
-    public JTree(final TreeNode root) {
+    public JTree(TreeNode root) {
         this(new DefaultTreeModel(root));
     }
 
-    public JTree(final TreeNode root, final boolean asksAllowsChildren) {
+    public JTree(TreeNode root, boolean asksAllowsChildren) {
         this(new DefaultTreeModel(root));
-        ((DefaultTreeModel)getModel()).setAsksAllowsChildren(asksAllowsChildren);
+        ((DefaultTreeModel) getModel()).setAsksAllowsChildren(asksAllowsChildren);
     }
 
-    public JTree(final TreeModel model) {
+    public JTree(TreeModel model) {
         setModel(model);
         selectionModel = new DefaultTreeSelectionModel();
         updateUI();
     }
 
     public TreeUI getUI() {
-        return (TreeUI)ui;
+        return (TreeUI) ui;
     }
 
-    public void setUI(final TreeUI ui) {
+    public void setUI(TreeUI ui) {
         super.setUI(ui);
     }
 
     @Override
     public void updateUI() {
-        setUI((TreeUI)UIManager.getUI(this));
+        setUI((TreeUI) UIManager.getUI(this));
     }
 
     @Override
@@ -679,13 +718,13 @@
         return cellRenderer;
     }
 
-    public void setCellRenderer(final TreeCellRenderer renderer) {
+    public void setCellRenderer(TreeCellRenderer renderer) {
         TreeCellRenderer oldValue = cellRenderer;
         cellRenderer = renderer;
         firePropertyChange(CELL_RENDERER_PROPERTY, oldValue, renderer);
     }
 
-    public void setEditable(final boolean flag) {
+    public void setEditable(boolean flag) {
         boolean oldValue = editable;
         editable = flag;
         firePropertyChange(EDITABLE_PROPERTY, oldValue, flag);
@@ -695,7 +734,7 @@
         return editable;
     }
 
-    public void setCellEditor(final TreeCellEditor editor) {
+    public void setCellEditor(TreeCellEditor editor) {
         TreeCellEditor oldValue = cellEditor;
         cellEditor = editor;
         firePropertyChange(CELL_EDITOR_PROPERTY, oldValue, editor);
@@ -709,7 +748,7 @@
         return treeModel;
     }
 
-    public void setModel(final TreeModel model) {
+    public void setModel(TreeModel model) {
         TreeModel oldValue = treeModel;
         if (treeModel != null) {
             treeModel.removeTreeModelListener(treeModelListener);
@@ -733,13 +772,13 @@
         return rootVisible;
     }
 
-    public void setRootVisible(final boolean visible) {
+    public void setRootVisible(boolean visible) {
         boolean oldValue = rootVisible;
         rootVisible = visible;
         firePropertyChange(ROOT_VISIBLE_PROPERTY, oldValue, visible);
     }
 
-    public void setShowsRootHandles(final boolean showHandles) {
+    public void setShowsRootHandles(boolean showHandles) {
         boolean oldValue = showsRootHandles;
         showsRootHandles = showHandles;
         firePropertyChange(SHOWS_ROOT_HANDLES_PROPERTY, oldValue, showHandles);
@@ -749,7 +788,7 @@
         return showsRootHandles;
     }
 
-    public void setRowHeight(final int height) {
+    public void setRowHeight(int height) {
         int oldValue = rowHeight;
         rowHeight = height;
         firePropertyChange(ROW_HEIGHT_PROPERTY, oldValue, height);
@@ -763,7 +802,7 @@
         return getRowHeight() > 0;
     }
 
-    public void setLargeModel(final boolean large) {
+    public void setLargeModel(boolean large) {
         boolean oldValue = largeModel;
         largeModel = large;
         firePropertyChange(LARGE_MODEL_PROPERTY, oldValue, large);
@@ -773,7 +812,7 @@
         return largeModel;
     }
 
-    public void setInvokesStopCellEditing(final boolean invokesStop) {
+    public void setInvokesStopCellEditing(boolean invokesStop) {
         boolean oldValue = invokesStopCellEditing;
         invokesStopCellEditing = invokesStop;
         firePropertyChange(INVOKES_STOP_CELL_EDITING_PROPERTY, oldValue, invokesStop);
@@ -783,7 +822,7 @@
         return invokesStopCellEditing;
     }
 
-    public void setScrollsOnExpand(final boolean scroll) {
+    public void setScrollsOnExpand(boolean scroll) {
         boolean oldValue = scrollsOnExpand;
         scrollsOnExpand = scroll;
         firePropertyChange(SCROLLS_ON_EXPAND_PROPERTY, oldValue, scroll);
@@ -793,7 +832,7 @@
         return scrollsOnExpand;
     }
 
-    public void setToggleClickCount(final int clickCount) {
+    public void setToggleClickCount(int clickCount) {
         int oldValue = toggleClickCount;
         toggleClickCount = clickCount;
         firePropertyChange(TOGGLE_CLICK_COUNT_PROPERTY, oldValue, toggleClickCount);
@@ -803,7 +842,7 @@
         return toggleClickCount;
     }
 
-    public void setExpandsSelectedPaths(final boolean expand) {
+    public void setExpandsSelectedPaths(boolean expand) {
         boolean oldValue = expandsSelectedPaths;
         expandsSelectedPaths = expand;
         firePropertyChange(EXPANDS_SELECTED_PATHS_PROPERTY, oldValue, expand);
@@ -813,7 +852,7 @@
         return expandsSelectedPaths;
     }
 
-    public void setDragEnabled(final boolean enabled) {
+    public void setDragEnabled(boolean enabled) {
         if (enabled && GraphicsEnvironment.isHeadless()) {
             throw new HeadlessException();
         }
@@ -824,33 +863,32 @@
         return dragEnabled;
     }
 
-    public boolean isPathEditable(final TreePath path) {
+    public boolean isPathEditable(TreePath path) {
         return isEditable();
     }
 
     @Override
-    public String getToolTipText(final MouseEvent event) {
+    public String getToolTipText(MouseEvent event) {
         if (event == null) {
             return null;
         }
-
         TreePath path = getPathForLocation(event.getX(), event.getY());
         if (path != null) {
             Object node = path.getLastPathComponent();
             boolean isLeaf = getModel().isLeaf(node);
-
-            Component renderer = getCellRenderer().getTreeCellRendererComponent(this, node, isPathSelected(path), isExpanded(path), isLeaf, getRowForPath(path), path.equals(getLeadSelectionPath()));
+            Component renderer = getCellRenderer().getTreeCellRendererComponent(this, node,
+                    isPathSelected(path), isExpanded(path), isLeaf, getRowForPath(path),
+                    path.equals(getLeadSelectionPath()));
             if (renderer instanceof JComponent) {
-                return ((JComponent)renderer).getToolTipText(SwingUtilities.convertMouseEvent(this, event, renderer));
+                return ((JComponent) renderer).getToolTipText(SwingUtilities.convertMouseEvent(
+                        this, event, renderer));
             }
         }
         return super.getToolTipText(event);
     }
 
-    public String convertValueToText(final Object value, final boolean selected,
-                                     final boolean expanded, final boolean leaf,
-                                     final int row, final boolean hasFocus) {
-
+    public String convertValueToText(Object value, boolean selected, boolean expanded,
+            boolean leaf, int row, boolean hasFocus) {
         return value != null ? value.toString() : "";
     }
 
@@ -858,47 +896,47 @@
         return getUI().getRowCount(this);
     }
 
-    public void setSelectionPath(final TreePath path) {
+    public void setSelectionPath(TreePath path) {
         getSelectionModel().setSelectionPath(path);
     }
 
-    public void setSelectionPaths(final TreePath[] paths) {
+    public void setSelectionPaths(TreePath[] paths) {
         getSelectionModel().setSelectionPaths(paths);
     }
 
-    public void setLeadSelectionPath(final TreePath path) {
+    public void setLeadSelectionPath(TreePath path) {
         TreePath oldValue = leadSelectionPath;
         leadSelectionPath = path;
         firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, path);
     }
 
-    public void setAnchorSelectionPath(final TreePath path) {
+    public void setAnchorSelectionPath(TreePath path) {
         TreePath oldValue = anchorSelectionPath;
         anchorSelectionPath = path;
         firePropertyChange(ANCHOR_SELECTION_PATH_PROPERTY, oldValue, path);
     }
 
-    public void setSelectionRow(final int row) {
-        setSelectionRows(new int[] {row});
+    public void setSelectionRow(int row) {
+        setSelectionRows(new int[] { row });
     }
 
-    public void setSelectionRows(final int[] rows) {
+    public void setSelectionRows(int[] rows) {
         getSelectionModel().setSelectionPaths(rowsToPaths(rows));
     }
 
-    public void addSelectionPath(final TreePath path) {
+    public void addSelectionPath(TreePath path) {
         getSelectionModel().addSelectionPath(path);
     }
 
-    public void addSelectionPaths(final TreePath[] paths) {
+    public void addSelectionPaths(TreePath[] paths) {
         getSelectionModel().addSelectionPaths(paths);
     }
 
-    public void addSelectionRow(final int row) {
-        addSelectionRows(new int[] {row});
+    public void addSelectionRow(int row) {
+        addSelectionRows(new int[] { row });
     }
 
-    public void addSelectionRows(final int[] rows) {
+    public void addSelectionRows(int[] rows) {
         getSelectionModel().addSelectionPaths(rowsToPaths(rows));
     }
 
@@ -943,20 +981,19 @@
         return getRowForPath(getLeadSelectionPath());
     }
 
-    public boolean isPathSelected(final TreePath path) {
+    public boolean isPathSelected(TreePath path) {
         return getSelectionModel().isPathSelected(path);
     }
 
-    public boolean isRowSelected(final int row) {
+    public boolean isRowSelected(int row) {
         return getSelectionModel().isRowSelected(row);
     }
 
-    public Enumeration<TreePath> getExpandedDescendants(final TreePath parent) {
+    public Enumeration<TreePath> getExpandedDescendants(TreePath parent) {
         final Enumeration<TreePath> toggled = getDescendantToggledPaths(parent);
         if (toggled == null) {
             return null;
         }
-
         return new Enumeration<TreePath>() {
             private TreePath nextElement = getNextExpandedPath();
 
@@ -964,7 +1001,6 @@
                 if (nextElement == null) {
                     throw new NoSuchElementException("No next element in enumeration");
                 }
-
                 TreePath currentValue = nextElement;
                 nextElement = getNextExpandedPath();
                 return currentValue;
@@ -986,12 +1022,12 @@
         };
     }
 
-    public boolean hasBeenExpanded(final TreePath path) {
+    public boolean hasBeenExpanded(TreePath path) {
         return togglePaths.containsKey(path);
     }
 
-    public boolean isExpanded(final TreePath path) {
-        Boolean state = (Boolean)togglePaths.get(path);
+    public boolean isExpanded(TreePath path) {
+        Boolean state = (Boolean) togglePaths.get(path);
         if (state == null || !state.booleanValue()) {
             return false;
         }
@@ -999,35 +1035,35 @@
         return parentPath == null || isExpanded(parentPath);
     }
 
-    public boolean isExpanded(final int row) {
+    public boolean isExpanded(int row) {
         return isExpanded(getPathForRow(row));
     }
 
-    public boolean isCollapsed(final TreePath path) {
+    public boolean isCollapsed(TreePath path) {
         return !isExpanded(path);
     }
 
-    public boolean isCollapsed(final int row) {
+    public boolean isCollapsed(int row) {
         return !isExpanded(row);
     }
 
-    public void makeVisible(final TreePath path) {
+    public void makeVisible(TreePath path) {
         expandPath(path.getParentPath());
     }
 
-    public boolean isVisible(final TreePath path) {
+    public boolean isVisible(TreePath path) {
         return getRowForPath(path) >= 0;
     }
 
-    public Rectangle getPathBounds(final TreePath path) {
+    public Rectangle getPathBounds(TreePath path) {
         return getUI().getPathBounds(this, path);
     }
 
-    public Rectangle getRowBounds(final int row) {
+    public Rectangle getRowBounds(int row) {
         return getPathBounds(getPathForRow(row));
     }
 
-    public void scrollPathToVisible(final TreePath path) {
+    public void scrollPathToVisible(TreePath path) {
         if (path == null) {
             return;
         }
@@ -1038,19 +1074,19 @@
         }
     }
 
-    public void scrollRowToVisible(final int row) {
+    public void scrollRowToVisible(int row) {
         scrollPathToVisible(getPathForRow(row));
     }
 
-    public TreePath getPathForRow(final int row) {
+    public TreePath getPathForRow(int row) {
         return getUI().getPathForRow(this, row);
     }
 
-    public int getRowForPath(final TreePath path) {
+    public int getRowForPath(TreePath path) {
         return getUI().getRowForPath(this, path);
     }
 
-    public void expandPath(final TreePath path) {
+    public void expandPath(TreePath path) {
         if (path == null || getModel() == null) {
             return;
         }
@@ -1060,36 +1096,36 @@
         setExpandedState(path, true);
     }
 
-    public void expandRow(final int row) {
+    public void expandRow(int row) {
         expandPath(getPathForRow(row));
     }
 
-    public void collapsePath(final TreePath path) {
+    public void collapsePath(TreePath path) {
         setExpandedState(path, false);
     }
 
-    public void collapseRow(final int row) {
+    public void collapseRow(int row) {
         collapsePath(getPathForRow(row));
     }
 
-    public TreePath getPathForLocation(final int x, final int y) {
+    public TreePath getPathForLocation(int x, int y) {
         TreePath closestPath = getClosestPathForLocation(x, y);
-        if (closestPath ==  null) {
+        if (closestPath == null) {
             return null;
         }
         Rectangle pathBounds = getPathBounds(closestPath);
         return pathBounds.contains(x, y) ? closestPath : null;
     }
 
-    public int getRowForLocation(final int x, final int y) {
+    public int getRowForLocation(int x, int y) {
         return getRowForPath(getPathForLocation(x, y));
     }
 
-    public TreePath getClosestPathForLocation(final int x, final int y) {
+    public TreePath getClosestPathForLocation(int x, int y) {
         return getUI().getClosestPathForLocation(this, x, y);
     }
 
-    public int getClosestRowForLocation(final int x, final int y) {
+    public int getClosestRowForLocation(int x, int y) {
         return getRowForPath(getClosestPathForLocation(x, y));
     }
 
@@ -1105,7 +1141,7 @@
         getUI().cancelEditing(this);
     }
 
-    public void startEditingAtPath(final TreePath path) {
+    public void startEditingAtPath(TreePath path) {
         getUI().startEditingAtPath(this, path);
     }
 
@@ -1113,10 +1149,9 @@
         return getUI().getEditingPath(this);
     }
 
-    public void setSelectionModel(final TreeSelectionModel model) {
+    public void setSelectionModel(TreeSelectionModel model) {
         TreeSelectionModel oldValue = selectionModel;
         selectionModel.removeTreeSelectionListener(selectionRedirector);
-
         selectionModel = model != null ? model : EmptySelectionModel.sharedInstance();
         if (selectionRedirector != null) {
             selectionModel.addTreeSelectionListener(selectionRedirector);
@@ -1128,32 +1163,32 @@
         return selectionModel;
     }
 
-    public void setSelectionInterval(final int index0, final int index1) {
+    public void setSelectionInterval(int index0, int index1) {
         clearSelection();
         addSelectionInterval(index0, index1);
     }
 
-    public void addSelectionInterval(final int index0, final int index1) {
+    public void addSelectionInterval(int index0, int index1) {
         addSelectionPaths(getPathBetweenRows(index0, index1));
     }
 
-    public void removeSelectionInterval(final int index0, final int index1) {
+    public void removeSelectionInterval(int index0, int index1) {
         removeSelectionPaths(getPathBetweenRows(index0, index1));
     }
 
-    public void removeSelectionPath(final TreePath path) {
+    public void removeSelectionPath(TreePath path) {
         getSelectionModel().removeSelectionPath(path);
     }
 
-    public void removeSelectionPaths(final TreePath[] paths) {
+    public void removeSelectionPaths(TreePath[] paths) {
         getSelectionModel().removeSelectionPaths(paths);
     }
 
-    public void removeSelectionRow(final int row) {
+    public void removeSelectionRow(int row) {
         removeSelectionPath(getPathForRow(row));
     }
 
-    public void removeSelectionRows(final int[] rows) {
+    public void removeSelectionRows(int[] rows) {
         removeSelectionPaths(rowsToPaths(rows));
     }
 
@@ -1165,11 +1200,11 @@
         return getSelectionModel().isSelectionEmpty();
     }
 
-    public void addTreeExpansionListener(final TreeExpansionListener l) {
+    public void addTreeExpansionListener(TreeExpansionListener l) {
         listenerList.add(TreeExpansionListener.class, l);
     }
 
-    public void removeTreeExpansionListener(final TreeExpansionListener l) {
+    public void removeTreeExpansionListener(TreeExpansionListener l) {
         listenerList.remove(TreeExpansionListener.class, l);
     }
 
@@ -1177,11 +1212,11 @@
         return listenerList.getListeners(TreeExpansionListener.class);
     }
 
-    public void addTreeWillExpandListener(final TreeWillExpandListener l) {
+    public void addTreeWillExpandListener(TreeWillExpandListener l) {
         listenerList.add(TreeWillExpandListener.class, l);
     }
 
-    public void removeTreeWillExpandListener(final TreeWillExpandListener l) {
+    public void removeTreeWillExpandListener(TreeWillExpandListener l) {
         listenerList.remove(TreeWillExpandListener.class, l);
     }
 
@@ -1189,55 +1224,51 @@
         return listenerList.getListeners(TreeWillExpandListener.class);
     }
 
-    public void fireTreeExpanded(final TreePath path) {
+    public void fireTreeExpanded(TreePath path) {
         TreeExpansionListener[] listeners = getTreeExpansionListeners();
         if (listeners.length == 0) {
             return;
         }
-
         TreeExpansionEvent event = new TreeExpansionEvent(this, path);
         for (TreeExpansionListener element : listeners) {
             element.treeExpanded(event);
         }
     }
 
-    public void fireTreeCollapsed(final TreePath path) {
+    public void fireTreeCollapsed(TreePath path) {
         TreeExpansionListener[] listeners = getTreeExpansionListeners();
         if (listeners.length == 0) {
             return;
         }
-
         TreeExpansionEvent event = new TreeExpansionEvent(this, path);
         for (TreeExpansionListener element : listeners) {
             element.treeCollapsed(event);
         }
     }
 
-    public void fireTreeWillExpand(final TreePath path) throws ExpandVetoException {
+    public void fireTreeWillExpand(TreePath path) throws ExpandVetoException {
         TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
         if (listeners.length == 0) {
             return;
         }
-
         TreeExpansionEvent event = new TreeExpansionEvent(this, path);
         for (TreeWillExpandListener element : listeners) {
             element.treeWillExpand(event);
         }
     }
 
-    public void fireTreeWillCollapse(final TreePath path) throws ExpandVetoException {
+    public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException {
         TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
         if (listeners.length == 0) {
             return;
         }
-
         TreeExpansionEvent event = new TreeExpansionEvent(this, path);
         for (TreeWillExpandListener element : listeners) {
             element.treeWillCollapse(event);
         }
     }
 
-    public void addTreeSelectionListener(final TreeSelectionListener l) {
+    public void addTreeSelectionListener(TreeSelectionListener l) {
         if (selectionRedirector == null) {
             selectionRedirector = new TreeSelectionRedirector();
             selectionModel.addTreeSelectionListener(selectionRedirector);
@@ -1245,7 +1276,7 @@
         listenerList.add(TreeSelectionListener.class, l);
     }
 
-    public void removeTreeSelectionListener(final TreeSelectionListener l) {
+    public void removeTreeSelectionListener(TreeSelectionListener l) {
         listenerList.remove(TreeSelectionListener.class, l);
     }
 
@@ -1253,7 +1284,7 @@
         return listenerList.getListeners(TreeSelectionListener.class);
     }
 
-    protected void fireValueChanged(final TreeSelectionEvent e) {
+    protected void fireValueChanged(TreeSelectionEvent e) {
         TreeSelectionListener[] listeners = getTreeSelectionListeners();
         for (TreeSelectionListener element : listeners) {
             element.valueChanged(e);
@@ -1265,7 +1296,7 @@
         repaint();
     }
 
-    public void setVisibleRowCount(final int count) {
+    public void setVisibleRowCount(int count) {
         int oldValue = visibleRowCount;
         visibleRowCount = count;
         firePropertyChange(VISIBLE_ROW_COUNT_PROPERTY, oldValue, count);
@@ -1275,12 +1306,13 @@
         return visibleRowCount;
     }
 
-    public TreePath getNextMatch(final String prefix, final int startingRow, final Position.Bias bias) {
+    public TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias) {
         if (prefix == null) {
             throw new IllegalArgumentException("Prefix must be specified");
         }
         if (startingRow < 0 || startingRow >= getRowCount()) {
-            throw new IllegalArgumentException("Illegal startingRow is specified. Must be in the valid range");
+            throw new IllegalArgumentException(
+                    "Illegal startingRow is specified. Must be in the valid range");
         }
         if (bias == Position.Bias.Forward) {
             int rowCount = getRowCount();
@@ -1315,41 +1347,33 @@
 
     public Dimension getPreferredScrollableViewportSize() {
         int width = getPreferredSize().width;
-
         int height;
         if (isFixedRowHeight()) {
             height = getRowHeight();
         } else {
-            Rectangle rootBounds = getModel() != null ? getPathBounds(new TreePath(getModel().getRoot()))
-                                                      : null;
+            Rectangle rootBounds = getModel() != null ? getPathBounds(new TreePath(getModel()
+                    .getRoot())) : null;
             height = rootBounds != null ? rootBounds.height : 16;
         }
-
         return new Dimension(width, getVisibleRowCount() * height);
     }
 
-    public int getScrollableUnitIncrement(final Rectangle visibleRect,
-                                          final int orientation, final int direction) {
-
+    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
         if (orientation == SwingConstants.HORIZONTAL) {
             return 4;
         }
-
         TreePath closestPath = getClosestPathForLocation(visibleRect.x, visibleRect.y);
         if (closestPath == null) {
             return 0;
         }
-
         Rectangle pathBounds = getPathBounds(closestPath);
         if (direction >= 0) {
             return pathBounds.y + pathBounds.height - visibleRect.y;
         }
-        
         int increment = visibleRect.y - pathBounds.y;
         if (increment > 0) {
             return increment;
         }
-
         int row = getRowForPath(closestPath);
         if (row == 0) {
             return 0;
@@ -1358,8 +1382,7 @@
         return pathBounds.height;
     }
 
-    public int getScrollableBlockIncrement(final Rectangle visibleRect,
-                                           final int orientation, final int direction) {
+    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
         return orientation == SwingConstants.VERTICAL ? visibleRect.height : visibleRect.width;
     }
 
@@ -1368,7 +1391,6 @@
         if (!(parent instanceof JViewport)) {
             return false;
         }
-
         return parent.getSize().width > getPreferredSize().width;
     }
 
@@ -1377,7 +1399,6 @@
         if (!(parent instanceof JViewport)) {
             return false;
         }
-
         return parent.getSize().height > getPreferredSize().height;
     }
 
@@ -1386,12 +1407,10 @@
         if (accessibleContext == null) {
             accessibleContext = new AccessibleJTree();
         }
-
         return accessibleContext;
     }
 
-
-    protected void setExpandedState(final TreePath path, final boolean state) {
+    protected void setExpandedState(TreePath path, boolean state) {
         doSetExpandedState(path, state);
         if (!state) {
             if (removeDescendantSelectedPaths(path, false)) {
@@ -1405,8 +1424,8 @@
         if (parent == null) {
             return null;
         }
-
-        final Iterator<TreePath> toggled = (new HashSet<TreePath>(togglePaths.keySet())).iterator();
+        final Iterator<TreePath> toggled = (new HashSet<TreePath>(togglePaths.keySet()))
+                .iterator();
         return new Enumeration<TreePath>() {
             private TreePath nextElement = getNextDescendPath();
 
@@ -1414,7 +1433,6 @@
                 if (nextElement == null) {
                     throw new NoSuchElementException("No next element in enumeration");
                 }
-
                 TreePath currentValue = nextElement;
                 nextElement = getNextDescendPath();
                 return currentValue;
@@ -1436,11 +1454,11 @@
         };
     }
 
-    protected void removeDescendantToggledPaths(final Enumeration<TreePath> toRemove) {
+    protected void removeDescendantToggledPaths(Enumeration<TreePath> toRemove) {
         if (toRemove == null) {
             return;
         }
-        while(toRemove.hasMoreElements()) {
+        while (toRemove.hasMoreElements()) {
             togglePaths.remove(toRemove.nextElement());
         }
     }
@@ -1453,9 +1471,7 @@
         return new TreeModelHandler();
     }
 
-    protected boolean removeDescendantSelectedPaths(final TreePath path,
-                                                    final boolean includePath) {
-
+    protected boolean removeDescendantSelectedPaths(TreePath path, boolean includePath) {
         if (path == null) {
             return false;
         }
@@ -1463,82 +1479,67 @@
         if (selectedPaths == null) {
             return false;
         }
-
         List<TreePath> toRemove = new LinkedList<TreePath>();
         for (TreePath selectedPath : selectedPaths) {
-            if (path.isDescendant(selectedPath)
-                && (includePath || !path.equals(selectedPath))) {
-
+            if (path.isDescendant(selectedPath) && (includePath || !path.equals(selectedPath))) {
                 toRemove.add(selectedPath);
             }
         }
         if (toRemove.isEmpty()) {
             return false;
         }
-
         removeSelectionPaths(toRemove.toArray(new TreePath[toRemove.size()]));
         return true;
     }
 
     protected static TreeModel getDefaultTreeModel() {
         DefaultMutableTreeNode root = new DefaultMutableTreeNode("JTree");
-
         DefaultMutableTreeNode colorsNode = new DefaultMutableTreeNode("towns");
         colorsNode.add(new DefaultMutableTreeNode("Saint-Petersburg"));
         colorsNode.add(new DefaultMutableTreeNode("New-York"));
         colorsNode.add(new DefaultMutableTreeNode("Munchen"));
         colorsNode.add(new DefaultMutableTreeNode("Oslo"));
         root.add(colorsNode);
-
         DefaultMutableTreeNode sportsNode = new DefaultMutableTreeNode("animals");
         sportsNode.add(new DefaultMutableTreeNode("dog"));
         sportsNode.add(new DefaultMutableTreeNode("tiger"));
         sportsNode.add(new DefaultMutableTreeNode("wolf"));
         sportsNode.add(new DefaultMutableTreeNode("bear"));
         root.add(sportsNode);
-
         DefaultMutableTreeNode foodNode = new DefaultMutableTreeNode("computers");
         foodNode.add(new DefaultMutableTreeNode("notebook"));
         foodNode.add(new DefaultMutableTreeNode("desktop"));
         foodNode.add(new DefaultMutableTreeNode("server"));
         foodNode.add(new DefaultMutableTreeNode("mainframe"));
         root.add(foodNode);
-
         return new DefaultTreeModel(root);
     }
 
-    protected static TreeModel createTreeModel(final Object value) {
+    protected static TreeModel createTreeModel(Object value) {
         return new DefaultTreeModel(new DynamicUtilTreeNode("root", value));
     }
 
-    protected TreePath[] getPathBetweenRows(final int index0, final int index1) {
+    protected TreePath[] getPathBetweenRows(int index0, int index1) {
         int minRow = Math.max(Math.min(index0, index1), 0);
         int maxRow = Math.min(Math.max(index0, index1), getRowCount() - 1);
-
         if (minRow > maxRow) {
             return null;
         }
-
         TreePath[] paths = new TreePath[maxRow - minRow + 1];
         for (int i = minRow; i <= maxRow; i++) {
             paths[i - minRow] = getPathForRow(i);
         }
-
         return paths;
     }
 
-
-    private void doSetExpandedState(final TreePath path, final boolean state) {
+    private void doSetExpandedState(TreePath path, boolean state) {
         if (path == null) {
             return;
         }
-
         doSetExpandedState(path.getParentPath(), true);
-
         if (isExpanded(path) == state) {
             return;
         }
-
         try {
             if (state) {
                 fireTreeWillExpand(path);
@@ -1548,9 +1549,7 @@
         } catch (ExpandVetoException e) {
             return;
         }
-
         togglePaths.put(path, Boolean.valueOf(state));
-
         if (state) {
             fireTreeExpanded(path);
         } else {
@@ -1558,11 +1557,10 @@
         }
     }
 
-    private TreePath[] rowsToPaths(final int[] rows) {
+    private TreePath[] rowsToPaths(int[] rows) {
         if (rows == null || rows.length == 0) {
             return new TreePath[0];
         }
-
         List<TreePath> paths = new ArrayList<TreePath>();
         for (int row : rows) {
             TreePath path = getPathForRow(row);
@@ -1573,14 +1571,14 @@
         return paths.toArray(new TreePath[paths.size()]);
     }
 
-    private boolean pathMatches(final String prefix, final TreePath path, final int row) {
+    private boolean pathMatches(String prefix, TreePath path, int row) {
         if (path == null) {
             return false;
         }
         boolean isLeaf = getModel() != null && getModel().isLeaf(path.getLastPathComponent());
         boolean isFocused = path.equals(getLeadSelectionPath());
-        String value = convertValueToText(path.getLastPathComponent(), isPathSelected(path),isExpanded(path), isLeaf, row, isFocused);
-
+        String value = convertValueToText(path.getLastPathComponent(), isPathSelected(path),
+                isExpanded(path), isLeaf, row, isFocused);
         return value != null && value.toUpperCase().startsWith(prefix.toUpperCase());
     }
 }



Mime
View raw message