提交 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) if(path == null)
return false; return false;
Object value;
// Is this node expanded? do{
Boolean value = expandedState.get(path); value = expandedState.get(path);
if(value == null || !((Boolean)value).booleanValue())
if(value == null || !value.booleanValue())
return false; return false;
} while( (path=path.getParentPath())!=null );
// It is, make sure its parent is also expanded.
TreePath parentPath = path.getParentPath();
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.
先完成此消息的编辑!
想要评论请 注册