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 SheetCollate is a printing attribute class, an enumeration, that
035 * specifies whether or not the media sheets of each copy of each printed
036 * document in a job are to be in sequence, when multiple copies of the document
037 * are specified by the {@link Copies Copies} attribute. When SheetCollate is
038 * COLLATED, each copy of each document is printed with the print-stream sheets
039 * in sequence. When SheetCollate is UNCOLLATED, each print-stream sheet is
040 * printed a number of times equal to the value of the {@link Copies Copies}
041 * attribute in succession. For example, suppose a document produces two media
042 * sheets as output, {@link Copies Copies} is 6, and SheetCollate is UNCOLLATED;
043 * in this case six copies of the first media sheet are printed followed by
044 * six copies of the second media sheet.
045 * <P>
046 * Whether the effect of sheet collation is achieved by placing copies of a
047 * document in multiple output bins or in the same output bin with
048 * implementation defined document separation is implementation dependent.
049 * Also whether it is achieved by making multiple passes over the job or by
050 * using an output sorter is implementation dependent.
051 * <P>
052 * If a printer does not support the SheetCollate attribute (meaning the client
053 * cannot specify any particular sheet collation), the printer must behave as
054 * though SheetCollate were always set to COLLATED.
055 * <P>
056 * The SheetCollate attribute interacts with the {@link MultipleDocumentHandling
057 * MultipleDocumentHandling} attribute. The {@link MultipleDocumentHandling
058 * MultipleDocumentHandling} attribute describes the collation of entire
059 * documents, and the SheetCollate attribute describes the semantics of
060 * collating individual pages within a document.
061 * <P>
062 * The effect of a SheetCollate attribute on a multidoc print job (a job with
063 * multiple documents) depends on whether all the docs have the same sheet
064 * collation specified or whether different docs have different sheet
065 * collations specified, and on the (perhaps defaulted) value of the {@link
066 * MultipleDocumentHandling MultipleDocumentHandling} attribute.
067 * <UL>
068 * <LI>
069 * If all the docs have the same sheet collation specified, then the following
070 * combinations of SheetCollate and {@link MultipleDocumentHandling
071 * MultipleDocumentHandling} are permitted, and the printer reports an error
072 * when the job is submitted if any other combination is specified:
073 * <UL>
074 * <LI>
075 * SheetCollate = COLLATED, {@link MultipleDocumentHandling
076 * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
077 * combined into one output document. Multiple copies of the output document
078 * will be produced with pages in collated order, i.e. pages 1, 2, 3, . . .,
079 * 1, 2, 3, . . .
080 * <P>
081 * <LI>
082 * SheetCollate = COLLATED, {@link MultipleDocumentHandling
083 * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs
084 * will be combined into one output document, and the first impression of each
085 * input doc will always start on a new media sheet. Multiple copies of the
086 * output document will be produced with pages in collated order, i.e. pages
087 * 1, 2, 3, . . ., 1, 2, 3, . . .
088 * <P>
089 * <LI>
090 * SheetCollate = COLLATED, {@link MultipleDocumentHandling
091 * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
092 * input doc will remain a separate output document. Multiple copies of each
093 * output document (call them A, B, . . .) will be produced with each document's
094 * pages in collated order, but the documents themselves in uncollated order,
095 * i.e. pages A1, A2, A3, . . ., A1, A2, A3, . . ., B1, B2, B3, . . ., B1, B2,
096 * B3, . . .
097 * <P>
098 * <LI>
099 * SheetCollate = COLLATED, {@link MultipleDocumentHandling
100 * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input
101 * doc will remain a separate output document. Multiple copies of each output
102 * document (call them A, B, . . .) will be produced with each document's pages
103 * in collated order, with the documents themselves also in collated order, i.e.
104 * pages A1, A2, A3, . . ., B1, B2, B3, . . ., A1, A2, A3, . . ., B1, B2, B3,
105 * . . .
106 * <P>
107 * <LI>
108 * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
109 * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
110 * combined into one output document. Multiple copies of the output document
111 * will be produced with pages in uncollated order, i.e. pages 1, 1, . . .,
112 * 2, 2, . . ., 3, 3, . . .
113 * <P>
114 * <LI>
115 * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
116 * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs
117 * will be combined into one output document, and the first impression of each
118 * input doc will always start on a new media sheet. Multiple copies of the
119 * output document will be produced with pages in uncollated order, i.e. pages
120 * 1, 1, . . ., 2, 2, . . ., 3, 3, . . .
121 * <P>
122 * <LI>
123 * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
124 * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
125 * input doc will remain a separate output document. Multiple copies of each
126 * output document (call them A, B, . . .) will be produced with each document's
127 * pages in uncollated order, with the documents themselves also in uncollated
128 * order, i.e. pages A1, A1, . . ., A2, A2, . . ., A3, A3, . . ., B1, B1, . . .,
129 * B2, B2, . . ., B3, B3, . . .
130 * </UL>
131 * <P>
132 * <LI>
133 * If different docs have different sheet collations specified, then only one
134 * value of {@link MultipleDocumentHandling MultipleDocumentHandling} is
135 * permitted, and the printer reports an error when the job is submitted if any
136 * other value is specified:
137 * <UL>
138 * <LI>
139 * {@link MultipleDocumentHandling MultipleDocumentHandling} =
140 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will remain a separate
141 * output document. Multiple copies of each output document (call them A, B,
142 * . . .) will be produced with each document's pages in collated or uncollated
143 * order as the corresponding input doc's SheetCollate attribute specifies, and
144 * with the documents themselves in uncollated order. If document A had
145 * SheetCollate = UNCOLLATED and document B had SheetCollate = COLLATED, the
146 * following pages would be produced: A1, A1, . . ., A2, A2, . . ., A3, A3,
147 * . . ., B1, B2, B3, . . ., B1, B2, B3, . . .
148 * </UL>
149 * </UL>
150 * <P>
151 * <B>IPP Compatibility:</B> SheetCollate is not an IPP attribute at present.
152 * <P>
153 *
154 * @see MultipleDocumentHandling
155 *
156 * @author Alan Kaminsky
157 */
158 public final class SheetCollate extends EnumSyntax implements
159 DocAttribute, PrintRequestAttribute, PrintJobAttribute {
160
161 private static final long serialVersionUID = 7080587914259873003L;
162
163 /**
164 * Sheets within a document appear in uncollated order when multiple
165 * copies are printed.
166 */
167 public static final SheetCollate UNCOLLATED = new SheetCollate(0);
168
169 /**
170 * Sheets within a document appear in collated order when multiple copies
171 * are printed.
172 */
173 public static final SheetCollate COLLATED = new SheetCollate(1);
174
175 /**
176 * Construct a new sheet collate enumeration value with the given integer
177 * value.
178 *
179 * @param value Integer value.
180 */
181 protected SheetCollate(int value) {
182 super (value);
183 }
184
185 private static final String[] myStringTable = { "uncollated",
186 "collated" };
187
188 private static final SheetCollate[] myEnumValueTable = {
189 UNCOLLATED, COLLATED };
190
191 /**
192 * Returns the string table for class SheetCollate.
193 */
194 protected String[] getStringTable() {
195 return myStringTable;
196 }
197
198 /**
199 * Returns the enumeration value table for class SheetCollate.
200 */
201 protected EnumSyntax[] getEnumValueTable() {
202 return myEnumValueTable;
203 }
204
205 /**
206 * Get the printing attribute class which is to be used as the "category"
207 * for this printing attribute value.
208 * <P>
209 * For class SheetCollate, the category is class SheetCollate itself.
210 *
211 * @return Printing attribute class (category), an instance of class
212 * {@link java.lang.Class java.lang.Class}.
213 */
214 public final Class<? extends Attribute> getCategory() {
215 return SheetCollate.class;
216 }
217
218 /**
219 * Get the name of the category of which this attribute value is an
220 * instance.
221 * <P>
222 * For class SheetCollate, the category name is <CODE>"sheet-collate"</CODE>.
223 *
224 * @return Attribute category name.
225 */
226 public final String getName() {
227 return "sheet-collate";
228 }
229
230 }
|