Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
2e3ff1bd
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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,发现更多精彩内容 >>
提交
2e3ff1bd
编写于
3月 02, 2017
作者:
M
mcherkas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8171808: Performance problems in dialogs with large tables when JAB activated
Reviewed-by: serb, alexsch
上级
e2230fbe
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
181 addition
and
2 deletion
+181
-2
src/windows/classes/com/sun/java/accessibility/AccessBridge.java
...dows/classes/com/sun/java/accessibility/AccessBridge.java
+181
-2
未找到文件。
src/windows/classes/com/sun/java/accessibility/AccessBridge.java
浏览文件 @
2e3ff1bd
...
...
@@ -4625,6 +4625,10 @@ final public class AccessBridge extends AccessBridgeLoader {
private
void
_getVisibleChildrenCount
(
final
AccessibleContext
ac
)
{
if
(
ac
==
null
)
return
;
if
(
ac
instanceof
AccessibleExtendedTable
)
{
_getVisibleChildrenCount
((
AccessibleExtendedTable
)
ac
);
return
;
}
int
numChildren
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Integer
>()
{
@Override
public
Integer
call
()
throws
Exception
{
...
...
@@ -4666,6 +4670,83 @@ final public class AccessBridge extends AccessBridgeLoader {
}
}
/*
* Recursively descends AccessibleContext and gets the number
* of visible children. Stops search if get to invisible part of table.
*/
private
void
_getVisibleChildrenCount
(
final
AccessibleExtendedTable
acTable
)
{
if
(
acTable
==
null
)
return
;
int
lastVisibleRow
=
-
1
;
int
lastVisibleColumn
=
-
1
;
boolean
foundVisible
=
false
;
int
rowCount
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Integer
>()
{
@Override
public
Integer
call
()
throws
Exception
{
return
acTable
.
getAccessibleRowCount
();
}
},
acTable
);
int
columnCount
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Integer
>()
{
@Override
public
Integer
call
()
throws
Exception
{
return
acTable
.
getAccessibleColumnCount
();
}
},
acTable
);
for
(
int
rowIdx
=
0
;
rowIdx
<
rowCount
;
rowIdx
++)
{
for
(
int
columnIdx
=
0
;
columnIdx
<
columnCount
;
columnIdx
++)
{
if
(
lastVisibleRow
!=
-
1
&&
rowIdx
>
lastVisibleRow
)
{
continue
;
}
if
(
lastVisibleColumn
!=
-
1
&&
columnIdx
>
lastVisibleColumn
)
{
continue
;
}
int
finalRowIdx
=
rowIdx
;
int
finalColumnIdx
=
columnIdx
;
final
AccessibleContext
ac2
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
AccessibleContext
>()
{
@Override
public
AccessibleContext
call
()
throws
Exception
{
Accessible
a
=
acTable
.
getAccessibleAt
(
finalRowIdx
,
finalColumnIdx
);
if
(
a
==
null
)
return
null
;
else
return
a
.
getAccessibleContext
();
}
},
acTable
);
if
(
ac2
==
null
||
(!
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Boolean
>()
{
@Override
public
Boolean
call
()
throws
Exception
{
return
ac2
.
getAccessibleStateSet
().
contains
(
AccessibleState
.
SHOWING
);
}
},
acTable
))
)
{
if
(
foundVisible
)
{
if
(
columnIdx
!=
0
&&
lastVisibleColumn
==
-
1
)
{
//the same row, so we found the last visible column
lastVisibleColumn
=
columnIdx
-
1
;
}
else
if
(
columnIdx
==
0
&&
lastVisibleRow
==
-
1
)
{
lastVisibleRow
=
rowIdx
-
1
;
}
}
continue
;
}
foundVisible
=
true
;
_visibleChildrenCount
++;
if
(
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Integer
>()
{
@Override
public
Integer
call
()
throws
Exception
{
return
ac2
.
getAccessibleChildrenCount
();
}
},
acTable
)
>
0
)
{
_getVisibleChildrenCount
(
ac2
);
}
}
}
}
/**
* Gets the visible child of an AccessibleContext at the
* specified index
...
...
@@ -4702,7 +4783,10 @@ final public class AccessBridge extends AccessBridgeLoader {
if
(
_visibleChild
!=
null
)
{
return
;
}
if
(
ac
instanceof
AccessibleExtendedTable
)
{
_getVisibleChild
((
AccessibleExtendedTable
)
ac
,
index
);
return
;
}
int
numChildren
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Integer
>()
{
@Override
public
Integer
call
()
throws
Exception
{
...
...
@@ -4711,7 +4795,7 @@ final public class AccessBridge extends AccessBridgeLoader {
},
ac
);
for
(
int
i
=
0
;
i
<
numChildren
;
i
++)
{
final
int
idx
=
i
;
final
AccessibleContext
ac2
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
AccessibleContext
>()
{
final
AccessibleContext
ac2
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
AccessibleContext
>()
{
@Override
public
AccessibleContext
call
()
throws
Exception
{
Accessible
a
=
ac
.
getAccessibleChild
(
idx
);
...
...
@@ -4748,6 +4832,82 @@ final public class AccessBridge extends AccessBridgeLoader {
}
}
private
void
_getVisibleChild
(
final
AccessibleExtendedTable
acTable
,
final
int
index
)
{
if
(
_visibleChild
!=
null
)
{
return
;
}
int
lastVisibleRow
=
-
1
;
int
lastVisibleColumn
=
-
1
;
boolean
foundVisible
=
false
;
int
rowCount
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Integer
>()
{
@Override
public
Integer
call
()
throws
Exception
{
return
acTable
.
getAccessibleRowCount
();
}
},
acTable
);
int
columnCount
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Integer
>()
{
@Override
public
Integer
call
()
throws
Exception
{
return
acTable
.
getAccessibleColumnCount
();
}
},
acTable
);
for
(
int
rowIdx
=
0
;
rowIdx
<
rowCount
;
rowIdx
++)
{
for
(
int
columnIdx
=
0
;
columnIdx
<
columnCount
;
columnIdx
++)
{
if
(
lastVisibleRow
!=
-
1
&&
rowIdx
>
lastVisibleRow
)
{
continue
;
}
if
(
lastVisibleColumn
!=
-
1
&&
columnIdx
>
lastVisibleColumn
)
{
continue
;
}
int
finalRowIdx
=
rowIdx
;
int
finalColumnIdx
=
columnIdx
;
final
AccessibleContext
ac2
=
InvocationUtils
.
invokeAndWait
(
new
Callable
<
AccessibleContext
>()
{
@Override
public
AccessibleContext
call
()
throws
Exception
{
Accessible
a
=
acTable
.
getAccessibleAt
(
finalRowIdx
,
finalColumnIdx
);
if
(
a
==
null
)
return
null
;
else
return
a
.
getAccessibleContext
();
}
},
acTable
);
if
(
ac2
==
null
||
(!
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Boolean
>()
{
@Override
public
Boolean
call
()
throws
Exception
{
return
ac2
.
getAccessibleStateSet
().
contains
(
AccessibleState
.
SHOWING
);
}
},
acTable
)))
{
if
(
foundVisible
)
{
if
(
columnIdx
!=
0
&&
lastVisibleColumn
==
-
1
)
{
//the same row, so we found the last visible column
lastVisibleColumn
=
columnIdx
-
1
;
}
else
if
(
columnIdx
==
0
&&
lastVisibleRow
==
-
1
)
{
lastVisibleRow
=
rowIdx
-
1
;
}
}
continue
;
}
foundVisible
=
true
;
if
(!
_foundVisibleChild
&&
_currentVisibleIndex
==
index
)
{
_visibleChild
=
ac2
;
_foundVisibleChild
=
true
;
return
;
}
_currentVisibleIndex
++;
if
(
InvocationUtils
.
invokeAndWait
(
new
Callable
<
Integer
>()
{
@Override
public
Integer
call
()
throws
Exception
{
return
ac2
.
getAccessibleChildrenCount
();
}
},
acTable
)
>
0
)
{
_getVisibleChild
(
ac2
,
index
);
}
}
}
}
/* ===== Java object memory management code ===== */
...
...
@@ -7123,6 +7283,25 @@ final public class AccessBridge extends AccessBridgeLoader {
*/
private
static
class
InvocationUtils
{
/**
* Invokes a {@code Callable} in the {@code AppContext} of the given {@code Accessible}
* and waits for it to finish blocking the caller thread.
*
* @param callable the {@code Callable} to invoke
* @param accessibleTable the {@code AccessibleExtendedTable} which would be used to find the right context
* for the task execution
* @param <T> type parameter for the result value
*
* @return the result of the {@code Callable} execution
*/
public
static
<
T
>
T
invokeAndWait
(
final
Callable
<
T
>
callable
,
final
AccessibleExtendedTable
accessibleTable
)
{
if
(
accessibleTable
instanceof
AccessibleContext
)
{
return
invokeAndWait
(
callable
,
(
AccessibleContext
)
accessibleTable
);
}
throw
new
RuntimeException
(
"Unmapped AccessibleContext used to dispatch event: "
+
accessibleTable
);
}
/**
* Invokes a {@code Callable} in the {@code AppContext} of the given {@code Accessible}
* and waits for it to finish blocking the caller thread.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录