提交 0542bda4 编写于 作者: A alexp

6684401: JTree isExpanded should not call itself recursively

Reviewed-by: rupashka
上级 8fb38719
...@@ -1986,20 +1986,17 @@ public class JTree extends JComponent implements Scrollable, Accessible ...@@ -1986,20 +1986,17 @@ public class JTree extends JComponent implements Scrollable, Accessible
* true if all nodes in the path are expanded * true if all nodes in the path are expanded
*/ */
public boolean isExpanded(TreePath path) { public boolean isExpanded(TreePath path) {
if(path == null)
return false;
// Is this node expanded?
Boolean value = expandedState.get(path);
if(value == null || !value.booleanValue()) if(path == null)
return false; return false;
Object value;
// It is, make sure its parent is also expanded. do{
TreePath parentPath = path.getParentPath(); value = expandedState.get(path);
if(value == null || !((Boolean)value).booleanValue())
return false;
} while( (path=path.getParentPath())!=null );
if(parentPath != null)
return isExpanded(parentPath);
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册