Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java
41171 views
1
/*
2
* Copyright (c) 2000, 2021, 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 java.io.Serial;
29
30
import javax.print.attribute.Attribute;
31
import javax.print.attribute.DocAttribute;
32
import javax.print.attribute.EnumSyntax;
33
import javax.print.attribute.PrintJobAttribute;
34
import javax.print.attribute.PrintRequestAttribute;
35
36
/**
37
* Class {@code Finishings} is a printing attribute class, an enumeration, that
38
* identifies whether the printer applies a finishing operation of some kind of
39
* binding to each copy of each printed document in the job. For multidoc print
40
* jobs (jobs with multiple documents), the
41
* {@link MultipleDocumentHandling MultipleDocumentHandling} attribute
42
* determines what constitutes a "copy" for purposes of finishing.
43
* <p>
44
* Standard Finishings values are:
45
* <ul>
46
* <li>{@link #NONE NONE}
47
* <li>{@link #STAPLE STAPLE}
48
* <li>{@link #EDGE_STITCH EDGE_STITCH}
49
* <li>{@link #BIND BIND}
50
* <li>{@link #SADDLE_STITCH SADDLE_STITCH}
51
* <li>{@link #COVER COVER}
52
* </ul>
53
* <p>
54
* The following {@code Finishings} values are more specific; they indicate a
55
* corner or an edge as if the document were a portrait document:
56
* <ul>
57
* <li>{@link #STAPLE_TOP_LEFT STAPLE_TOP_LEFT}
58
* <li>{@link #EDGE_STITCH_LEFT EDGE_STITCH_LEFT}
59
* <li>{@link #STAPLE_DUAL_LEFT STAPLE_DUAL_LEFT}
60
* <li>{@link #STAPLE_BOTTOM_LEFT STAPLE_BOTTOM_LEFT}
61
* <li>{@link #EDGE_STITCH_TOP EDGE_STITCH_TOP}
62
* <li>{@link #STAPLE_DUAL_TOP STAPLE_DUAL_TOP}
63
* <li>{@link #STAPLE_TOP_RIGHT STAPLE_TOP_RIGHT}
64
* <li>{@link #EDGE_STITCH_RIGHT EDGE_STITCH_RIGHT}
65
* <li>{@link #STAPLE_DUAL_RIGHT STAPLE_DUAL_RIGHT}
66
* <li>{@link #STAPLE_BOTTOM_RIGHT STAPLE_BOTTOM_RIGHT}
67
* <li>{@link #EDGE_STITCH_BOTTOM EDGE_STITCH_BOTTOM}
68
* <li>{@link #STAPLE_DUAL_BOTTOM STAPLE_DUAL_BOTTOM}
69
* </ul>
70
* <p>
71
* The STAPLE_<i>XXX</i> values are specified with respect to the document as if
72
* the document were a portrait document. If the document is actually a
73
* landscape or a reverse-landscape document, the client supplies the
74
* appropriate transformed value. For example, to position a staple in the upper
75
* left hand corner of a landscape document when held for reading, the client
76
* supplies the {@code STAPLE_BOTTOM_LEFT} value (since landscape is defined as
77
* a +90 degree rotation from portrait, i.e., anti-clockwise). On the other
78
* hand, to position a staple in the upper left hand corner of a
79
* reverse-landscape document when held for reading, the client supplies the
80
* {@code STAPLE_TOP_RIGHT} value (since reverse-landscape is defined as a -90
81
* degree rotation from portrait, i.e., clockwise).
82
* <p>
83
* The angle (vertical, horizontal, angled) of each staple with respect to the
84
* document depends on the implementation which may in turn depend on the value
85
* of the attribute.
86
* <p>
87
* The effect of a {@code Finishings} attribute on a multidoc print job (a job
88
* with multiple documents) depends on whether all the docs have the same
89
* binding specified or whether different docs have different bindings
90
* specified, and on the (perhaps defaulted) value of the
91
* {@link MultipleDocumentHandling MultipleDocumentHandling} attribute.
92
* <ul>
93
* <li>If all the docs have the same binding specified, then any value of
94
* {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense, and
95
* the printer's processing depends on the
96
* {@link MultipleDocumentHandling MultipleDocumentHandling} value:
97
* <ul>
98
* <li>{@code SINGLE_DOCUMENT} -- All the input docs will be bound together
99
* as one output document with the specified binding.
100
* <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be bound
101
* together as one output document with the specified binding, and the first
102
* impression of each input doc will always start on a new media sheet.
103
* <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- Each input doc will
104
* be bound separately with the specified binding.
105
* <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- Each input doc will be
106
* bound separately with the specified binding.
107
* </ul>
108
* <li>If different docs have different bindings specified, then only two
109
* values of {@link MultipleDocumentHandling MultipleDocumentHandling} make
110
* sense, and the printer reports an error when the job is submitted if any
111
* other value is specified:
112
* <ul>
113
* <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- Each input doc will
114
* be bound separately with its own specified binding.
115
* <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- Each input doc will be
116
* bound separately with its own specified binding.
117
* </ul>
118
* </ul>
119
* <p>
120
* <b>IPP Compatibility:</b> Class Finishings encapsulates some of the IPP enum
121
* values that can be included in an IPP "finishings" attribute, which is a set
122
* of enums. The category name returned by {@code getName()} is the IPP
123
* attribute name. The enumeration's integer value is the IPP enum value. The
124
* {@code toString()} method returns the IPP string representation of the
125
* attribute value. In IPP Finishings is a multi-value attribute, this API
126
* currently allows only one binding to be specified.
127
*
128
* @author Alan Kaminsky
129
*/
130
public class Finishings extends EnumSyntax
131
implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
132
133
/**
134
* Use serialVersionUID from JDK 1.4 for interoperability.
135
*/
136
@Serial
137
private static final long serialVersionUID = -627840419548391754L;
138
139
/**
140
* Perform no binding.
141
*/
142
public static final Finishings NONE = new Finishings(3);
143
144
/**
145
* Bind the document(s) with one or more staples. The exact number and
146
* placement of the staples is site-defined.
147
*/
148
public static final Finishings STAPLE = new Finishings(4);
149
150
/**
151
* This value is specified when it is desired to select a non-printed (or
152
* pre-printed) cover for the document. This does not supplant the
153
* specification of a printed cover (on cover stock medium) by the document
154
* itself.
155
*/
156
public static final Finishings COVER = new Finishings(6);
157
158
/**
159
* This value indicates that a binding is to be applied to the document; the
160
* type and placement of the binding is site-defined.
161
*/
162
public static final Finishings BIND = new Finishings(7);
163
164
/**
165
* Bind the document(s) with one or more staples (wire stitches) along the
166
* middle fold. The exact number and placement of the staples and the middle
167
* fold is implementation- and/or site-defined.
168
*/
169
public static final Finishings SADDLE_STITCH =
170
new Finishings(8);
171
172
/**
173
* Bind the document(s) with one or more staples (wire stitches) along one
174
* edge. The exact number and placement of the staples is implementation-
175
* and/or site- defined.
176
*/
177
public static final Finishings EDGE_STITCH =
178
new Finishings(9);
179
180
/**
181
* Bind the document(s) with one or more staples in the top left corner.
182
*/
183
public static final Finishings STAPLE_TOP_LEFT =
184
new Finishings(20);
185
186
/**
187
* Bind the document(s) with one or more staples in the bottom left corner.
188
*/
189
public static final Finishings STAPLE_BOTTOM_LEFT =
190
new Finishings(21);
191
192
/**
193
* Bind the document(s) with one or more staples in the top right corner.
194
*/
195
public static final Finishings STAPLE_TOP_RIGHT =
196
new Finishings(22);
197
198
/**
199
* Bind the document(s) with one or more staples in the bottom right corner.
200
*/
201
public static final Finishings STAPLE_BOTTOM_RIGHT =
202
new Finishings(23);
203
204
/**
205
* Bind the document(s) with one or more staples (wire stitches) along the
206
* left edge. The exact number and placement of the staples is
207
* implementation- and/or site-defined.
208
*/
209
public static final Finishings EDGE_STITCH_LEFT =
210
new Finishings(24);
211
212
/**
213
* Bind the document(s) with one or more staples (wire stitches) along the
214
* top edge. The exact number and placement of the staples is
215
* implementation- and/or site-defined.
216
*/
217
public static final Finishings EDGE_STITCH_TOP =
218
new Finishings(25);
219
220
/**
221
* Bind the document(s) with one or more staples (wire stitches) along the
222
* right edge. The exact number and placement of the staples is
223
* implementation- and/or site-defined.
224
*/
225
public static final Finishings EDGE_STITCH_RIGHT =
226
new Finishings(26);
227
228
/**
229
* Bind the document(s) with one or more staples (wire stitches) along the
230
* bottom edge. The exact number and placement of the staples is
231
* implementation- and/or site-defined.
232
*/
233
public static final Finishings EDGE_STITCH_BOTTOM =
234
new Finishings(27);
235
236
/**
237
* Bind the document(s) with two staples (wire stitches) along the left edge
238
* assuming a portrait document (see above).
239
*/
240
public static final Finishings STAPLE_DUAL_LEFT =
241
new Finishings(28);
242
243
/**
244
* Bind the document(s) with two staples (wire stitches) along the top edge
245
* assuming a portrait document (see above).
246
*/
247
public static final Finishings STAPLE_DUAL_TOP =
248
new Finishings(29);
249
250
/**
251
* Bind the document(s) with two staples (wire stitches) along the right
252
* edge assuming a portrait document (see above).
253
*/
254
public static final Finishings STAPLE_DUAL_RIGHT =
255
new Finishings(30);
256
257
/**
258
* Bind the document(s) with two staples (wire stitches) along the bottom
259
* edge assuming a portrait document (see above).
260
*/
261
public static final Finishings STAPLE_DUAL_BOTTOM =
262
new Finishings(31);
263
264
/**
265
* Construct a new finishings binding enumeration value with the given
266
* integer value.
267
*
268
* @param value Integer value
269
*/
270
protected Finishings(int value) {
271
super(value);
272
}
273
274
/**
275
* The string table for class {@code Finishings}.
276
*/
277
private static final String[] myStringTable =
278
{"none",
279
"staple",
280
null,
281
"cover",
282
"bind",
283
"saddle-stitch",
284
"edge-stitch",
285
null, // The next ten enum values are reserved.
286
null,
287
null,
288
null,
289
null,
290
null,
291
null,
292
null,
293
null,
294
null,
295
"staple-top-left",
296
"staple-bottom-left",
297
"staple-top-right",
298
"staple-bottom-right",
299
"edge-stitch-left",
300
"edge-stitch-top",
301
"edge-stitch-right",
302
"edge-stitch-bottom",
303
"staple-dual-left",
304
"staple-dual-top",
305
"staple-dual-right",
306
"staple-dual-bottom"
307
};
308
309
/**
310
* The enumeration value table for class {@code Finishings}.
311
*/
312
private static final Finishings[] myEnumValueTable =
313
{NONE,
314
STAPLE,
315
null,
316
COVER,
317
BIND,
318
SADDLE_STITCH,
319
EDGE_STITCH,
320
null, // The next ten enum values are reserved.
321
null,
322
null,
323
null,
324
null,
325
null,
326
null,
327
null,
328
null,
329
null,
330
STAPLE_TOP_LEFT,
331
STAPLE_BOTTOM_LEFT,
332
STAPLE_TOP_RIGHT,
333
STAPLE_BOTTOM_RIGHT,
334
EDGE_STITCH_LEFT,
335
EDGE_STITCH_TOP,
336
EDGE_STITCH_RIGHT,
337
EDGE_STITCH_BOTTOM,
338
STAPLE_DUAL_LEFT,
339
STAPLE_DUAL_TOP,
340
STAPLE_DUAL_RIGHT,
341
STAPLE_DUAL_BOTTOM
342
};
343
344
/**
345
* Returns the string table for class {@code Finishings}.
346
*/
347
protected String[] getStringTable() {
348
return myStringTable.clone();
349
}
350
351
/**
352
* Returns the enumeration value table for class {@code Finishings}.
353
*/
354
protected EnumSyntax[] getEnumValueTable() {
355
return (EnumSyntax[])myEnumValueTable.clone();
356
}
357
358
/**
359
* Returns the lowest integer value used by class {@code Finishings}.
360
*/
361
protected int getOffset() {
362
return 3;
363
}
364
365
/**
366
* Get the printing attribute class which is to be used as the "category"
367
* for this printing attribute value.
368
* <p>
369
* For class {@code Finishings} and any vendor-defined subclasses, the
370
* category is class {@code Finishings} itself.
371
*
372
* @return printing attribute class (category), an instance of class
373
* {@link Class java.lang.Class}
374
*/
375
public final Class<? extends Attribute> getCategory() {
376
return Finishings.class;
377
}
378
379
/**
380
* Get the name of the category of which this attribute value is an
381
* instance.
382
* <p>
383
* For class {@code Finishings} and any vendor-defined subclasses, the
384
* category name is {@code "finishings"}.
385
*
386
* @return attribute category name
387
*/
388
public final String getName() {
389
return "finishings";
390
}
391
}
392
393