KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > Finishings


1 /*
2  * @(#)Finishings.java 1.10 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.print.attribute.standard;
8
9 import javax.print.attribute.Attribute JavaDoc;
10 import javax.print.attribute.EnumSyntax JavaDoc;
11 import javax.print.attribute.DocAttribute JavaDoc;
12 import javax.print.attribute.PrintRequestAttribute JavaDoc;
13 import javax.print.attribute.PrintJobAttribute JavaDoc;
14
15 /**
16  * Class Finishings is a printing attribute class, an enumeration, that
17  * identifies whether the printer applies a finishing operation of some kind
18  * of binding to each copy of each printed document in the job. For multidoc
19  * print jobs (jobs with multiple documents), the
20  * {@link MultipleDocumentHandling
21  * MultipleDocumentHandling} attribute determines what constitutes a "copy"
22  * for purposes of finishing.
23  * <P>
24  * Standard Finishings values are:
25  * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
26  * <TR>
27  * <TD WIDTH=10%>
28  * &nbsp;
29  * </TD>
30  * <TD WIDTH=27%>
31  * {@link #NONE <CODE>NONE</CODE>}
32  * </TD>
33  * <TD WIDTH=27%>
34  * {@link #STAPLE <CODE>STAPLE</CODE>}
35  * </TD>
36  * <TD WIDTH=36%>
37  * {@link #EDGE_STITCH <CODE>EDGE_STITCH</CODE>}
38  * </TD>
39  * </TR>
40  * <TR>
41  * <TD>
42  * &nbsp;
43  * </TD>
44  * <TD>
45  * {@link #BIND <CODE>BIND</CODE>}
46  * </TD>
47  * <TD>
48  * {@link #SADDLE_STITCH <CODE>SADDLE_STITCH</CODE>}
49  * </TD>
50  * <TD>
51  * {@link #COVER <CODE>COVER</CODE>}
52  * </TD>
53  * <TD>
54  * &nbsp;
55  * </TD>
56  * </TR>
57  * </TABLE>
58  * <P>
59  * The following Finishings values are more specific; they indicate a
60  * corner or an edge as if the document were a portrait document:
61  * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
62  * <TR>
63  * <TD WIDTH=10%>
64  * &nbsp;
65  * </TD>
66  * <TD WIDTH=27%>
67  * {@link #STAPLE_TOP_LEFT <CODE>STAPLE_TOP_LEFT</CODE>}
68  * </TD>
69  * <TD WIDTH=27%>
70  * {@link #EDGE_STITCH_LEFT <CODE>EDGE_STITCH_LEFT</CODE>}
71  * </TD>
72  * <TD WIDTH=27%>
73  * {@link #STAPLE_DUAL_LEFT <CODE>STAPLE_DUAL_LEFT</CODE>}
74  * </TD>
75  * <TD WIDTH=9%>
76  * &nbsp;
77  * </TD>
78  * </TR>
79  * <TR>
80  * <TD WIDTH=10%>
81  * &nbsp;
82  * </TD>
83  * <TD WIDTH=27%>
84  * {@link #STAPLE_BOTTOM_LEFT <CODE>STAPLE_BOTTOM_LEFT</CODE>}
85  * </TD>
86  * <TD WIDTH=27%>
87  * {@link #EDGE_STITCH_TOP <CODE>EDGE_STITCH_TOP</CODE>}
88  * </TD>
89  * <TD WIDTH=27%>
90  * {@link #STAPLE_DUAL_TOP <CODE>STAPLE_DUAL_TOP</CODE>}
91  * </TD>
92  * <TD WIDTH=9%>
93  * &nbsp;
94  * </TD>
95  * </TR>
96  * <TR>
97  * <TD WIDTH=10%>
98  * &nbsp;
99  * </TD>
100  * <TD WIDTH=27%>
101  * {@link #STAPLE_TOP_RIGHT <CODE>STAPLE_TOP_RIGHT</CODE>}
102  * </TD>
103  * <TD WIDTH=27%>
104  * {@link #EDGE_STITCH_RIGHT <CODE>EDGE_STITCH_RIGHT</CODE>}
105  * </TD>
106  * <TD WIDTH=27%>
107  * {@link #STAPLE_DUAL_RIGHT <CODE>STAPLE_DUAL_RIGHT</CODE>}
108  * </TD>
109  * <TD WIDTH=9%>
110  * &nbsp;
111  * </TD>
112  * </TR>
113  * <TR>
114  * <TD WIDTH=10%>
115  * &nbsp;
116  * </TD>
117  * <TD WIDTH=27%>
118  * {@link #STAPLE_BOTTOM_RIGHT <CODE>STAPLE_BOTTOM_RIGHT</CODE>}
119  * </TD>
120  * <TD WIDTH=27%>
121  * {@link #EDGE_STITCH_BOTTOM <CODE>EDGE_STITCH_BOTTOM</CODE>}
122  * </TD>
123  * <TD WIDTH=27%>
124  * {@link #STAPLE_DUAL_BOTTOM <CODE>STAPLE_DUAL_BOTTOM</CODE>}
125  * </TD>
126  * <TD WIDTH=9%>
127  * &nbsp;
128  * </TD>
129  * </TR>
130  * </TABLE>
131  * <P>
132  * The <CODE>STAPLE_<I>XXX</I></CODE> values are specified with respect to the
133  * document as if the document were a portrait document. If the document is
134  * actually a landscape or a reverse-landscape document, the client supplies the
135  * appropriate transformed value. For example, to position a staple in the upper
136  * left hand corner of a landscape document when held for reading, the client
137  * supplies the <CODE>STAPLE_BOTTOM_LEFT</CODE> value (since landscape is
138  * defined as a +90 degree rotation from portrait, i.e., anti-clockwise). On the
139  * other hand, to position a staple in the upper left hand corner of a
140  * reverse-landscape document when held for reading, the client supplies the
141  * <CODE>STAPLE_TOP_RIGHT</CODE> value (since reverse-landscape is defined as a
142  * -90 degree rotation from portrait, i.e., clockwise).
143  * <P>
144  * The angle (vertical, horizontal, angled) of each staple with respect to the
145  * document depends on the implementation which may in turn depend on the value
146  * of the attribute.
147  * <P>
148  * The effect of a Finishings attribute on a multidoc print job (a job
149  * with multiple documents) depends on whether all the docs have the same
150  * binding specified or whether different docs have different bindings
151  * specified, and on the (perhaps defaulted) value of the {@link
152  * MultipleDocumentHandling MultipleDocumentHandling} attribute.
153  * <UL>
154  * <LI>
155  * If all the docs have the same binding specified, then any value of {@link
156  * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the
157  * printer's processing depends on the {@link MultipleDocumentHandling
158  * MultipleDocumentHandling} value:
159  * <UL>
160  * <LI>
161  * SINGLE_DOCUMENT -- All the input docs will be bound together as one output
162  * document with the specified binding.
163  * <P>
164  * <LI>
165  * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be bound together as one
166  * output document with the specified binding, and the first impression of each
167  * input doc will always start on a new media sheet.
168  * <P>
169  * <LI>
170  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound
171  * separately with the specified binding.
172  * <P>
173  * <LI>
174  * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately
175  * with the specified binding.
176  * </UL>
177  * <P>
178  * <LI>
179  * If different docs have different bindings specified, then only two values of
180  * {@link MultipleDocumentHandling MultipleDocumentHandling} make sense, and the
181  * printer reports an error when the job is submitted if any other value is
182  * specified:
183  * <UL>
184  * <LI>
185  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound
186  * separately with its own specified binding.
187  * <P>
188  * <LI>
189  * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately
190  * with its own specified binding.
191  * </UL>
192  * </UL>
193  * <P>
194  * <B>IPP Compatibility:</B> Class Finishings encapsulates some of the
195  * IPP enum values that can be included in an IPP "finishings" attribute, which
196  * is a set of enums. The category name returned by
197  * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
198  * integer value is the IPP enum value. The <code>toString()</code> method
199  * returns the IPP string representation of the attribute value.
200  * In IPP Finishings is a multi-value attribute, this API currently allows
201  * only one binding to be specified.
202  *
203  * @author Alan Kaminsky
204  */

205 public class Finishings extends EnumSyntax JavaDoc
206     implements DocAttribute JavaDoc, PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
207
208     private static final long serialVersionUID = -627840419548391754L;
209
210     /**
211      * Perform no binding.
212      */

213     public static final Finishings JavaDoc NONE = new Finishings JavaDoc(3);
214
215     /**
216      * Bind the document(s) with one or more staples. The exact number and
217      * placement of the staples is site-defined.
218      */

219     public static final Finishings JavaDoc STAPLE = new Finishings JavaDoc(4);
220
221     /**
222      * This value is specified when it is desired to select a non-printed (or
223      * pre-printed) cover for the document. This does not supplant the
224      * specification of a printed cover (on cover stock medium) by the
225      * document itself.
226      */

227     public static final Finishings JavaDoc COVER = new Finishings JavaDoc(6);
228
229     /**
230      * This value indicates that a binding is to be applied to the document;
231      * the type and placement of the binding is site-defined.
232      */

233     public static final Finishings JavaDoc BIND = new Finishings JavaDoc(7);
234
235     /**
236      * Bind the document(s) with one or more staples (wire stitches) along the
237      * middle fold. The exact number and placement of the staples and the
238      * middle fold is implementation- and/or site-defined.
239      */

240     public static final Finishings JavaDoc SADDLE_STITCH =
241     new Finishings JavaDoc(8);
242
243     /**
244      * Bind the document(s) with one or more staples (wire stitches) along one
245      * edge. The exact number and placement of the staples is implementation-
246      * and/or site- defined.
247      */

248     public static final Finishings JavaDoc EDGE_STITCH =
249     new Finishings JavaDoc(9);
250
251     /**
252      * Bind the document(s) with one or more staples in the top left corner.
253      */

254     public static final Finishings JavaDoc STAPLE_TOP_LEFT =
255     new Finishings JavaDoc(20);
256
257     /**
258      * Bind the document(s) with one or more staples in the bottom left
259      * corner.
260      */

261     public static final Finishings JavaDoc STAPLE_BOTTOM_LEFT =
262     new Finishings JavaDoc(21);
263
264     /**
265      * Bind the document(s) with one or more staples in the top right corner.
266      */

267     public static final Finishings JavaDoc STAPLE_TOP_RIGHT =
268     new Finishings JavaDoc(22);
269
270     /**
271      * Bind the document(s) with one or more staples in the bottom right
272      * corner.
273      */

274     public static final Finishings JavaDoc STAPLE_BOTTOM_RIGHT =
275     new Finishings JavaDoc(23);
276
277     /**
278      * Bind the document(s) with one or more staples (wire stitches) along the
279      * left edge. The exact number and placement of the staples is
280      * implementation- and/or site-defined.
281      */

282     public static final Finishings JavaDoc EDGE_STITCH_LEFT =
283     new Finishings JavaDoc(24);
284     
285     /**
286      * Bind the document(s) with one or more staples (wire stitches) along the
287      * top edge. The exact number and placement of the staples is
288      * implementation- and/or site-defined.
289      */

290     public static final Finishings JavaDoc EDGE_STITCH_TOP =
291     new Finishings JavaDoc(25);
292
293     /**
294      * Bind the document(s) with one or more staples (wire stitches) along the
295      * right edge. The exact number and placement of the staples is
296      * implementation- and/or site-defined.
297      */

298     public static final Finishings JavaDoc EDGE_STITCH_RIGHT =
299     new Finishings JavaDoc(26);
300     
301     /**
302      * Bind the document(s) with one or more staples (wire stitches) along the
303      * bottom edge. The exact number and placement of the staples is
304      * implementation- and/or site-defined.
305      */

306     public static final Finishings JavaDoc EDGE_STITCH_BOTTOM =
307     new Finishings JavaDoc(27);
308     
309     /**
310      * Bind the document(s) with two staples (wire stitches) along the left
311      * edge assuming a portrait document (see above).
312      */

313     public static final Finishings JavaDoc STAPLE_DUAL_LEFT =
314     new Finishings JavaDoc(28);
315
316     /**
317      * Bind the document(s) with two staples (wire stitches) along the top
318      * edge assuming a portrait document (see above).
319      */

320     public static final Finishings JavaDoc STAPLE_DUAL_TOP =
321     new Finishings JavaDoc(29);
322
323     /**
324      * Bind the document(s) with two staples (wire stitches) along the right
325      * edge assuming a portrait document (see above).
326      */

327     public static final Finishings JavaDoc STAPLE_DUAL_RIGHT =
328     new Finishings JavaDoc(30);
329
330     /**
331      * Bind the document(s) with two staples (wire stitches) along the bottom
332      * edge assuming a portrait document (see above).
333      */

334     public static final Finishings JavaDoc STAPLE_DUAL_BOTTOM =
335     new Finishings JavaDoc(31);
336
337     /**
338      * Construct a new finishings binding enumeration value with the given
339      * integer value.
340      *
341      * @param value Integer value.
342      */

343     protected Finishings(int value) {
344     super(value);
345     }
346
347     private static final String JavaDoc[] myStringTable =
348         {"none",
349          "staple",
350          null,
351          "cover",
352          "bind",
353          "saddle-stitch",
354          "edge-stitch",
355          null, // The next ten enum values are reserved.
356
null,
357          null,
358          null,
359          null,
360          null,
361          null,
362          null,
363          null,
364          null,
365          "staple-top-left",
366          "staple-bottom-left",
367          "staple-top-right",
368          "staple-bottom-right",
369          "edge-stitch-left",
370          "edge-stitch-top",
371          "edge-stitch-right",
372          "edge-stitch-bottom",
373          "staple-dual-left",
374          "staple-dual-top",
375          "staple-dual-right",
376          "staple-dual-bottom"
377         };
378
379     private static final Finishings JavaDoc[] myEnumValueTable =
380         {NONE,
381          STAPLE,
382          null,
383          COVER,
384          BIND,
385          SADDLE_STITCH,
386          EDGE_STITCH,
387          null, // The next ten enum values are reserved.
388
null,
389          null,
390          null,
391          null,
392          null,
393          null,
394          null,
395          null,
396          null,
397          STAPLE_TOP_LEFT,
398          STAPLE_BOTTOM_LEFT,
399          STAPLE_TOP_RIGHT,
400          STAPLE_BOTTOM_RIGHT,
401          EDGE_STITCH_LEFT,
402          EDGE_STITCH_TOP,
403          EDGE_STITCH_RIGHT,
404          EDGE_STITCH_BOTTOM,
405          STAPLE_DUAL_LEFT,
406          STAPLE_DUAL_TOP,
407          STAPLE_DUAL_RIGHT,
408          STAPLE_DUAL_BOTTOM
409         };
410
411     /**
412      * Returns the string table for class Finishings.
413      */

414     protected String JavaDoc[] getStringTable() {
415     return (String JavaDoc[])myStringTable.clone();
416     }
417
418     /**
419      * Returns the enumeration value table for class Finishings.
420      */

421     protected EnumSyntax JavaDoc[] getEnumValueTable() {
422     return (EnumSyntax JavaDoc[])myEnumValueTable.clone();
423     }
424     
425     /**
426      * Returns the lowest integer value used by class Finishings.
427      */

428     protected int getOffset() {
429     return 3;
430     }
431
432     /**
433      * Get the printing attribute class which is to be used as the "category"
434      * for this printing attribute value.
435      * <P>
436      * For class Finishings and any vendor-defined subclasses, the
437      * category is class Finishings itself.
438      *
439      * @return Printing attribute class (category), an instance of class
440      * {@link java.lang.Class java.lang.Class}.
441      */

442     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
443     return Finishings JavaDoc.class;
444     }
445
446     /**
447      * Get the name of the category of which this attribute value is an
448      * instance.
449      * <P>
450      * For class Finishings and any vendor-defined subclasses, the
451      * category name is <CODE>"finishings"</CODE>.
452      *
453      * @return Attribute category name.
454      */

455     public final String JavaDoc getName() {
456     return "finishings";
457     }
458     
459 }
460
Popular Tags