< 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,25 +62,25 @@
private Rectangle boundsBuffer;
/**
* Maps from TreePath to a FHTreeStateNode.
*/
- private Hashtable treePathMapping;
+ private Hashtable<TreePath, FHTreeStateNode> treePathMapping;
/**
* Used for getting path/row information.
*/
private SearchInfo info;
- private Stack tempStacks;
+ private Stack<Stack<TreePath>> tempStacks;
public FixedHeightLayoutCache() {
super();
- tempStacks = new Stack();
+ tempStacks = new Stack<Stack<TreePath>>();
boundsBuffer = new Rectangle();
- treePathMapping = new Hashtable();
+ treePathMapping = new Hashtable<TreePath, FHTreeStateNode>();
info = new SearchInfo();
setRowHeight(1);
}
/**
@@ -590,11 +590,11 @@
/**
* 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);
+ return treePathMapping.get(path);
}
/**
* Sent to completely rebuild the visible tree. All nodes are collapsed.
*/
@@ -693,17 +693,17 @@
}
if(onlyIfVisible)
return null;
// Check all the parent paths, until a match is found.
- Stack paths;
+ Stack<TreePath> paths;
if(tempStacks.size() == 0) {
- paths = new Stack();
+ paths = new Stack<TreePath>();
}
else {
- paths = (Stack)tempStacks.pop();
+ paths = tempStacks.pop();
}
try {
paths.push(path);
path = path.getParentPath();
@@ -712,11 +712,11 @@
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();
+ path = paths.pop();
node = node.createChildFor(path.
getLastPathComponent());
}
return node;
}
< prev index next >