Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
865d4426
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看板
提交
865d4426
编写于
12月 02, 2009
作者:
A
ant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6566375: PIT : test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html
Reviewed-by: art, dcherepanov
上级
98869a89
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
65 deletion
+15
-65
test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java
...t/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java
+15
-65
未找到文件。
test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java
浏览文件 @
865d4426
...
...
@@ -50,13 +50,7 @@ test
import
java.applet.Applet
;
import
java.awt.*
;
import
java.lang.reflect.InvocationTargetException
;
import
java.awt.event.*
;
import
java.awt.peer.DialogPeer
;
import
java.awt.peer.ComponentPeer
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Proxy
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.InvocationTargetException
;
import
test.java.awt.regtesthelpers.Util
;
...
...
@@ -94,11 +88,13 @@ public class TestDialogTypeAhead extends Applet
}
},
AWTEvent
.
KEY_EVENT_MASK
);
KeyboardFocusManager
.
setCurrentKeyboardFocusManager
(
new
TestKFM
());
this
.
setLayout
(
new
BorderLayout
());
f
=
new
Frame
(
"frame"
);
b
=
new
Button
(
"press"
);
d
=
new
TestDialog
(
f
,
"dialog"
,
true
,
robotSema
);
d
=
new
Dialog
(
f
,
"dialog"
,
true
);
ok
=
new
Button
(
"ok"
);
d
.
add
(
ok
);
d
.
pack
();
...
...
@@ -170,6 +166,11 @@ public class TestDialogTypeAhead extends Applet
}
catch
(
InterruptedException
ie
)
{
throw
new
RuntimeException
(
"Interrupted!"
);
}
if
(!
robotSema
.
getState
())
{
throw
new
RuntimeException
(
"robotSema hasn't been triggered"
);
}
System
.
err
.
println
(
"typing ahead"
);
robot
.
keyPress
(
KeyEvent
.
VK_SPACE
);
robot
.
keyRelease
(
KeyEvent
.
VK_SPACE
);
waitForIdle
();
...
...
@@ -278,65 +279,14 @@ public class TestDialogTypeAhead extends Applet
}
}
// Fix for 6446952.
// In the process of showing the dialog we have to catch peer.show() call
// so that to trigger key events just before it gets invoked.
// We base on the fact that a modal dialog sets type-ahead markers
// before it calls 'show' on the peer.
// Posting the key events before dialog.setVisible(true) would be actually not
// good because it would be Ok to dispatch them to the current focus owner,
// not to the dialog.
class
TestDialog
extends
Dialog
{
ComponentPeer
origDialogPeer
;
ComponentPeer
proxyInstPeer
;
Semaphore
trigger
;
TestDialog
(
Frame
owner
,
String
title
,
boolean
modal
,
Semaphore
trigger
)
{
super
(
owner
,
title
,
modal
);
this
.
trigger
=
trigger
;
}
public
ComponentPeer
getPeer
()
{
ComponentPeer
ret
=
super
.
getPeer
();
if
(
ret
==
proxyInstPeer
)
{
return
origDialogPeer
;
}
else
{
return
ret
;
}
}
public
void
addNotify
()
{
super
.
addNotify
();
replacePeer
();
}
void
replacePeer
()
{
origDialogPeer
=
getPeer
();
InvocationHandler
handler
=
new
InvocationHandler
()
{
public
Object
invoke
(
Object
proxy
,
Method
method
,
Object
[]
args
)
{
if
(
method
.
getName
()
==
"show"
)
{
trigger
.
raise
();
}
Object
ret
=
null
;
try
{
ret
=
method
.
invoke
(
origDialogPeer
,
args
);
}
catch
(
IllegalAccessException
iae
)
{
throw
new
Error
(
"Test error."
,
iae
);
}
catch
(
InvocationTargetException
ita
)
{
throw
new
Error
(
"Test error."
,
ita
);
}
return
ret
;
}
};
proxyInstPeer
=
(
DialogPeer
)
Proxy
.
newProxyInstance
(
DialogPeer
.
class
.
getClassLoader
(),
new
Class
[]
{
DialogPeer
.
class
},
handler
);
class
TestKFM
extends
DefaultKeyboardFocusManager
{
protected
synchronized
void
enqueueKeyEvents
(
long
after
,
Component
untilFocused
)
{
super
.
enqueueKeyEvents
(
after
,
untilFocused
);
try
{
Util
.
getField
(
Component
.
class
,
"peer"
).
set
(
d
,
proxyInstPeer
);
}
catch
(
IllegalAccessException
iae
)
{
throw
new
Error
(
"Test error."
,
iae
);
if
(
untilFocused
==
TestDialogTypeAhead
.
this
.
ok
)
{
TestDialogTypeAhead
.
this
.
robotSema
.
raise
();
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录