[OpenJDK 2D-Dev] [9] RFR JDK-7064425: PageFormat Dialog has no owner window to reactivate

Phil Race philip.race at oracle.com
Wed Aug 31 18:37:40 UTC 2016


  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 newPrintToFileErrorDialog(..)

-phil.


On 08/26/2016 01:05 AM, Prasanta Sadhukhan wrote:
> Hi All,
>
> I have modified the webrev to take care of JDK-6948907 
> <https://bugs.openjdk.java.net/browse/JDK-6948907>: 
> sun.print.DialogOwner does not support Dialogs as DialogOwner
> also.
> 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: 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/20160831/6ed5a059/attachment.html>


More information about the 2d-dev mailing list