Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d3bf0188
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看板
提交
d3bf0188
编写于
2月 22, 2013
作者:
J
jgodinez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8006110: pageDialog is showing the swing dialog with DialogTypeSelection.NATIVE
Reviewed-by: bae, prr
上级
87ae18d2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
96 addition
and
73 deletion
+96
-73
src/share/classes/sun/print/RasterPrinterJob.java
src/share/classes/sun/print/RasterPrinterJob.java
+96
-73
未找到文件。
src/share/classes/sun/print/RasterPrinterJob.java
浏览文件 @
d3bf0188
...
...
@@ -527,9 +527,92 @@ public abstract class RasterPrinterJob extends PrinterJob {
}
}
private
PageFormat
attributeToPageFormat
(
PrintService
service
,
PrintRequestAttributeSet
attSet
)
{
PageFormat
page
=
defaultPage
();
if
(
service
==
null
)
{
return
page
;
}
OrientationRequested
orient
=
(
OrientationRequested
)
attSet
.
get
(
OrientationRequested
.
class
);
if
(
orient
==
null
)
{
orient
=
(
OrientationRequested
)
service
.
getDefaultAttributeValue
(
OrientationRequested
.
class
);
}
if
(
orient
==
OrientationRequested
.
REVERSE_LANDSCAPE
)
{
page
.
setOrientation
(
PageFormat
.
REVERSE_LANDSCAPE
);
}
else
if
(
orient
==
OrientationRequested
.
LANDSCAPE
)
{
page
.
setOrientation
(
PageFormat
.
LANDSCAPE
);
}
else
{
page
.
setOrientation
(
PageFormat
.
PORTRAIT
);
}
Media
media
=
(
Media
)
attSet
.
get
(
Media
.
class
);
if
(
media
==
null
)
{
media
=
(
Media
)
service
.
getDefaultAttributeValue
(
Media
.
class
);
}
if
(!(
media
instanceof
MediaSizeName
))
{
media
=
MediaSizeName
.
NA_LETTER
;
}
MediaSize
size
=
MediaSize
.
getMediaSizeForName
((
MediaSizeName
)
media
);
if
(
size
==
null
)
{
size
=
MediaSize
.
NA
.
LETTER
;
}
Paper
paper
=
new
Paper
();
float
dim
[]
=
size
.
getSize
(
1
);
//units == 1 to avoid FP error
double
w
=
Math
.
rint
((
dim
[
0
]*
72.0
)/
Size2DSyntax
.
INCH
);
double
h
=
Math
.
rint
((
dim
[
1
]*
72.0
)/
Size2DSyntax
.
INCH
);
paper
.
setSize
(
w
,
h
);
MediaPrintableArea
area
=
(
MediaPrintableArea
)
attSet
.
get
(
MediaPrintableArea
.
class
);
double
ix
,
iw
,
iy
,
ih
;
if
(
area
!=
null
)
{
// Should pass in same unit as updatePageAttributes
// to avoid rounding off errors.
ix
=
Math
.
rint
(
area
.
getX
(
MediaPrintableArea
.
INCH
)
*
DPI
);
iy
=
Math
.
rint
(
area
.
getY
(
MediaPrintableArea
.
INCH
)
*
DPI
);
iw
=
Math
.
rint
(
area
.
getWidth
(
MediaPrintableArea
.
INCH
)
*
DPI
);
ih
=
Math
.
rint
(
area
.
getHeight
(
MediaPrintableArea
.
INCH
)
*
DPI
);
}
else
{
if
(
w
>=
72.0
*
6.0
)
{
ix
=
72.0
;
iw
=
w
-
2
*
72.0
;
}
else
{
ix
=
w
/
6.0
;
iw
=
w
*
0.75
;
}
if
(
h
>=
72.0
*
6.0
)
{
iy
=
72.0
;
ih
=
h
-
2
*
72.0
;
}
else
{
iy
=
h
/
6.0
;
ih
=
h
*
0.75
;
}
}
paper
.
setImageableArea
(
ix
,
iy
,
iw
,
ih
);
page
.
setPaper
(
paper
);
return
page
;
}
protected
void
updatePageAttributes
(
PrintService
service
,
PageFormat
page
)
{
updateAttributesWithPageFormat
(
service
,
page
,
this
.
attributes
);
}
protected
void
updateAttributesWithPageFormat
(
PrintService
service
,
PageFormat
page
,
PrintRequestAttributeSet
attributes
)
{
if
(
service
==
null
||
page
==
null
)
{
return
;
}
...
...
@@ -659,6 +742,18 @@ public abstract class RasterPrinterJob extends PrinterJob {
throw
new
HeadlessException
();
}
DialogTypeSelection
dlg
=
(
DialogTypeSelection
)
attributes
.
get
(
DialogTypeSelection
.
class
);
// Check for native, note that default dialog is COMMON.
if
(
dlg
==
DialogTypeSelection
.
NATIVE
)
{
PrintService
pservice
=
getPrintService
();
PageFormat
page
=
pageDialog
(
attributeToPageFormat
(
pservice
,
attributes
));
updateAttributesWithPageFormat
(
pservice
,
page
,
attributes
);
return
page
;
}
final
GraphicsConfiguration
gc
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
().
getDefaultScreenDevice
().
getDefaultConfiguration
();
...
...
@@ -698,77 +793,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
attributes
.
remove
(
amCategory
);
}
attributes
.
addAll
(
newas
);
PageFormat
page
=
defaultPage
();
OrientationRequested
orient
=
(
OrientationRequested
)
attributes
.
get
(
OrientationRequested
.
class
);
int
pfOrient
=
PageFormat
.
PORTRAIT
;
if
(
orient
!=
null
)
{
if
(
orient
==
OrientationRequested
.
REVERSE_LANDSCAPE
)
{
pfOrient
=
PageFormat
.
REVERSE_LANDSCAPE
;
}
else
if
(
orient
==
OrientationRequested
.
LANDSCAPE
)
{
pfOrient
=
PageFormat
.
LANDSCAPE
;
}
}
page
.
setOrientation
(
pfOrient
);
Media
media
=
(
Media
)
attributes
.
get
(
Media
.
class
);
if
(
media
==
null
)
{
media
=
(
Media
)
service
.
getDefaultAttributeValue
(
Media
.
class
);
}
if
(!(
media
instanceof
MediaSizeName
))
{
media
=
MediaSizeName
.
NA_LETTER
;
}
MediaSize
size
=
MediaSize
.
getMediaSizeForName
((
MediaSizeName
)
media
);
if
(
size
==
null
)
{
size
=
MediaSize
.
NA
.
LETTER
;
}
Paper
paper
=
new
Paper
();
float
dim
[]
=
size
.
getSize
(
1
);
//units == 1 to avoid FP error
double
w
=
Math
.
rint
((
dim
[
0
]*
72.0
)/
Size2DSyntax
.
INCH
);
double
h
=
Math
.
rint
((
dim
[
1
]*
72.0
)/
Size2DSyntax
.
INCH
);
paper
.
setSize
(
w
,
h
);
MediaPrintableArea
area
=
(
MediaPrintableArea
)
attributes
.
get
(
MediaPrintableArea
.
class
);
double
ix
,
iw
,
iy
,
ih
;
if
(
area
!=
null
)
{
// Should pass in same unit as updatePageAttributes
// to avoid rounding off errors.
ix
=
Math
.
rint
(
area
.
getX
(
MediaPrintableArea
.
INCH
)
*
DPI
);
iy
=
Math
.
rint
(
area
.
getY
(
MediaPrintableArea
.
INCH
)
*
DPI
);
iw
=
Math
.
rint
(
area
.
getWidth
(
MediaPrintableArea
.
INCH
)
*
DPI
);
ih
=
Math
.
rint
(
area
.
getHeight
(
MediaPrintableArea
.
INCH
)
*
DPI
);
}
else
{
if
(
w
>=
72.0
*
6.0
)
{
ix
=
72.0
;
iw
=
w
-
2
*
72.0
;
}
else
{
ix
=
w
/
6.0
;
iw
=
w
*
0.75
;
}
if
(
h
>=
72.0
*
6.0
)
{
iy
=
72.0
;
ih
=
h
-
2
*
72.0
;
}
else
{
iy
=
h
/
6.0
;
ih
=
h
*
0.75
;
}
}
paper
.
setImageableArea
(
ix
,
iy
,
iw
,
ih
);
page
.
setPaper
(
paper
);
return
page
;
return
attributeToPageFormat
(
service
,
attributes
);
}
else
{
return
null
;
}
...
...
@@ -795,7 +820,6 @@ public abstract class RasterPrinterJob extends PrinterJob {
throw
new
HeadlessException
();
}
DialogTypeSelection
dlg
=
(
DialogTypeSelection
)
attributes
.
get
(
DialogTypeSelection
.
class
);
...
...
@@ -816,7 +840,6 @@ public abstract class RasterPrinterJob extends PrinterJob {
}
/* A security check has already been performed in the
* java.awt.print.printerJob.getPrinterJob method.
* So by the time we get here, it is OK for the current thread
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录