001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import javax.print.attribute.Attribute;
028 import javax.print.attribute.EnumSyntax;
029 import javax.print.attribute.DocAttribute;
030 import javax.print.attribute.PrintRequestAttribute;
031 import javax.print.attribute.PrintJobAttribute;
032
033 /**
034 * Class Finishings is a printing attribute class, an enumeration, that
035 * identifies whether the printer applies a finishing operation of some kind
036 * of binding to each copy of each printed document in the job. For multidoc
037 * print jobs (jobs with multiple documents), the
038 * {@link MultipleDocumentHandling
039 * MultipleDocumentHandling} attribute determines what constitutes a "copy"
040 * for purposes of finishing.
041 * <P>
042 * Standard Finishings values are:
043 * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
044 * <TR>
045 * <TD WIDTH=10%>
046 *
047 * </TD>
048 * <TD WIDTH=27%>
049 * {@link #NONE <CODE>NONE</CODE>}
050 * </TD>
051 * <TD WIDTH=27%>
052 * {@link #STAPLE <CODE>STAPLE</CODE>}
053 * </TD>
054 * <TD WIDTH=36%>
055 * {@link #EDGE_STITCH <CODE>EDGE_STITCH</CODE>}
056 * </TD>
057 * </TR>
058 * <TR>
059 * <TD>
060 *
061 * </TD>
062 * <TD>
063 * {@link #BIND <CODE>BIND</CODE>}
064 * </TD>
065 * <TD>
066 * {@link #SADDLE_STITCH <CODE>SADDLE_STITCH</CODE>}
067 * </TD>
068 * <TD>
069 * {@link #COVER <CODE>COVER</CODE>}
070 * </TD>
071 * <TD>
072 *
073 * </TD>
074 * </TR>
075 * </TABLE>
076 * <P>
077 * The following Finishings values are more specific; they indicate a
078 * corner or an edge as if the document were a portrait document:
079 * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
080 * <TR>
081 * <TD WIDTH=10%>
082 *
083 * </TD>
084 * <TD WIDTH=27%>
085 * {@link #STAPLE_TOP_LEFT <CODE>STAPLE_TOP_LEFT</CODE>}
086 * </TD>
087 * <TD WIDTH=27%>
088 * {@link #EDGE_STITCH_LEFT <CODE>EDGE_STITCH_LEFT</CODE>}
089 * </TD>
090 * <TD WIDTH=27%>
091 * {@link #STAPLE_DUAL_LEFT <CODE>STAPLE_DUAL_LEFT</CODE>}
092 * </TD>
093 * <TD WIDTH=9%>
094 *
095 * </TD>
096 * </TR>
097 * <TR>
098 * <TD WIDTH=10%>
099 *
100 * </TD>
101 * <TD WIDTH=27%>
102 * {@link #STAPLE_BOTTOM_LEFT <CODE>STAPLE_BOTTOM_LEFT</CODE>}
103 * </TD>
104 * <TD WIDTH=27%>
105 * {@link #EDGE_STITCH_TOP <CODE>EDGE_STITCH_TOP</CODE>}
106 * </TD>
107 * <TD WIDTH=27%>
108 * {@link #STAPLE_DUAL_TOP <CODE>STAPLE_DUAL_TOP</CODE>}
109 * </TD>
110 * <TD WIDTH=9%>
111 *
112 * </TD>
113 * </TR>
114 * <TR>
115 * <TD WIDTH=10%>
116 *
117 * </TD>
118 * <TD WIDTH=27%>
119 * {@link #STAPLE_TOP_RIGHT <CODE>STAPLE_TOP_RIGHT</CODE>}
120 * </TD>
121 * <TD WIDTH=27%>
122 * {@link #EDGE_STITCH_RIGHT <CODE>EDGE_STITCH_RIGHT</CODE>}
123 * </TD>
124 * <TD WIDTH=27%>
125 * {@link #STAPLE_DUAL_RIGHT <CODE>STAPLE_DUAL_RIGHT</CODE>}
126 * </TD>
127 * <TD WIDTH=9%>
128 *
129 * </TD>
130 * </TR>
131 * <TR>
132 * <TD WIDTH=10%>
133 *
134 * </TD>
135 * <TD WIDTH=27%>
136 * {@link #STAPLE_BOTTOM_RIGHT <CODE>STAPLE_BOTTOM_RIGHT</CODE>}
137 * </TD>
138 * <TD WIDTH=27%>
139 * {@link #EDGE_STITCH_BOTTOM <CODE>EDGE_STITCH_BOTTOM</CODE>}
140 * </TD>
141 * <TD WIDTH=27%>
142 * {@link #STAPLE_DUAL_BOTTOM <CODE>STAPLE_DUAL_BOTTOM</CODE>}
143 * </TD>
144 * <TD WIDTH=9%>
145 *
146 * </TD>
147 * </TR>
148 * </TABLE>
149 * <P>
150 * The <CODE>STAPLE_<I>XXX</I></CODE> values are specified with respect to the
151 * document as if the document were a portrait document. If the document is
152 * actually a landscape or a reverse-landscape document, the client supplies the
153 * appropriate transformed value. For example, to position a staple in the upper
154 * left hand corner of a landscape document when held for reading, the client
155 * supplies the <CODE>STAPLE_BOTTOM_LEFT</CODE> value (since landscape is
156 * defined as a +90 degree rotation from portrait, i.e., anti-clockwise). On the
157 * other hand, to position a staple in the upper left hand corner of a
158 * reverse-landscape document when held for reading, the client supplies the
159 * <CODE>STAPLE_TOP_RIGHT</CODE> value (since reverse-landscape is defined as a
160 * -90 degree rotation from portrait, i.e., clockwise).
161 * <P>
162 * The angle (vertical, horizontal, angled) of each staple with respect to the
163 * document depends on the implementation which may in turn depend on the value
164 * of the attribute.
165 * <P>
166 * The effect of a Finishings attribute on a multidoc print job (a job
167 * with multiple documents) depends on whether all the docs have the same
168 * binding specified or whether different docs have different bindings
169 * specified, and on the (perhaps defaulted) value of the {@link
170 * MultipleDocumentHandling MultipleDocumentHandling} attribute.
171 * <UL>
172 * <LI>
173 * If all the docs have the same binding specified, then any value of {@link
174 * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the
175 * printer's processing depends on the {@link MultipleDocumentHandling
176 * MultipleDocumentHandling} value:
177 * <UL>
178 * <LI>
179 * SINGLE_DOCUMENT -- All the input docs will be bound together as one output
180 * document with the specified binding.
181 * <P>
182 * <LI>
183 * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be bound together as one
184 * output document with the specified binding, and the first impression of each
185 * input doc will always start on a new media sheet.
186 * <P>
187 * <LI>
188 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound
189 * separately with the specified binding.
190 * <P>
191 * <LI>
192 * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately
193 * with the specified binding.
194 * </UL>
195 * <P>
196 * <LI>
197 * If different docs have different bindings specified, then only two values of
198 * {@link MultipleDocumentHandling MultipleDocumentHandling} make sense, and the
199 * printer reports an error when the job is submitted if any other value is
200 * specified:
201 * <UL>
202 * <LI>
203 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound
204 * separately with its own specified binding.
205 * <P>
206 * <LI>
207 * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately
208 * with its own specified binding.
209 * </UL>
210 * </UL>
211 * <P>
212 * <B>IPP Compatibility:</B> Class Finishings encapsulates some of the
213 * IPP enum values that can be included in an IPP "finishings" attribute, which
214 * is a set of enums. The category name returned by
215 * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
216 * integer value is the IPP enum value. The <code>toString()</code> method
217 * returns the IPP string representation of the attribute value.
218 * In IPP Finishings is a multi-value attribute, this API currently allows
219 * only one binding to be specified.
220 *
221 * @author Alan Kaminsky
222 */
223 public class Finishings extends EnumSyntax implements DocAttribute,
224 PrintRequestAttribute, PrintJobAttribute {
225
226 private static final long serialVersionUID = -627840419548391754L;
227
228 /**
229 * Perform no binding.
230 */
231 public static final Finishings NONE = new Finishings(3);
232
233 /**
234 * Bind the document(s) with one or more staples. The exact number and
235 * placement of the staples is site-defined.
236 */
237 public static final Finishings STAPLE = new Finishings(4);
238
239 /**
240 * This value is specified when it is desired to select a non-printed (or
241 * pre-printed) cover for the document. This does not supplant the
242 * specification of a printed cover (on cover stock medium) by the
243 * document itself.
244 */
245 public static final Finishings COVER = new Finishings(6);
246
247 /**
248 * This value indicates that a binding is to be applied to the document;
249 * the type and placement of the binding is site-defined.
250 */
251 public static final Finishings BIND = new Finishings(7);
252
253 /**
254 * Bind the document(s) with one or more staples (wire stitches) along the
255 * middle fold. The exact number and placement of the staples and the
256 * middle fold is implementation- and/or site-defined.
257 */
258 public static final Finishings SADDLE_STITCH = new Finishings(8);
259
260 /**
261 * Bind the document(s) with one or more staples (wire stitches) along one
262 * edge. The exact number and placement of the staples is implementation-
263 * and/or site- defined.
264 */
265 public static final Finishings EDGE_STITCH = new Finishings(9);
266
267 /**
268 * Bind the document(s) with one or more staples in the top left corner.
269 */
270 public static final Finishings STAPLE_TOP_LEFT = new Finishings(20);
271
272 /**
273 * Bind the document(s) with one or more staples in the bottom left
274 * corner.
275 */
276 public static final Finishings STAPLE_BOTTOM_LEFT = new Finishings(
277 21);
278
279 /**
280 * Bind the document(s) with one or more staples in the top right corner.
281 */
282 public static final Finishings STAPLE_TOP_RIGHT = new Finishings(22);
283
284 /**
285 * Bind the document(s) with one or more staples in the bottom right
286 * corner.
287 */
288 public static final Finishings STAPLE_BOTTOM_RIGHT = new Finishings(
289 23);
290
291 /**
292 * Bind the document(s) with one or more staples (wire stitches) along the
293 * left edge. The exact number and placement of the staples is
294 * implementation- and/or site-defined.
295 */
296 public static final Finishings EDGE_STITCH_LEFT = new Finishings(24);
297
298 /**
299 * Bind the document(s) with one or more staples (wire stitches) along the
300 * top edge. The exact number and placement of the staples is
301 * implementation- and/or site-defined.
302 */
303 public static final Finishings EDGE_STITCH_TOP = new Finishings(25);
304
305 /**
306 * Bind the document(s) with one or more staples (wire stitches) along the
307 * right edge. The exact number and placement of the staples is
308 * implementation- and/or site-defined.
309 */
310 public static final Finishings EDGE_STITCH_RIGHT = new Finishings(
311 26);
312
313 /**
314 * Bind the document(s) with one or more staples (wire stitches) along the
315 * bottom edge. The exact number and placement of the staples is
316 * implementation- and/or site-defined.
317 */
318 public static final Finishings EDGE_STITCH_BOTTOM = new Finishings(
319 27);
320
321 /**
322 * Bind the document(s) with two staples (wire stitches) along the left
323 * edge assuming a portrait document (see above).
324 */
325 public static final Finishings STAPLE_DUAL_LEFT = new Finishings(28);
326
327 /**
328 * Bind the document(s) with two staples (wire stitches) along the top
329 * edge assuming a portrait document (see above).
330 */
331 public static final Finishings STAPLE_DUAL_TOP = new Finishings(29);
332
333 /**
334 * Bind the document(s) with two staples (wire stitches) along the right
335 * edge assuming a portrait document (see above).
336 */
337 public static final Finishings STAPLE_DUAL_RIGHT = new Finishings(
338 30);
339
340 /**
341 * Bind the document(s) with two staples (wire stitches) along the bottom
342 * edge assuming a portrait document (see above).
343 */
344 public static final Finishings STAPLE_DUAL_BOTTOM = new Finishings(
345 31);
346
347 /**
348 * Construct a new finishings binding enumeration value with the given
349 * integer value.
350 *
351 * @param value Integer value.
352 */
353 protected Finishings(int value) {
354 super (value);
355 }
356
357 private static final String[] myStringTable = {
358 "none",
359 "staple",
360 null,
361 "cover",
362 "bind",
363 "saddle-stitch",
364 "edge-stitch",
365 null, // The next ten enum values are reserved.
366 null, null, null, null, null, null, null, null, null,
367 "staple-top-left", "staple-bottom-left",
368 "staple-top-right", "staple-bottom-right",
369 "edge-stitch-left", "edge-stitch-top", "edge-stitch-right",
370 "edge-stitch-bottom", "staple-dual-left",
371 "staple-dual-top", "staple-dual-right",
372 "staple-dual-bottom" };
373
374 private static final Finishings[] myEnumValueTable = { NONE,
375 STAPLE, null,
376 COVER,
377 BIND,
378 SADDLE_STITCH,
379 EDGE_STITCH,
380 null, // The next ten enum values are reserved.
381 null, null, null, null, null, null, null, null, null,
382 STAPLE_TOP_LEFT, STAPLE_BOTTOM_LEFT, STAPLE_TOP_RIGHT,
383 STAPLE_BOTTOM_RIGHT, EDGE_STITCH_LEFT, EDGE_STITCH_TOP,
384 EDGE_STITCH_RIGHT, EDGE_STITCH_BOTTOM, STAPLE_DUAL_LEFT,
385 STAPLE_DUAL_TOP, STAPLE_DUAL_RIGHT, STAPLE_DUAL_BOTTOM };
386
387 /**
388 * Returns the string table for class Finishings.
389 */
390 protected String[] getStringTable() {
391 return (String[]) myStringTable.clone();
392 }
393
394 /**
395 * Returns the enumeration value table for class Finishings.
396 */
397 protected EnumSyntax[] getEnumValueTable() {
398 return (EnumSyntax[]) myEnumValueTable.clone();
399 }
400
401 /**
402 * Returns the lowest integer value used by class Finishings.
403 */
404 protected int getOffset() {
405 return 3;
406 }
407
408 /**
409 * Get the printing attribute class which is to be used as the "category"
410 * for this printing attribute value.
411 * <P>
412 * For class Finishings and any vendor-defined subclasses, the
413 * category is class Finishings itself.
414 *
415 * @return Printing attribute class (category), an instance of class
416 * {@link java.lang.Class java.lang.Class}.
417 */
418 public final Class<? extends Attribute> getCategory() {
419 return Finishings.class;
420 }
421
422 /**
423 * Get the name of the category of which this attribute value is an
424 * instance.
425 * <P>
426 * For class Finishings and any vendor-defined subclasses, the
427 * category name is <CODE>"finishings"</CODE>.
428 *
429 * @return Attribute category name.
430 */
431 public final String getName() {
432 return "finishings";
433 }
434
435 }
|