1 /*
2 * Copyright (c) 1999, 2011, 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
50 * }
51 * </pre>
52 * <p>
53 * Every IPP attribute which supports an <i>attributeName</i>-default value
54 * has a corresponding <code>set<i>attributeName</i>ToDefault</code> method.
55 * Default value fields are not provided.
56 *
57 * @author David Mendenhall
58 * @since 1.3
59 */
60 public final class JobAttributes implements Cloneable {
61 /**
62 * A type-safe enumeration of possible default selection states.
63 * @since 1.3
64 */
65 public static final class DefaultSelectionType extends AttributeValue {
66 private static final int I_ALL = 0;
67 private static final int I_RANGE = 1;
68 private static final int I_SELECTION = 2;
69
70 private static final String NAMES[] = {
71 "all", "range", "selection"
72 };
73
74 /**
75 * The {@code DefaultSelectionType} instance to use for
76 * specifying that all pages of the job should be printed.
77 */
78 public static final DefaultSelectionType ALL =
79 new DefaultSelectionType(I_ALL);
80 /**
81 * The {@code DefaultSelectionType} instance to use for
82 * specifying that a range of pages of the job should be printed.
83 */
84 public static final DefaultSelectionType RANGE =
85 new DefaultSelectionType(I_RANGE);
86 /**
87 * The {@code DefaultSelectionType} instance to use for
88 * specifying that the current selection should be printed.
89 */
90 public static final DefaultSelectionType SELECTION =
91 new DefaultSelectionType(I_SELECTION);
92
93 private DefaultSelectionType(int type) {
94 super(type, NAMES);
95 }
96 }
97
98 /**
99 * A type-safe enumeration of possible job destinations.
100 * @since 1.3
101 */
102 public static final class DestinationType extends AttributeValue {
103 private static final int I_FILE = 0;
104 private static final int I_PRINTER = 1;
105
106 private static final String NAMES[] = {
107 "file", "printer"
108 };
109
110 /**
111 * The {@code DestinationType} instance to use for
112 * specifying print to file.
113 */
114 public static final DestinationType FILE =
115 new DestinationType(I_FILE);
116 /**
117 * The {@code DestinationType} instance to use for
118 * specifying print to printer.
119 */
120 public static final DestinationType PRINTER =
121 new DestinationType(I_PRINTER);
122
123 private DestinationType(int type) {
124 super(type, NAMES);
125 }
126 }
127
128 /**
129 * A type-safe enumeration of possible dialogs to display to the user.
130 * @since 1.3
131 */
132 public static final class DialogType extends AttributeValue {
133 private static final int I_COMMON = 0;
134 private static final int I_NATIVE = 1;
135 private static final int I_NONE = 2;
136
137 private static final String NAMES[] = {
138 "common", "native", "none"
139 };
140
141 /**
142 * The {@code DialogType} instance to use for
143 * specifying the cross-platform, pure Java print dialog.
144 */
145 public static final DialogType COMMON = new DialogType(I_COMMON);
146 /**
147 * The {@code DialogType} instance to use for
148 * specifying the platform's native print dialog.
149 */
150 public static final DialogType NATIVE = new DialogType(I_NATIVE);
151 /**
152 * The {@code DialogType} instance to use for
153 * specifying no print dialog.
154 */
155 public static final DialogType NONE = new DialogType(I_NONE);
156
157 private DialogType(int type) {
158 super(type, NAMES);
159 }
160 }
161
162 /**
163 * A type-safe enumeration of possible multiple copy handling states.
164 * It is used to control how the sheets of multiple copies of a single
165 * document are collated.
166 * @since 1.3
167 */
168 public static final class MultipleDocumentHandlingType extends
169 AttributeValue {
170 private static final int I_SEPARATE_DOCUMENTS_COLLATED_COPIES = 0;
171 private static final int I_SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = 1;
172
173 private static final String NAMES[] = {
174 "separate-documents-collated-copies",
175 "separate-documents-uncollated-copies"
176 };
177
178 /**
179 * The {@code MultipleDocumentHandlingType} instance to use for specifying
180 * that the job should be divided into separate, collated copies.
181 */
182 public static final MultipleDocumentHandlingType
183 SEPARATE_DOCUMENTS_COLLATED_COPIES =
184 new MultipleDocumentHandlingType(
185 I_SEPARATE_DOCUMENTS_COLLATED_COPIES);
186 /**
187 * The {@code MultipleDocumentHandlingType} instance to use for specifying
188 * that the job should be divided into separate, uncollated copies.
189 */
190 public static final MultipleDocumentHandlingType
191 SEPARATE_DOCUMENTS_UNCOLLATED_COPIES =
192 new MultipleDocumentHandlingType(
193 I_SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
194
195 private MultipleDocumentHandlingType(int type) {
196 super(type, NAMES);
197 }
198 }
199
200 /**
201 * A type-safe enumeration of possible multi-page impositions. These
202 * impositions are in compliance with IPP 1.1.
203 * @since 1.3
204 */
205 public static final class SidesType extends AttributeValue {
206 private static final int I_ONE_SIDED = 0;
207 private static final int I_TWO_SIDED_LONG_EDGE = 1;
208 private static final int I_TWO_SIDED_SHORT_EDGE = 2;
209
210 private static final String NAMES[] = {
211 "one-sided", "two-sided-long-edge", "two-sided-short-edge"
212 };
213
214 /**
215 * The {@code SidesType} instance to use for specifying that
216 * consecutive job pages should be printed upon the same side of
217 * consecutive media sheets.
218 */
219 public static final SidesType ONE_SIDED = new SidesType(I_ONE_SIDED);
220 /**
221 * The {@code SidesType} instance to use for specifying that
222 * consecutive job pages should be printed upon front and back sides
223 * of consecutive media sheets, such that the orientation of each pair
224 * of pages on the medium would be correct for the reader as if for
225 * binding on the long edge.
226 */
227 public static final SidesType TWO_SIDED_LONG_EDGE =
228 new SidesType(I_TWO_SIDED_LONG_EDGE);
229 /**
230 * The {@code SidesType} instance to use for specifying that
|
1 /*
2 * Copyright (c) 1999, 2018, 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
50 * }
51 * </pre>
52 * <p>
53 * Every IPP attribute which supports an <i>attributeName</i>-default value
54 * has a corresponding <code>set<i>attributeName</i>ToDefault</code> method.
55 * Default value fields are not provided.
56 *
57 * @author David Mendenhall
58 * @since 1.3
59 */
60 public final class JobAttributes implements Cloneable {
61 /**
62 * A type-safe enumeration of possible default selection states.
63 * @since 1.3
64 */
65 public static final class DefaultSelectionType extends AttributeValue {
66 private static final int I_ALL = 0;
67 private static final int I_RANGE = 1;
68 private static final int I_SELECTION = 2;
69
70 private static final String[] NAMES = {
71 "all", "range", "selection"
72 };
73
74 /**
75 * The {@code DefaultSelectionType} instance to use for
76 * specifying that all pages of the job should be printed.
77 */
78 public static final DefaultSelectionType ALL =
79 new DefaultSelectionType(I_ALL);
80 /**
81 * The {@code DefaultSelectionType} instance to use for
82 * specifying that a range of pages of the job should be printed.
83 */
84 public static final DefaultSelectionType RANGE =
85 new DefaultSelectionType(I_RANGE);
86 /**
87 * The {@code DefaultSelectionType} instance to use for
88 * specifying that the current selection should be printed.
89 */
90 public static final DefaultSelectionType SELECTION =
91 new DefaultSelectionType(I_SELECTION);
92
93 private DefaultSelectionType(int type) {
94 super(type, NAMES);
95 }
96 }
97
98 /**
99 * A type-safe enumeration of possible job destinations.
100 * @since 1.3
101 */
102 public static final class DestinationType extends AttributeValue {
103 private static final int I_FILE = 0;
104 private static final int I_PRINTER = 1;
105
106 private static final String[] NAMES = {
107 "file", "printer"
108 };
109
110 /**
111 * The {@code DestinationType} instance to use for
112 * specifying print to file.
113 */
114 public static final DestinationType FILE =
115 new DestinationType(I_FILE);
116 /**
117 * The {@code DestinationType} instance to use for
118 * specifying print to printer.
119 */
120 public static final DestinationType PRINTER =
121 new DestinationType(I_PRINTER);
122
123 private DestinationType(int type) {
124 super(type, NAMES);
125 }
126 }
127
128 /**
129 * A type-safe enumeration of possible dialogs to display to the user.
130 * @since 1.3
131 */
132 public static final class DialogType extends AttributeValue {
133 private static final int I_COMMON = 0;
134 private static final int I_NATIVE = 1;
135 private static final int I_NONE = 2;
136
137 private static final String[] NAMES = {
138 "common", "native", "none"
139 };
140
141 /**
142 * The {@code DialogType} instance to use for
143 * specifying the cross-platform, pure Java print dialog.
144 */
145 public static final DialogType COMMON = new DialogType(I_COMMON);
146 /**
147 * The {@code DialogType} instance to use for
148 * specifying the platform's native print dialog.
149 */
150 public static final DialogType NATIVE = new DialogType(I_NATIVE);
151 /**
152 * The {@code DialogType} instance to use for
153 * specifying no print dialog.
154 */
155 public static final DialogType NONE = new DialogType(I_NONE);
156
157 private DialogType(int type) {
158 super(type, NAMES);
159 }
160 }
161
162 /**
163 * A type-safe enumeration of possible multiple copy handling states.
164 * It is used to control how the sheets of multiple copies of a single
165 * document are collated.
166 * @since 1.3
167 */
168 public static final class MultipleDocumentHandlingType extends
169 AttributeValue {
170 private static final int I_SEPARATE_DOCUMENTS_COLLATED_COPIES = 0;
171 private static final int I_SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = 1;
172
173 private static final String[] NAMES = {
174 "separate-documents-collated-copies",
175 "separate-documents-uncollated-copies"
176 };
177
178 /**
179 * The {@code MultipleDocumentHandlingType} instance to use for specifying
180 * that the job should be divided into separate, collated copies.
181 */
182 public static final MultipleDocumentHandlingType
183 SEPARATE_DOCUMENTS_COLLATED_COPIES =
184 new MultipleDocumentHandlingType(
185 I_SEPARATE_DOCUMENTS_COLLATED_COPIES);
186 /**
187 * The {@code MultipleDocumentHandlingType} instance to use for specifying
188 * that the job should be divided into separate, uncollated copies.
189 */
190 public static final MultipleDocumentHandlingType
191 SEPARATE_DOCUMENTS_UNCOLLATED_COPIES =
192 new MultipleDocumentHandlingType(
193 I_SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
194
195 private MultipleDocumentHandlingType(int type) {
196 super(type, NAMES);
197 }
198 }
199
200 /**
201 * A type-safe enumeration of possible multi-page impositions. These
202 * impositions are in compliance with IPP 1.1.
203 * @since 1.3
204 */
205 public static final class SidesType extends AttributeValue {
206 private static final int I_ONE_SIDED = 0;
207 private static final int I_TWO_SIDED_LONG_EDGE = 1;
208 private static final int I_TWO_SIDED_SHORT_EDGE = 2;
209
210 private static final String[] NAMES = {
211 "one-sided", "two-sided-long-edge", "two-sided-short-edge"
212 };
213
214 /**
215 * The {@code SidesType} instance to use for specifying that
216 * consecutive job pages should be printed upon the same side of
217 * consecutive media sheets.
218 */
219 public static final SidesType ONE_SIDED = new SidesType(I_ONE_SIDED);
220 /**
221 * The {@code SidesType} instance to use for specifying that
222 * consecutive job pages should be printed upon front and back sides
223 * of consecutive media sheets, such that the orientation of each pair
224 * of pages on the medium would be correct for the reader as if for
225 * binding on the long edge.
226 */
227 public static final SidesType TWO_SIDED_LONG_EDGE =
228 new SidesType(I_TWO_SIDED_LONG_EDGE);
229 /**
230 * The {@code SidesType} instance to use for specifying that
|