[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] [9] RFR JDK-7064425: PageFormat Dialog has no owner window to reactivate
From:       Phil Race <philip.race () oracle ! com>
Date:       2016-08-31 18:37:40
Message-ID: 57C723F4.6010804 () oracle ! com
[Download RAW message or body]

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
>


[Attachment #3 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">
      <pre> 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.
</pre>
      <br>
      <pre><span class="removed">-        Frame ownerFrame = (dlgOwner != null) ? \
dlgOwner.getOwner() : null;</span> <span class="new">+        Window ownerFrame = \
(dlgOwner != null) ? dlgOwner.getOwner() : null

so maybe change the var name to just "owner" ?
</span></pre>
      <pre><span class="changed">WPrintDialog dialog;</span>
<span class="changed"> 484         if (ownerFrame instanceof Frame) {</span>
<span class="changed"> 485             dialog = new WPrintDialog((Frame)ownerFrame, \
this);</span> <span class="changed"> 486         } else {</span>
<span class="changed"> 487             dialog = new WPrintDialog((Dialog)ownerFrame, \
this);</span> <span class="changed"> 488         }

could (should?) be


WPrintDialog dialog =
      new WPrintDialog(</span><span class="changed">((owner instanceof Frame)</span> \
? (Frame)owner : (Dialog)owner), this)

and so on for the other cases too .. it will save a lot
of repetition for new <span class="new">PrintToFileErrorDialog</span>(..)

-phil. 
</pre>
      <br>
      On 08/26/2016 01:05 AM, Prasanta Sadhukhan wrote:<br>
    </div>
    <blockquote cite="mid:57BFF839.3010009@oracle.com" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      Hi All,<br>
      <br>
      I have modified the webrev to take care of <a
        moz-do-not-send="true" class="issue-link"
        data-issue-key="JDK-6948907"
        href="https://bugs.openjdk.java.net/browse/JDK-6948907"
        id="key-val" rel="4195741">JDK-6948907</a>:
      sun.print.DialogOwner does not support Dialogs as DialogOwner<br>
      also.<br>
      <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://cr.openjdk.java.net/%7Epsadhukhan/7064425/webrev.01/">http://cr.openjdk.java.net/~psadhukhan/7064425/webrev.01/</a><br>
  <br>
      Tested on windows and ubuntu.<br>
      <br>
      Regards<br>
      Prasanta<br>
      <div class="moz-cite-prefix">On 8/25/2016 4:10 PM, Prasanta
        Sadhukhan wrote:<br>
      </div>
      <blockquote cite="mid:57BECB2E.4030102@oracle.com" type="cite">Hi
        All, <br>
        <br>
        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. <br>
        <br>
        Bug: <a moz-do-not-send="true" class="moz-txt-link-freetext"
          href="https://bugs.openjdk.java.net/browse/JDK-7064425">https://bugs.openjdk.java.net/browse/JDK-7064425</a>
  <br>
        webrev: <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://cr.openjdk.java.net/%7Epsadhukhan/7064425/webrev.00/">http://cr.openjdk.java.net/~psadhukhan/7064425/webrev.00/</a>
  <br>
        <br>
        The issue was there we explicitly pass null as owner to
        ServiceDialog in pageDialog(attributes). <br>
        Proposed fix is to get the owner window, <br>
        if pageDialog is called before calling printDialog, the window
        will be a Frame else the owner window will be ServiceDialog <br>
        and pass this owner window to ServiceDialog instead of null. <br>
        <br>
        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, <br>
        <br>
        Regards <br>
        Prasanta <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic