[OpenJDK 2D-Dev] [9] RFR JDK-7064425: PageFormat Dialog has no owner window to reactivate
Jayathirth D V
jayathirth.d.v at oracle.com
Tue Sep 13 07:58:06 UTC 2016
Hi Prasanta,
Changes are working fine.
In both test cases you are not using "private static Label dialogName;". Please remove it. Also some lines are more than 80 characters length and test case has trailing spaces. Please rectify these things before pushing. No need for one more review.
Thanks,
Jay
From: Philip Race
Sent: Saturday, September 10, 2016 12:32 AM
To: Prasanta Sadhukhan
Cc: 2d-dev
Subject: Re: [OpenJDK 2D-Dev] [9] RFR JDK-7064425: PageFormat Dialog has no owner window to reactivate
Sorry, right that won't work .. this is an expression evaluation and the compiler needs to
determine the return type which is going to end up back as Window as the most-specific super-type.
Details in 15.25.3 http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.25
So it won't help us make this code neater. I guess we'll just live with it.
+1
-phil.
On 9/1/16, 2:16 AM, Prasanta Sadhukhan wrote:
Hi Phil,
Please find the modified webrev
HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/7064425/webrev.02/"http://cr.openjdk.java.net/~psadhukhan/7064425/webrev.02/
This takes care of removing DialogOwner attribute before printDialog returns.
However, I could not use the same optimisation in WPrinterJob as mentioned
>>WPrintDialog dialog = new WPrintDialog(((owner instanceof Frame) ? (Frame)owner : (Dialog)owner), this)
because it caused compilation failure saying
[no suitable constructor found for WPrintDialog((owner ins[...]owner,WPrinterJob)
WPrintDialog dialog = new WPrintDialog(
^
constructor WPrintDialog.WPrintDialog(Frame,PrinterJob) is not applicable
(argument mismatch; bad type in conditional expression
Dialog cannot be converted to Frame)
constructor WPrintDialog.WPrintDialog(Dialog,PrinterJob) is not applicable
(argument mismatch; bad type in conditional expression
Frame cannot be converted to Dialog)]
I tried a sample program too to see if it's java issue and there also the compilation fails
class TestA {
public TestA(Dialog temp) {}
public TestA(Frame temp) {}
}
public class TestB {
public static void main(String[] args) {
Window val = new Frame();
TestA test = new TestA((val instanceof Frame) ? (Frame) val : (Dialog) val);
}
}
It seems compiler needs to determine what constructor to call. So both operands of the conditional operator should be assignable to the type of the parameter.
Regards
Prasanta
On 9/1/2016 12:07 AM, Phil Race wrote:
911 public boolean printDialog(final PrintRequestAttributeSet attributes)
...
956 attributes.add(new DialogOwner((Frame)w));
So this now adds the DialogOwner to the attribute set passed by the application.
This needs to be guaranteed to be removed again before the method returns otherwise
apart from leaving that visible to the application, there is some risk that the
frame will not be GC'd when it should have been.
- Frame ownerFrame = (dlgOwner != null) ? dlgOwner.getOwner() : null;
+ Window ownerFrame = (dlgOwner != null) ? dlgOwner.getOwner() : null
so maybe change the var name to just "owner" ?
WPrintDialog dialog;
484 if (ownerFrame instanceof Frame) {
485 dialog = new WPrintDialog((Frame)ownerFrame, this);
486 } else {
487 dialog = new WPrintDialog((Dialog)ownerFrame, this);
488 }
could (should?) be
WPrintDialog dialog =
new WPrintDialog(((owner instanceof Frame) ? (Frame)owner : (Dialog)owner), this)
and so on for the other cases too .. it will save a lot
of repetition for new PrintToFileErrorDialog(..)
-phil.
On 08/26/2016 01:05 AM, Prasanta Sadhukhan wrote:
Hi All,
I have modified the webrev to take care of HYPERLINK "https://bugs.openjdk.java.net/browse/JDK-6948907"JDK-6948907: sun.print.DialogOwner does not support Dialogs as DialogOwner
also.
HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/7064425/webrev.01/"http://cr.openjdk.java.net/~psadhukhan/7064425/webrev.01/
Tested on windows and ubuntu.
Regards
Prasanta
On 8/25/2016 4:10 PM, Prasanta Sadhukhan wrote:
Hi All,
Please review a fix for jdk9 for an issue where it is seen that PageDialog and PrintDialog is not associated with the owner Frame that spawns the dialog.
Bug: https://bugs.openjdk.java.net/browse/JDK-7064425
webrev: HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/7064425/webrev.00/"http://cr.openjdk.java.net/~psadhukhan/7064425/webrev.00/
The issue was there we explicitly pass null as owner to ServiceDialog in pageDialog(attributes).
Proposed fix is to get the owner window,
if pageDialog is called before calling printDialog, the window will be a Frame else the owner window will be ServiceDialog
and pass this owner window to ServiceDialog instead of null.
For PrintDialog, the proposed fix is to set an attribute with DialogOwner so that ServiceUI dialog can parse that attribute and can use the owner window as parent of the dialaog,
Regards
Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160913/3ff1dca2/attachment.html>
More information about the 2d-dev
mailing list