< prev index next >

src/java.desktop/share/classes/javax/print/ServiceUI.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  47  * Print Service API.
  48  * <p>
  49  * The dialogs follow a standard pattern of acting as a continue/cancel option
  50  * for a user as well as allowing the user to select the print service to use
  51  * and specify choices such as paper size and number of copies.
  52  * <p>
  53  * The dialogs are designed to work with pluggable print services though the
  54  * public APIs of those print services.
  55  * <p>
  56  * If a print service provides any vendor extensions these may be made
  57  * accessible to the user through a vendor supplied tab panel {@code Component}.
  58  * Such a vendor extension is encouraged to use Swing! and to support its
  59  * accessibility APIs. The vendor extensions should return the settings as part
  60  * of the {@code AttributeSet}. Applications which want to preserve the user
  61  * settings should use those settings to specify the print job. Note that this
  62  * class is not referenced by any other part of the Java Print Service and may
  63  * not be included in profiles which cannot depend on the presence of the AWT
  64  * packages.
  65  */
  66 public class ServiceUI {





  67 
  68     /**
  69      * Presents a dialog to the user for selecting a print service (printer). It
  70      * is displayed at the location specified by the application and is modal.
  71      * If the specification is invalid or would make the dialog not visible it
  72      * will be displayed at a location determined by the implementation. The
  73      * dialog blocks its calling thread and is application modal.
  74      * <p>
  75      * The dialog may include a tab panel with custom UI lazily obtained from
  76      * the {@code PrintService}'s {@code ServiceUIFactory} when the
  77      * {@code PrintService} is browsed. The dialog will attempt to locate a
  78      * {@code MAIN_UIROLE} first as a {@code JComponent}, then as a
  79      * {@code Panel}. If there is no {@code ServiceUIFactory} or no matching
  80      * role the custom tab will be empty or not visible.
  81      * <p>
  82      * The dialog returns the print service selected by the user if the user
  83      * OK's the dialog and {@code null} if the user cancels the dialog.
  84      * <p>
  85      * An application must pass in an array of print services to browse. The
  86      * array must be {@code non-null} and non-empty. Typically an application


   1 /*
   2  * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  47  * Print Service API.
  48  * <p>
  49  * The dialogs follow a standard pattern of acting as a continue/cancel option
  50  * for a user as well as allowing the user to select the print service to use
  51  * and specify choices such as paper size and number of copies.
  52  * <p>
  53  * The dialogs are designed to work with pluggable print services though the
  54  * public APIs of those print services.
  55  * <p>
  56  * If a print service provides any vendor extensions these may be made
  57  * accessible to the user through a vendor supplied tab panel {@code Component}.
  58  * Such a vendor extension is encouraged to use Swing! and to support its
  59  * accessibility APIs. The vendor extensions should return the settings as part
  60  * of the {@code AttributeSet}. Applications which want to preserve the user
  61  * settings should use those settings to specify the print job. Note that this
  62  * class is not referenced by any other part of the Java Print Service and may
  63  * not be included in profiles which cannot depend on the presence of the AWT
  64  * packages.
  65  */
  66 public class ServiceUI {
  67 
  68     /**
  69      * Creates a {@code ServiceUI}.
  70      */
  71     public ServiceUI() {}
  72 
  73     /**
  74      * Presents a dialog to the user for selecting a print service (printer). It
  75      * is displayed at the location specified by the application and is modal.
  76      * If the specification is invalid or would make the dialog not visible it
  77      * will be displayed at a location determined by the implementation. The
  78      * dialog blocks its calling thread and is application modal.
  79      * <p>
  80      * The dialog may include a tab panel with custom UI lazily obtained from
  81      * the {@code PrintService}'s {@code ServiceUIFactory} when the
  82      * {@code PrintService} is browsed. The dialog will attempt to locate a
  83      * {@code MAIN_UIROLE} first as a {@code JComponent}, then as a
  84      * {@code Panel}. If there is no {@code ServiceUIFactory} or no matching
  85      * role the custom tab will be empty or not visible.
  86      * <p>
  87      * The dialog returns the print service selected by the user if the user
  88      * OK's the dialog and {@code null} if the user cancels the dialog.
  89      * <p>
  90      * An application must pass in an array of print services to browse. The
  91      * array must be {@code non-null} and non-empty. Typically an application


< prev index next >