Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
20d43859
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看板
提交
20d43859
编写于
3月 17, 2017
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8176530: JDK support for JavaFX modal print dialogs
Reviewed-by: serb, psadhukhan, kcr
上级
e0afd80b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
125 addition
and
2 deletion
+125
-2
src/share/classes/sun/print/DialogOnTop.java
src/share/classes/sun/print/DialogOnTop.java
+64
-0
src/share/classes/sun/print/RasterPrinterJob.java
src/share/classes/sun/print/RasterPrinterJob.java
+30
-0
src/share/classes/sun/print/ServiceDialog.java
src/share/classes/sun/print/ServiceDialog.java
+7
-0
src/windows/native/sun/windows/awt_PrintControl.cpp
src/windows/native/sun/windows/awt_PrintControl.cpp
+6
-0
src/windows/native/sun/windows/awt_PrintControl.h
src/windows/native/sun/windows/awt_PrintControl.h
+5
-0
src/windows/native/sun/windows/awt_PrintDialog.cpp
src/windows/native/sun/windows/awt_PrintDialog.cpp
+6
-1
src/windows/native/sun/windows/awt_PrintJob.cpp
src/windows/native/sun/windows/awt_PrintJob.cpp
+7
-1
未找到文件。
src/share/classes/sun/print/DialogOnTop.java
0 → 100644
浏览文件 @
20d43859
/*
* Copyright (c) 2017, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package
sun.print
;
import
javax.print.attribute.Attribute
;
import
javax.print.attribute.PrintRequestAttribute
;
/*
* An implementation class used to request the dialog be set always-on-top.
* It needs to be read and honoured by the dialog code which will use
* java.awt.Window.setAlwaysOnTop(true) in cases where it is supported.
*/
public
class
DialogOnTop
implements
PrintRequestAttribute
{
private
static
final
long
serialVersionUID
=
-
1901909867156076547L
;
long
id
;
public
DialogOnTop
()
{
}
public
DialogOnTop
(
long
id
)
{
this
.
id
=
id
;
}
public
final
Class
<?
extends
Attribute
>
getCategory
()
{
return
DialogOnTop
.
class
;
}
public
long
getID
()
{
return
id
;
}
public
final
String
getName
()
{
return
"dialog-on-top"
;
}
public
String
toString
()
{
return
"dialog-on-top"
;
}
}
src/share/classes/sun/print/RasterPrinterJob.java
浏览文件 @
20d43859
...
...
@@ -781,7 +781,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
PrintService
pservice
=
getPrintService
();
PageFormat
pageFrmAttrib
=
attributeToPageFormat
(
pservice
,
attributes
);
setParentWindowID
(
attributes
);
PageFormat
page
=
pageDialog
(
pageFrmAttrib
);
clearParentWindowID
();
// If user cancels the dialog, pageDialog() will return the original
// page object and as per spec, we should return null in that case.
...
...
@@ -816,6 +818,10 @@ public abstract class RasterPrinterJob extends PrinterJob {
return
null
;
}
if
(
onTop
!=
null
)
{
attributes
.
add
(
onTop
);
}
ServiceDialog
pageDialog
=
new
ServiceDialog
(
gc
,
x
,
y
,
service
,
DocFlavor
.
SERVICE_FORMATTED
.
PAGEABLE
,
attributes
,
(
Frame
)
null
);
...
...
@@ -880,7 +886,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
}
setParentWindowID
(
attributes
);
boolean
ret
=
printDialog
();
clearParentWindowID
();
this
.
attributes
=
attributes
;
return
ret
;
...
...
@@ -2438,4 +2446,26 @@ public abstract class RasterPrinterJob extends PrinterJob {
return
new
String
(
out_chars
,
0
,
pos
);
}
}
private
DialogOnTop
onTop
=
null
;
private
long
parentWindowID
=
0L
;
/* Called from native code */
private
long
getParentWindowID
()
{
return
parentWindowID
;
}
private
void
clearParentWindowID
()
{
parentWindowID
=
0L
;
onTop
=
null
;
}
private
void
setParentWindowID
(
PrintRequestAttributeSet
attrs
)
{
parentWindowID
=
0L
;
onTop
=
(
DialogOnTop
)
attrs
.
get
(
DialogOnTop
.
class
);
if
(
onTop
!=
null
)
{
parentWindowID
=
onTop
.
getID
();
}
}
}
src/share/classes/sun/print/ServiceDialog.java
浏览文件 @
20d43859
...
...
@@ -183,6 +183,9 @@ public class ServiceDialog extends JDialog implements ActionListener {
isAWT
=
true
;
}
if
(
attributes
.
get
(
DialogOnTop
.
class
)
!=
null
)
{
setAlwaysOnTop
(
true
);
}
Container
c
=
getContentPane
();
c
.
setLayout
(
new
BorderLayout
());
...
...
@@ -274,6 +277,10 @@ public class ServiceDialog extends JDialog implements ActionListener {
this
.
asOriginal
=
attributes
;
this
.
asCurrent
=
new
HashPrintRequestAttributeSet
(
attributes
);
if
(
attributes
.
get
(
DialogOnTop
.
class
)
!=
null
)
{
setAlwaysOnTop
(
true
);
}
Container
c
=
getContentPane
();
c
.
setLayout
(
new
BorderLayout
());
...
...
src/windows/native/sun/windows/awt_PrintControl.cpp
浏览文件 @
20d43859
...
...
@@ -54,6 +54,7 @@ jmethodID AwtPrintControl::getDevmodeID;
jmethodID
AwtPrintControl
::
setDevmodeID
;
jmethodID
AwtPrintControl
::
getDevnamesID
;
jmethodID
AwtPrintControl
::
setDevnamesID
;
jmethodID
AwtPrintControl
::
getParentWindowID
;
jfieldID
AwtPrintControl
::
driverDoesMultipleCopiesID
;
jfieldID
AwtPrintControl
::
driverDoesCollationID
;
jmethodID
AwtPrintControl
::
getWin32MediaID
;
...
...
@@ -240,6 +241,11 @@ void AwtPrintControl::initIDs(JNIEnv *env, jclass cls)
DASSERT
(
AwtPrintControl
::
dialogOwnerPeerID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
dialogOwnerPeerID
);
AwtPrintControl
::
getParentWindowID
=
env
->
GetMethodID
(
cls
,
"getParentWindowID"
,
"()J"
);
DASSERT
(
AwtPrintControl
::
getParentWindowID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getParentWindowID
);
AwtPrintControl
::
getPrintDCID
=
env
->
GetMethodID
(
cls
,
"getPrintDC"
,
"()J"
);
DASSERT
(
AwtPrintControl
::
getPrintDCID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getPrintDCID
);
...
...
src/windows/native/sun/windows/awt_PrintControl.h
浏览文件 @
20d43859
...
...
@@ -47,6 +47,7 @@ public:
static
jmethodID
setDevmodeID
;
static
jmethodID
getDevnamesID
;
static
jmethodID
setDevnamesID
;
static
jmethodID
getParentWindowID
;
static
jmethodID
getWin32MediaID
;
static
jmethodID
setWin32MediaID
;
static
jmethodID
getWin32MediaTrayID
;
...
...
@@ -97,6 +98,10 @@ public:
LPTSTR
pPrinterName
,
LPDEVMODE
*
pDevMode
);
inline
static
HWND
getParentID
(
JNIEnv
*
env
,
jobject
self
)
{
return
(
HWND
)
env
->
CallLongMethod
(
self
,
getParentWindowID
);
}
inline
static
HDC
getPrintDC
(
JNIEnv
*
env
,
jobject
self
)
{
return
(
HDC
)
env
->
CallLongMethod
(
self
,
getPrintDCID
);
}
...
...
src/windows/native/sun/windows/awt_PrintDialog.cpp
浏览文件 @
20d43859
...
...
@@ -248,6 +248,11 @@ Java_sun_awt_windows_WPrintDialogPeer__1show(JNIEnv *env, jobject peer)
pd
.
lpfnPrintHook
=
(
LPPRINTHOOKPROC
)
PrintDialogHookProc
;
pd
.
lpfnSetupHook
=
(
LPSETUPHOOKPROC
)
PrintDialogHookProc
;
pd
.
Flags
|=
PD_ENABLESETUPHOOK
|
PD_ENABLEPRINTHOOK
;
HWND
parent
=
AwtPrintControl
::
getParentID
(
env
,
control
);
if
(
parent
!=
NULL
&&
::
IsWindow
(
parent
))
{
// Windows native modality is requested (used by JavaFX).
pd
.
hwndOwner
=
parent
;
}
/*
Fix for 6488834.
To disable Win32 native parent modality we have to set
...
...
@@ -255,7 +260,7 @@ Java_sun_awt_windows_WPrintDialogPeer__1show(JNIEnv *env, jobject peer)
parentless dialogs we use NULL to show them in the taskbar,
and for all other dialogs AwtToolkit's HWND is used.
*/
if
(
awtParent
!=
NULL
)
else
if
(
awtParent
!=
NULL
)
{
pd
.
hwndOwner
=
AwtToolkit
::
GetInstance
().
GetHWnd
();
}
...
...
src/windows/native/sun/windows/awt_PrintJob.cpp
浏览文件 @
20d43859
...
...
@@ -521,12 +521,18 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
AwtComponent
*
awtParent
=
(
parent
!=
NULL
)
?
(
AwtComponent
*
)
JNI_GET_PDATA
(
parent
)
:
NULL
;
HWND
hwndOwner
=
awtParent
?
awtParent
->
GetHWnd
()
:
NULL
;
jboolean
doIt
=
JNI_FALSE
;
// Assume the user will cancel the dialog.
PAGESETUPDLG
setup
;
memset
(
&
setup
,
0
,
sizeof
(
setup
));
setup
.
lStructSize
=
sizeof
(
setup
);
HWND
parentID
=
AwtPrintControl
::
getParentID
(
env
,
self
);
if
(
parentID
!=
NULL
&&
::
IsWindow
(
parentID
))
{
// windows native modality is requested (used by JavaFX).
setup
.
hwndOwner
=
parentID
;
}
/*
Fix for 6488834.
To disable Win32 native parent modality we have to set
...
...
@@ -534,7 +540,7 @@ Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
parentless dialogs we use NULL to show them in the taskbar,
and for all other dialogs AwtToolkit's HWND is used.
*/
if
(
awtParent
!=
NULL
)
else
if
(
awtParent
!=
NULL
)
{
setup
.
hwndOwner
=
AwtToolkit
::
GetInstance
().
GetHWnd
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录