View Javadoc
1   /*
2    * Copyright (c) 2003, 2010, 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
23   * questions.
24   */
25  
26  package javax.print.attribute.standard;
27  
28  import javax.print.attribute.EnumSyntax;
29  import javax.print.attribute.PrintRequestAttribute;
30  
31  /**
32   * Class DialogTypeSelection is a printing attribute class, an enumeration,
33   * that indicates the user dialog type to be used for specifying
34   * printing options.
35   * If {@code NATIVE} is specified, then where available, a native
36   * platform dialog is displayed.
37   * If {@code COMMON} is specified, a cross-platform print dialog is displayed.
38   *
39   * This option to specify a native dialog for use with an IPP attribute
40   * set provides a standard way to reflect back of the setting and option
41   * changes made by a user to the calling application, and integrates
42   * the native dialog into the Java printing APIs.
43   * But note that some options and settings in a native dialog may not
44   * necessarily map to IPP attributes as they may be non-standard platform,
45   * or even printer specific options.
46   * <P>
47   * <B>IPP Compatibility:</B> This is not an IPP attribute.
48   * <P>
49   * @since 1.7
50   *
51   */
52  public final class DialogTypeSelection extends EnumSyntax
53          implements PrintRequestAttribute {
54  
55      private static final long serialVersionUID = 7518682952133256029L;
56  
57      /**
58       *
59       */
60      public static final DialogTypeSelection
61          NATIVE = new DialogTypeSelection(0);
62  
63      /**
64       *
65       */
66      public static final DialogTypeSelection
67          COMMON = new DialogTypeSelection(1);
68  
69      /**
70       * Construct a new dialog type selection enumeration value with the
71       * given integer value.
72       *
73       * @param  value  Integer value.
74       */
75      protected DialogTypeSelection(int value) {
76                  super(value);
77      }
78  
79      private static final String[] myStringTable = {
80          "native", "common"};
81  
82  
83      private static final DialogTypeSelection[] myEnumValueTable = {
84          NATIVE,
85          COMMON
86      };
87  
88      /**
89       * Returns the string table for class DialogTypeSelection.
90       */
91      protected String[] getStringTable() {
92          return myStringTable;
93      }
94  
95      /**
96       * Returns the enumeration value table for class DialogTypeSelection.
97       */
98      protected EnumSyntax[] getEnumValueTable() {
99          return myEnumValueTable;
100     }
101 
102 
103    /**
104      * Get the printing attribute class which is to be used as the "category"
105      * for this printing attribute value.
106      * <P>
107      * For class DialogTypeSelection the category is class
108      * DialogTypeSelection itself.
109      *
110      * @return  Printing attribute class (category), an instance of class
111      *          {@link java.lang.Class java.lang.Class}.
112      */
113     public final Class getCategory() {
114         return DialogTypeSelection.class;
115     }
116 
117 
118     /**
119      * Get the name of the category of which this attribute value is an
120      * instance.
121      * <P>
122      * For class DialogTypeSelection the category name is
123      * <CODE>"dialog-type-selection"</CODE>.
124      *
125      * @return  Attribute category name.
126      */
127     public final String getName() {
128         return "dialog-type-selection";
129     }
130 
131 }