< prev index next >

src/share/classes/javax/swing/tree/FixedHeightLayoutCache.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

*** 62,86 **** private Rectangle boundsBuffer; /** * Maps from TreePath to a FHTreeStateNode. */ ! private Hashtable treePathMapping; /** * Used for getting path/row information. */ private SearchInfo info; ! private Stack tempStacks; public FixedHeightLayoutCache() { super(); ! tempStacks = new Stack(); boundsBuffer = new Rectangle(); ! treePathMapping = new Hashtable(); info = new SearchInfo(); setRowHeight(1); } /** --- 62,86 ---- private Rectangle boundsBuffer; /** * Maps from TreePath to a FHTreeStateNode. */ ! private Hashtable<TreePath, FHTreeStateNode> treePathMapping; /** * Used for getting path/row information. */ private SearchInfo info; ! private Stack<Stack<TreePath>> tempStacks; public FixedHeightLayoutCache() { super(); ! tempStacks = new Stack<Stack<TreePath>>(); boundsBuffer = new Rectangle(); ! treePathMapping = new Hashtable<TreePath, FHTreeStateNode>(); info = new SearchInfo(); setRowHeight(1); } /**
*** 590,600 **** /** * Returns the node previously added for <code>path</code>. This may * return null, if you to create a node use getNodeForPath. */ private FHTreeStateNode getMapping(TreePath path) { ! return (FHTreeStateNode)treePathMapping.get(path); } /** * Sent to completely rebuild the visible tree. All nodes are collapsed. */ --- 590,600 ---- /** * Returns the node previously added for <code>path</code>. This may * return null, if you to create a node use getNodeForPath. */ private FHTreeStateNode getMapping(TreePath path) { ! return treePathMapping.get(path); } /** * Sent to completely rebuild the visible tree. All nodes are collapsed. */
*** 693,709 **** } if(onlyIfVisible) return null; // 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(); --- 693,709 ---- } if(onlyIfVisible) return null; // 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();
*** 712,722 **** 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 = node.createChildFor(path. getLastPathComponent()); } return node; } --- 712,722 ---- 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 = node.createChildFor(path. getLastPathComponent()); } return node; }
< prev index next >