Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
bd49191e
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bd49191e
编写于
2月 17, 2015
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
f27f1b40
846bf498
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
14 deletion
+49
-14
src/share/classes/javax/swing/JTree.java
src/share/classes/javax/swing/JTree.java
+49
-14
未找到文件。
src/share/classes/javax/swing/JTree.java
浏览文件 @
bd49191e
/*
* Copyright (c) 1997, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -872,9 +872,10 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
treeModelListener
!=
null
)
treeModel
.
addTreeModelListener
(
treeModelListener
);
// Mark the root as expanded, if it isn't a leaf.
if
(
treeModel
.
getRoot
()
!=
null
&&
!
treeModel
.
isLeaf
(
treeModel
.
getRoot
()))
{
expandedState
.
put
(
new
TreePath
(
treeModel
.
getRoot
()),
Object
treeRoot
=
treeModel
.
getRoot
();
if
(
treeRoot
!=
null
&&
!
treeModel
.
isLeaf
(
treeRoot
))
{
expandedState
.
put
(
new
TreePath
(
treeRoot
),
Boolean
.
TRUE
);
}
}
...
...
@@ -3223,6 +3224,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
int
count
=
indexs
.
length
;
Object
parent
=
model
.
getRoot
();
if
(
parent
==
null
)
return
null
;
TreePath
parentPath
=
new
TreePath
(
parent
);
for
(
int
counter
=
0
;
counter
<
count
;
counter
++)
{
...
...
@@ -3798,8 +3802,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
parent
.
getPathCount
()
==
1
)
{
// New root, remove everything!
clearToggledPaths
();
if
(
treeModel
.
getRoot
()
!=
null
&&
!
treeModel
.
isLeaf
(
treeModel
.
getRoot
()))
{
Object
treeRoot
=
treeModel
.
getRoot
();
if
(
treeRoot
!=
null
&&
!
treeModel
.
isLeaf
(
treeRoot
))
{
// Mark the root as expanded, if it isn't a leaf.
expandedState
.
put
(
parent
,
Boolean
.
TRUE
);
}
...
...
@@ -4283,7 +4288,11 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
model
==
null
)
{
return
null
;
}
TreePath
path
=
new
TreePath
(
model
.
getRoot
());
Object
treeRoot
=
model
.
getRoot
();
if
(
treeRoot
==
null
)
return
null
;
TreePath
path
=
new
TreePath
(
treeRoot
);
if
(
JTree
.
this
.
isVisible
(
path
))
{
TreeCellRenderer
r
=
JTree
.
this
.
getCellRenderer
();
TreeUI
ui
=
JTree
.
this
.
getUI
();
...
...
@@ -4296,8 +4305,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
boolean
expanded
=
JTree
.
this
.
isExpanded
(
path
);
return
r
.
getTreeCellRendererComponent
(
JTree
.
this
,
model
.
getRoot
()
,
selected
,
expanded
,
model
.
isLeaf
(
model
.
getRoot
()
),
row
,
hasFocus
);
treeRoot
,
selected
,
expanded
,
model
.
isLeaf
(
treeRoot
),
row
,
hasFocus
);
}
}
return
null
;
...
...
@@ -4350,8 +4359,11 @@ public class JTree extends JComponent implements Scrollable, Accessible
return
1
;
// the root node
}
Object
treeRoot
=
model
.
getRoot
();
if
(
treeRoot
==
null
)
return
0
;
// return the root's first set of children count
return
model
.
getChildCount
(
model
.
getRoot
()
);
return
model
.
getChildCount
(
treeRoot
);
}
/**
...
...
@@ -4365,9 +4377,17 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
model
==
null
)
{
return
null
;
}
Object
treeRoot
=
model
.
getRoot
();
if
(
treeRoot
==
null
)
{
return
null
;
}
if
(
isRootVisible
())
{
if
(
i
==
0
)
{
// return the root node Accessible
Object
[]
objPath
=
{
model
.
getRoot
()
};
Object
[]
objPath
=
{
treeRoot
};
if
(
objPath
[
0
]
==
null
)
return
null
;
TreePath
path
=
new
TreePath
(
objPath
);
return
new
AccessibleJTreeNode
(
JTree
.
this
,
path
,
JTree
.
this
);
}
else
{
...
...
@@ -4376,12 +4396,14 @@ public class JTree extends JComponent implements Scrollable, Accessible
}
// return Accessible for one of root's child nodes
int
count
=
model
.
getChildCount
(
model
.
getRoot
()
);
int
count
=
model
.
getChildCount
(
treeRoot
);
if
(
i
<
0
||
i
>=
count
)
{
return
null
;
}
Object
obj
=
model
.
getChild
(
model
.
getRoot
(),
i
);
Object
[]
objPath
=
{
model
.
getRoot
(),
obj
};
Object
obj
=
model
.
getChild
(
treeRoot
,
i
);
if
(
obj
==
null
)
return
null
;
Object
[]
objPath
=
{
treeRoot
,
obj
};
TreePath
path
=
new
TreePath
(
objPath
);
return
new
AccessibleJTreeNode
(
JTree
.
this
,
path
,
JTree
.
this
);
}
...
...
@@ -4420,6 +4442,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
public
int
getAccessibleSelectionCount
()
{
Object
[]
rootPath
=
new
Object
[
1
];
rootPath
[
0
]
=
treeModel
.
getRoot
();
if
(
rootPath
[
0
]
==
null
)
return
0
;
TreePath
childPath
=
new
TreePath
(
rootPath
);
if
(
JTree
.
this
.
isPathSelected
(
childPath
))
{
return
1
;
...
...
@@ -4442,6 +4467,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
i
==
0
)
{
Object
[]
rootPath
=
new
Object
[
1
];
rootPath
[
0
]
=
treeModel
.
getRoot
();
if
(
rootPath
[
0
]
==
null
)
return
null
;
TreePath
childPath
=
new
TreePath
(
rootPath
);
if
(
JTree
.
this
.
isPathSelected
(
childPath
))
{
return
new
AccessibleJTreeNode
(
JTree
.
this
,
childPath
,
JTree
.
this
);
...
...
@@ -4461,6 +4488,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
i
==
0
)
{
Object
[]
rootPath
=
new
Object
[
1
];
rootPath
[
0
]
=
treeModel
.
getRoot
();
if
(
rootPath
[
0
]
==
null
)
return
false
;
TreePath
childPath
=
new
TreePath
(
rootPath
);
return
JTree
.
this
.
isPathSelected
(
childPath
);
}
else
{
...
...
@@ -4482,6 +4511,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
model
!=
null
)
{
if
(
i
==
0
)
{
Object
[]
objPath
=
{
model
.
getRoot
()};
if
(
objPath
[
0
]
==
null
)
return
;
TreePath
path
=
new
TreePath
(
objPath
);
JTree
.
this
.
addSelectionPath
(
path
);
}
...
...
@@ -4500,6 +4531,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
model
!=
null
)
{
if
(
i
==
0
)
{
Object
[]
objPath
=
{
model
.
getRoot
()};
if
(
objPath
[
0
]
==
null
)
return
;
TreePath
path
=
new
TreePath
(
objPath
);
JTree
.
this
.
removeSelectionPath
(
path
);
}
...
...
@@ -4525,6 +4558,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
TreeModel
model
=
JTree
.
this
.
getModel
();
if
(
model
!=
null
)
{
Object
[]
objPath
=
{
model
.
getRoot
()};
if
(
objPath
[
0
]
==
null
)
return
;
TreePath
path
=
new
TreePath
(
objPath
);
JTree
.
this
.
addSelectionPath
(
path
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录