KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)Sides.java 1.8 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 Sides is a printing attribute class, an enumeration, that specifies
17  * how print-stream pages are to be imposed upon the sides of an instance of a
18  * selected medium, i.e., an impression.
19  * <P>
20  * The effect of a Sides attribute on a multidoc print job (a job with multiple
21  * documents) depends on whether all the docs have the same sides values
22  * specified or whether different docs have different sides values specified,
23  * and on the (perhaps defaulted) value of the {@link MultipleDocumentHandling
24  * MultipleDocumentHandling} attribute.
25  * <UL>
26  * <LI>
27  * If all the docs have the same sides value <I>n</I> specified, then any value
28  * of {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense,
29  * and the printer's processing depends on the {@link MultipleDocumentHandling
30  * MultipleDocumentHandling} value:
31  * <UL>
32  * <LI>
33  * SINGLE_DOCUMENT -- All the input docs will be combined together into one
34  * output document. Each media sheet will consist of <I>n</I> impressions from
35  * the output document.
36  * <P>
37  * <LI>
38  * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
39  * into one output document. Each media sheet will consist of <I>n</I>
40  * impressions from the output document. However, the first impression of each
41  * input doc will always start on a new media sheet; this means the last media
42  * sheet of an input doc may have only one impression on it.
43  * <P>
44  * <LI>
45  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
46  * Each media sheet will consist of <I>n</I> impressions from the input doc.
47  * Since the input docs are separate, the first impression of each input doc
48  * will always start on a new media sheet; this means the last media sheet of
49  * an input doc may have only one impression on it.
50  * <P>
51  * <LI>
52  * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
53  * Each media sheet will consist of <I>n</I> impressions from the input doc.
54  * Since the input docs are separate, the first impression of each input doc
55  * will always start on a new media sheet; this means the last media sheet of
56  * an input doc may have only one impression on it.
57  * </UL>
58  * <P>
59  * <UL>
60  * <LI>
61  * SINGLE_DOCUMENT -- All the input docs will be combined together into one
62  * output document. Each media sheet will consist of <I>n<SUB>i</SUB></I>
63  * impressions from the output document, where <I>i</I> is the number of the
64  * input doc corresponding to that point in the output document. When the next
65  * input doc has a different sides value from the previous input doc, the first
66  * print-stream page of the next input doc goes at the start of the next media
67  * sheet, possibly leaving only one impression on the previous media sheet.
68  * <P>
69  * <LI>
70  * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
71  * into one output document. Each media sheet will consist of <I>n</I>
72  * impressions from the output document. However, the first impression of each
73  * input doc will always start on a new media sheet; this means the last
74  * impression of an input doc may have only one impression on it.
75  * <P>
76  * <LI>
77  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
78  * For input doc <I>i,</I> each media sheet will consist of <I>n<SUB>i</SUB></I>
79  * impressions from the input doc. Since the input docs are separate, the first
80  * impression of each input doc will always start on a new media sheet; this
81  * means the last media sheet of an input doc may have only one impression on
82  * it.
83  * <P>
84  * <LI>
85  * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
86  * For input doc <I>i,</I> each media sheet will consist of <I>n<SUB>i</SUB></I>
87  * impressions from the input doc. Since the input docs are separate, the first
88  * impression of each input doc will always start on a new media sheet; this
89  * means the last media sheet of an input doc may have only one impression on
90  * it.
91  * </UL>
92  * </UL>
93  * <P>
94  * <B>IPP Compatibility:</B> The category name returned by
95  * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
96  * integer value is the IPP enum value. The <code>toString()</code> method
97  * returns the IPP string representation of the attribute value.
98  * <P>
99  *
100  * @author Alan Kaminsky
101  */

102
103 public final class Sides extends EnumSyntax JavaDoc
104     implements DocAttribute JavaDoc, PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
105
106     private static final long serialVersionUID = -6890309414893262822L;
107
108     /**
109      * Imposes each consecutive print-stream page upon the same side of
110      * consecutive media sheets.
111      */

112     public static final Sides JavaDoc ONE_SIDED = new Sides JavaDoc(0);
113
114     /**
115      * Imposes each consecutive pair of print-stream pages upon front and back
116      * sides of consecutive media sheets, such that the orientation of each
117      * pair of print-stream pages on the medium would be correct for the
118      * reader as if for binding on the long edge. This imposition is also
119      * known as "duplex" (see {@link #DUPLEX <CODE>DUPLEX</CODE>}).
120      */

121     public static final Sides JavaDoc TWO_SIDED_LONG_EDGE = new Sides JavaDoc(1);
122     
123     /**
124      * Imposes each consecutive pair of print-stream pages upon front and back
125      * sides of consecutive media sheets, such that the orientation of each
126      * pair of print-stream pages on the medium would be correct for the
127      * reader as if for binding on the short edge. This imposition is also
128      * known as "tumble" (see {@link #TUMBLE <CODE>TUMBLE</CODE>}).
129      */

130     public static final Sides JavaDoc TWO_SIDED_SHORT_EDGE = new Sides JavaDoc(2);
131
132     /**
133      * An alias for "two sided long edge" (see {@link #TWO_SIDED_LONG_EDGE
134      * <CODE>TWO_SIDED_LONG_EDGE</CODE>}).
135      */

136     public static final Sides JavaDoc DUPLEX = TWO_SIDED_LONG_EDGE;
137
138     /**
139      * An alias for "two sided short edge" (see {@link #TWO_SIDED_SHORT_EDGE
140      * <CODE>TWO_SIDED_SHORT_EDGE</CODE>}).
141      */

142     public static final Sides JavaDoc TUMBLE = TWO_SIDED_SHORT_EDGE;
143
144     /**
145      * Construct a new sides enumeration value with the given integer value.
146      *
147      * @param value Integer value.
148      */

149     protected Sides(int value) {
150     super (value);
151     }
152
153     private static final String JavaDoc[] myStringTable = {
154     "one-sided",
155     "two-sided-long-edge",
156     "two-sided-short-edge"
157     };
158
159     private static final Sides JavaDoc[] myEnumValueTable = {
160     ONE_SIDED,
161     TWO_SIDED_LONG_EDGE,
162     TWO_SIDED_SHORT_EDGE
163     };
164
165     /**
166      * Returns the string table for class Sides.
167      */

168     protected String JavaDoc[] getStringTable() {
169     return myStringTable;
170     }
171
172     /**
173      * Returns the enumeration value table for class Sides.
174      */

175     protected EnumSyntax JavaDoc[] getEnumValueTable() {
176     return myEnumValueTable;
177     }
178
179     /**
180      * Get the printing attribute class which is to be used as the "category"
181      * for this printing attribute value.
182      * <P>
183      * For class Sides, the category is class Sides itself.
184      *
185      * @return Printing attribute class (category), an instance of class
186      * {@link java.lang.Class java.lang.Class}.
187      */

188     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
189     return Sides JavaDoc.class;
190     }
191
192     /**
193      * Get the name of the category of which this attribute value is an
194      * instance.
195      * <P>
196      * For class Sides, the category name is <CODE>"sides"</CODE>.
197      *
198      * @return Attribute category name.
199      */

200     public final String JavaDoc getName() {
201     return "sides";
202     }
203     
204 }
205
Popular Tags