mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8176530: JDK support for JavaFX modal print dialogs
Reviewed-by: serb, psadhukhan, kcr
This commit is contained in:
parent
8f4fb41bd7
commit
1fc6aae658
7 changed files with 125 additions and 2 deletions
|
@ -785,7 +785,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.
|
||||
|
@ -828,6 +830,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||
int x = gcBounds.x+50;
|
||||
int y = gcBounds.y+50;
|
||||
ServiceDialog pageDialog;
|
||||
if (onTop != null) {
|
||||
attributes.add(onTop);
|
||||
}
|
||||
if (w instanceof Frame) {
|
||||
pageDialog = new ServiceDialog(gc, x, y, service,
|
||||
DocFlavor.SERVICE_FORMATTED.PAGEABLE,
|
||||
|
@ -837,6 +842,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||
DocFlavor.SERVICE_FORMATTED.PAGEABLE,
|
||||
attributes, (Dialog)w);
|
||||
}
|
||||
|
||||
Rectangle dlgBounds = pageDialog.getBounds();
|
||||
|
||||
// if portion of dialog is not within the gc boundary
|
||||
|
@ -923,7 +929,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||
|
||||
}
|
||||
|
||||
setParentWindowID(attributes);
|
||||
boolean ret = printDialog();
|
||||
clearParentWindowID();
|
||||
this.attributes = attributes;
|
||||
return ret;
|
||||
|
||||
|
@ -2539,4 +2547,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue