Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
8ac893cf
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看板
提交
8ac893cf
编写于
9月 08, 2014
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
450b8e58
2d5b70e2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
128 addition
and
11 deletion
+128
-11
.hgtags
.hgtags
+1
-0
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+6
-4
src/share/classes/javax/swing/JDesktopPane.java
src/share/classes/javax/swing/JDesktopPane.java
+2
-1
src/windows/native/sun/windows/awt_Component.cpp
src/windows/native/sun/windows/awt_Component.cpp
+4
-4
src/windows/native/sun/windows/awt_List.cpp
src/windows/native/sun/windows/awt_List.cpp
+2
-2
test/java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java
...ssByThreadsTest/WindowIsFocusableAccessByThreadsTest.java
+113
-0
未找到文件。
.hgtags
浏览文件 @
8ac893cf
...
...
@@ -328,4 +328,5 @@ eaaa9a04b9fdcfa4a830b811ed209eb2c45a4a6b jdk8u25-b12
c3a855402b923d3ba819b05292a971953fc8ed0b jdk8u25-b13
2a6df63ca0f0f59bb730638b05c72d77a23f93c8 jdk8u25-b14
412d9ade90401d098f3662bd688ab393008423bd jdk8u25-b15
f07bc5dab84c67f5d1dccbab318ee1c5485c852d jdk8u25-b16
f935349e2c065487c745bc41f81ddc7869bd2d2d jdk8u31-b00
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
8ac893cf
...
...
@@ -105,6 +105,8 @@ public class LWWindowPeer
private
final
SecurityWarningWindow
warningWindow
;
private
volatile
boolean
targetFocusable
;
/**
* Current modal blocker or null.
*
...
...
@@ -240,13 +242,12 @@ public class LWWindowPeer
if
(!
visible
&&
warningWindow
!=
null
)
{
warningWindow
.
setVisible
(
false
,
false
);
}
updateFocusableWindowState
();
super
.
setVisibleImpl
(
visible
);
// TODO: update graphicsConfig, see 4868278
platformWindow
.
setVisible
(
visible
);
if
(
isSimpleWindow
())
{
KeyboardFocusManagerPeer
kfmPeer
=
LWKeyboardFocusManagerPeer
.
getInstance
();
if
(
visible
)
{
if
(!
getTarget
().
isAutoRequestFocus
())
{
return
;
...
...
@@ -397,6 +398,7 @@ public class LWWindowPeer
@Override
public
void
updateFocusableWindowState
()
{
targetFocusable
=
getTarget
().
isFocusableWindow
();
platformWindow
.
updateFocusableWindowState
();
}
...
...
@@ -1220,13 +1222,13 @@ public class LWWindowPeer
}
private
boolean
isFocusableWindow
()
{
boolean
focusable
=
getTarget
().
isFocusableWindow
()
;
boolean
focusable
=
targetFocusable
;
if
(
isSimpleWindow
())
{
LWWindowPeer
ownerPeer
=
getOwnerFrameDialog
(
this
);
if
(
ownerPeer
==
null
)
{
return
false
;
}
return
focusable
&&
ownerPeer
.
getTarget
().
isFocusableWindow
()
;
return
focusable
&&
ownerPeer
.
targetFocusable
;
}
return
focusable
;
}
...
...
src/share/classes/javax/swing/JDesktopPane.java
浏览文件 @
8ac893cf
...
...
@@ -43,6 +43,7 @@ import java.io.IOException;
import
java.beans.PropertyVetoException
;
import
java.util.Set
;
import
java.util.TreeSet
;
import
java.util.LinkedHashSet
;
/**
* A container used to create a multiple-document interface or a virtual desktop.
* You create <code>JInternalFrame</code> objects and add them to the
...
...
@@ -266,7 +267,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible
private
static
Collection
<
JInternalFrame
>
getAllFrames
(
Container
parent
)
{
int
i
,
count
;
Collection
<
JInternalFrame
>
results
=
new
ArrayList
<
JInternalFrame
>();
Collection
<
JInternalFrame
>
results
=
new
LinkedHashSet
<
>();
count
=
parent
.
getComponentCount
();
for
(
i
=
0
;
i
<
count
;
i
++)
{
Component
next
=
parent
.
getComponent
(
i
);
...
...
src/windows/native/sun/windows/awt_Component.cpp
浏览文件 @
8ac893cf
...
...
@@ -6935,9 +6935,9 @@ Java_sun_awt_windows_WComponentPeer_nativeHandlesWheelScrolling (JNIEnv* env,
{
TRY
;
return
JNI_IS_TRUE
(
AwtToolkit
::
GetInstance
().
SyncCall
(
return
(
jboolean
)
AwtToolkit
::
GetInstance
().
SyncCall
(
(
void
*
(
*
)(
void
*
))
AwtComponent
::
_NativeHandlesWheelScrolling
,
env
->
NewGlobalRef
(
self
))
)
;
env
->
NewGlobalRef
(
self
));
// global ref is deleted in _NativeHandlesWheelScrolling
CATCH_BAD_ALLOC_RET
(
NULL
);
...
...
@@ -6956,9 +6956,9 @@ Java_sun_awt_windows_WComponentPeer_isObscured(JNIEnv* env,
jobject
selfGlobalRef
=
env
->
NewGlobalRef
(
self
);
return
JNI_IS_TRUE
(
AwtToolkit
::
GetInstance
().
SyncCall
(
return
(
jboolean
)
AwtToolkit
::
GetInstance
().
SyncCall
(
(
void
*
(
*
)(
void
*
))
AwtComponent
::
_IsObscured
,
(
void
*
)
selfGlobalRef
)
)
;
(
void
*
)
selfGlobalRef
);
// selfGlobalRef is deleted in _IsObscured
CATCH_BAD_ALLOC_RET
(
NULL
);
...
...
src/windows/native/sun/windows/awt_List.cpp
浏览文件 @
8ac893cf
...
...
@@ -1018,8 +1018,8 @@ Java_sun_awt_windows_WListPeer_isSelected(JNIEnv *env, jobject self,
ses
->
list
=
env
->
NewGlobalRef
(
self
);
ses
->
index
=
index
;
return
JNI_IS_TRUE
(
AwtToolkit
::
GetInstance
().
SyncCall
(
(
void
*
(
*
)(
void
*
))
AwtList
::
_IsSelected
,
ses
)
);
return
(
jboolean
)
AwtToolkit
::
GetInstance
().
SyncCall
(
(
void
*
(
*
)(
void
*
))
AwtList
::
_IsSelected
,
ses
);
// global ref and ses are deleted in _IsSelected
CATCH_BAD_ALLOC_RET
(
FALSE
);
...
...
test/java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java
0 → 100644
浏览文件 @
8ac893cf
/*
* Copyright (c) 2014 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 8047288
@summary Tests method isFocusable of Window component. It should be accessed only from EDT
@author artem.malinko@oracle.com
@library ../../regtesthelpers
@build Util
@run main WindowIsFocusableAccessByThreadsTest
*/
import
test.java.awt.regtesthelpers.Util
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.util.concurrent.atomic.AtomicBoolean
;
public
class
WindowIsFocusableAccessByThreadsTest
{
private
static
AtomicBoolean
testPassed
=
new
AtomicBoolean
(
true
);
private
static
volatile
TestFrame
frame
;
private
static
volatile
TestWindow
window
;
private
static
volatile
Button
openWindowBtn
;
public
static
void
main
(
String
[]
args
)
{
frame
=
new
TestFrame
(
"Test EDT access to Window components"
);
window
=
new
TestWindow
(
frame
);
SwingUtilities
.
invokeLater
(
WindowIsFocusableAccessByThreadsTest:
:
init
);
Util
.
waitTillShown
(
frame
);
Robot
robot
=
Util
.
createRobot
();
Util
.
clickOnComp
(
frame
,
robot
,
100
);
Util
.
clickOnComp
(
openWindowBtn
,
robot
,
100
);
Util
.
waitTillShown
(
window
);
if
(!
testPassed
.
get
())
{
throw
new
RuntimeException
(
"Window component methods has been accessed not "
+
"from Event Dispatching Thread"
);
}
}
private
static
void
init
()
{
frame
.
setSize
(
400
,
400
);
frame
.
setLayout
(
new
FlowLayout
());
openWindowBtn
=
new
Button
(
"open window"
);
openWindowBtn
.
addActionListener
(
e
->
{
window
.
setSize
(
100
,
100
);
window
.
setLocation
(
400
,
100
);
window
.
setVisible
(
true
);
});
frame
.
add
(
openWindowBtn
);
frame
.
setVisible
(
true
);
}
private
static
void
testThread
()
{
if
(!
SwingUtilities
.
isEventDispatchThread
())
{
testPassed
.
set
(
false
);
}
}
private
static
class
TestWindow
extends
Window
{
public
TestWindow
(
Frame
owner
)
{
super
(
owner
);
}
// isFocusable method is final and we can't add this test to it.
// But it invokes getFocusableWindowState and here we can check
// if thread is EDT.
@Override
public
boolean
getFocusableWindowState
()
{
testThread
();
return
super
.
getFocusableWindowState
();
}
}
private
static
class
TestFrame
extends
Frame
{
private
TestFrame
(
String
title
)
throws
HeadlessException
{
super
(
title
);
}
// isFocusable method is final and we can't add this test to it.
// But it invokes getFocusableWindowState and here we can check
// if thread is EDT.
@Override
public
boolean
getFocusableWindowState
()
{
testThread
();
return
super
.
getFocusableWindowState
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录