Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8203834

Define API to support specifying ownership of print dialogs.

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P2
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
      2d
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      We are adding new functionality so from a Java SE or even JDK perspective there is no compatibility risk.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Define a new PrintRequestAttribute which can specify the print dialog owner window or on top behavior.

      Problem

      JavaFX has been using internal JDK API provided for it to be able to specify an owner window, or failing that "always on top" behaviour when invoking the Java 2D PrinterJob's print and page dialogs. This was possible when JavaFX was part of the JDK. Now it is separate, this will no longer work unless applications specify on the command line the export of an internal printing package from the java.desktop module

      Solution

      When displaying the print or page dialog for a java.awt.print.PrinterJob, the PrintRequestAttributeSet parameter may optionally contain a new DialogOwner attribute which applications can use to specify one of - an owner AWT window - AWT "alwaysOnTop" behaviour.

      Also define an undocumented non-SE interface to be used by JavaFX from native code for supplying a native Window handle for an owner window using JNI.

      Specification

      Define a new class in package javax.print.attribute.standard :

      
      
      /**
       * An attribute class used to support requesting a print or page setup dialog
       * be kept displayed on top of all windows or some specific window.
       * 

      * Constructed without any arguments it will request that a print or page * setup dialog be configured as if the application directly was to specify * {@code java.awt.Window.setAlwaysOnTop(true)}, subject to permission checks. *

      * Constructed with a {@link java.awt.Window} parameter, it requests that * the dialog be owned by the specified window. * @since 11 */ public final class DialogOwner implements PrintRequestAttribute { /** * Constructs an instance which can be used to request * {@code java.awt.Window.setAlwaysOnTop(true)} behaviour. * This should be used where there is no application preferred owner window. * Whether this has any effect depends on if always on top is supported * for this platform and the particular dialog to be displayed. */ public DialogOwner(); /** * Constructs an instance which can be used to request that the * specified {@link java.awt.Window} be the owner of the dialog. * @param owner window. */ public DialogOwner(Window owner) { /** * Returns a {@code Window owner}, if one was specified, * otherwise {@code null}. * @return an owner window. */ public Window getOwner(); /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. *

      * For class {@code DialogOwner}, the category is class * {@code DialogOwner} itself. * * @return printing attribute class (category), an instance of class * {@link Class java.lang.Class} */ public final Class getCategory(); /** * Get the name of the category of which this attribute value is an * instance. *

      * For class {@code DialogOwner}, the category name is * {@code "dialog-owner"}. * */ public final String getName(); }


      Additionally to the above SE API JavaFX will use JNI to call a private undocumented constructor

      /*
      * Construct a DialogOwner that  specifies a non-AWT native window.
      * @param id
      */
      DialogOwner(long id);
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              prr Philip Race
              Reporter:
              prr Philip Race
              Reviewed By:
              Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: