< prev index next >

src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java

Print this page
rev 1527 : 6727662: Code improvement and warnings removing from swing packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: malenkov

*** 54,64 **** public class VariableHeightLayoutCache extends AbstractLayoutCache { /** * The array of nodes that are currently visible, in the order they * are displayed. */ ! private Vector visibleNodes; /** * This is set to true if one of the entries has an invalid size. */ private boolean updateNodeSizes; --- 54,64 ---- public class VariableHeightLayoutCache extends AbstractLayoutCache { /** * The array of nodes that are currently visible, in the order they * are displayed. */ ! private Vector<Object> visibleNodes; /** * This is set to true if one of the entries has an invalid size. */ private boolean updateNodeSizes;
*** 77,100 **** private Rectangle boundsBuffer; /** * Maps from <code>TreePath</code> to a <code>TreeStateNode</code>. */ ! private Hashtable treePathMapping; /** * A stack of stacks. */ ! private Stack tempStacks; public VariableHeightLayoutCache() { super(); ! tempStacks = new Stack(); ! visibleNodes = new Vector(); boundsBuffer = new Rectangle(); ! treePathMapping = new Hashtable(); } /** * Sets the <code>TreeModel</code> that will provide the data. * --- 77,100 ---- private Rectangle boundsBuffer; /** * Maps from <code>TreePath</code> to a <code>TreeStateNode</code>. */ ! private Hashtable<TreePath, TreeStateNode> treePathMapping; /** * A stack of stacks. */ ! private Stack<Stack<TreePath>> tempStacks; public VariableHeightLayoutCache() { super(); ! tempStacks = new Stack<Stack<TreePath>>(); ! visibleNodes = new Vector<Object>(); boundsBuffer = new Rectangle(); ! treePathMapping = new Hashtable<TreePath, TreeStateNode>(); } /** * Sets the <code>TreeModel</code> that will provide the data. *
*** 702,712 **** /** * Returns the node previously added for <code>path</code>. This may * return null, if you to create a node use getNodeForPath. */ private TreeStateNode getMapping(TreePath path) { ! return (TreeStateNode)treePathMapping.get(path); } /** * Retursn the bounds for row, <code>row</code> by reference in * <code>placeIn</code>. If <code>placeIn</code> is null a new --- 702,712 ---- /** * Returns the node previously added for <code>path</code>. This may * return null, if you to create a node use getNodeForPath. */ private TreeStateNode getMapping(TreePath path) { ! return treePathMapping.get(path); } /** * Retursn the bounds for row, <code>row</code> by reference in * <code>placeIn</code>. If <code>placeIn</code> is null a new
*** 822,838 **** return null; return node; } // Check all the parent paths, until a match is found. ! Stack paths; if(tempStacks.size() == 0) { ! paths = new Stack(); } else { ! paths = (Stack)tempStacks.pop(); } try { paths.push(path); path = path.getParentPath(); --- 822,838 ---- return null; return node; } // Check all the parent paths, until a match is found. ! Stack<TreePath> paths; if(tempStacks.size() == 0) { ! paths = new Stack<TreePath>(); } else { ! paths = tempStacks.pop(); } try { paths.push(path); path = path.getParentPath();
*** 841,851 **** node = getMapping(path); if(node != null) { // Found a match, create entries for all paths in // paths. while(node != null && paths.size() > 0) { ! path = (TreePath)paths.pop(); node.getLoadedChildren(shouldCreate); int childIndex = treeModel. getIndexOfChild(node.getUserObject(), path.getLastPathComponent()); --- 841,851 ---- node = getMapping(path); if(node != null) { // Found a match, create entries for all paths in // paths. while(node != null && paths.size() > 0) { ! path = paths.pop(); node.getLoadedChildren(shouldCreate); int childIndex = treeModel. getIndexOfChild(node.getUserObject(), path.getLastPathComponent());
< prev index next >