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.PrintRequestAttribute;
030 import javax.print.attribute.PrintJobAttribute;
031
032 /**
033 * Class MultipleDocumentHandling is a printing attribute class, an enumeration,
034 * that controls finishing operations and the placement of one or more
035 * print-stream pages into impressions and onto media sheets. When the value of
036 * the {@link Copies Copies} attribute exceeds 1, MultipleDocumentHandling also
037 * controls the order in which the copies that result from processing the
038 * documents are produced. This attribute is relevant only for a multidoc print
039 * job consisting of two or more individual docs.
040 * <P>
041 * Briefly, MultipleDocumentHandling determines the relationship between the
042 * multiple input (electronic) documents fed into a multidoc print job and the
043 * output (physical) document or documents produced by the multidoc print job.
044 * There are two possibilities:
045 * <UL>
046 * <LI>
047 * The multiple input documents are combined into a single output document.
048 * Finishing operations ({@link Finishings Finishings}),
049 * are performed on this single output
050 * document. The {@link Copies Copies} attribute tells how many copies of this
051 * single output document to produce. The MultipleDocumentHandling values
052 * SINGLE_DOCUMENT and SINGLE_DOCUMENT_NEW_SHEET specify two variations of
053 * this possibility.
054 * <P>
055 * <LI>
056 * The multiple input documents remain separate output documents. Finishing
057 * operations ({@link Finishings Finishings}),
058 * are performed on each output document
059 * separately. The {@link Copies Copies} attribute tells how many copies of each
060 * separate output document to produce. The MultipleDocumentHandling values
061 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and SEPARATE_DOCUMENTS_COLLATED_COPIES
062 * specify two variations of this possibility.
063 * </UL>
064 * <P>
065 * In the detailed explanations below, if "<CODE>a</CODE>" represents an
066 * instance of document data, then the result of processing the data in
067 * document "<CODE>a</CODE>" is a sequence of media sheets represented by
068 * "<CODE>a(*)</CODE>".
069 * <P>
070 * The standard MultipleDocumentHandling values are:
071 * <UL>
072 * <LI>
073 * <A NAME="sdfi">{@link #SINGLE_DOCUMENT
074 * <B><CODE>SINGLE_DOCUMENT</CODE></B>}</A>. If a print job has multiple
075 * documents -- say, the document data is called <CODE>a</CODE> and
076 * <CODE>b</CODE> -- then the result of processing all the document data
077 * (<CODE>a</CODE> and then <CODE>b</CODE>) must be treated as a single sequence
078 * of media sheets for finishing operations; that is, finishing would be
079 * performed on the concatenation of the sequences <CODE>a(*),b(*)</CODE>. The
080 * printer must not force the data in each document instance to be formatted
081 * onto a new print-stream page, nor to start a new impression on a new media
082 * sheet. If more than one copy is made, the ordering of the sets of media
083 * sheets resulting from processing the document data must be
084 * <CODE>a(*),b(*),a(*),b(*),...</CODE>, and the printer object must force
085 * each copy (<CODE>a(*),b(*)</CODE>) to start on a new media sheet.
086 * <P>
087 * <LI>
088 * <A NAME="sducfi">{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
089 * <B><CODE>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</CODE></B>}</A>. If a print job
090 * has multiple documents -- say, the document data is called <CODE>a</CODE> and
091 * <CODE>b</CODE> -- then the result of processing the data in each document
092 * instance must be treated as a single sequence of media sheets for finishing
093 * operations; that is, the sets <CODE>a(*)</CODE> and <CODE>b(*)</CODE> would
094 * each be finished separately. The printer must force each copy of the result
095 * of processing the data in a single document to start on a new media sheet.
096 * If more than one copy is made, the ordering of the sets of media sheets
097 * resulting from processing the document data must be
098 * <CODE>a(*),a(*),...,b(*),b(*)...</CODE>.
099 * <P>
100 * <LI>
101 * <A NAME="sdccfi">{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
102 * <B><CODE>SEPARATE_DOCUMENTS_COLLATED_COPIES</CODE></B>}</A>. If a print job
103 * has multiple documents -- say, the document data is called <CODE>a</CODE> and
104 * <CODE>b</CODE> -- then the result of processing the data in each document
105 * instance must be treated as a single sequence of media sheets for finishing
106 * operations; that is, the sets <CODE>a(*)</CODE> and <CODE>b(*)</CODE> would
107 * each be finished separately. The printer must force each copy of the result
108 * of processing the data in a single document to start on a new media sheet.
109 * If more than one copy is made, the ordering of the sets of media sheets
110 * resulting from processing the document data must be
111 * <CODE>a(*),b(*),a(*),b(*),...</CODE>.
112 * <P>
113 * <LI>
114 * <A NAME="sdnsfi">{@link #SINGLE_DOCUMENT_NEW_SHEET
115 * <B><CODE>SINGLE_DOCUMENT_NEW_SHEET</CODE></B>}</A>. Same as SINGLE_DOCUMENT,
116 * except that the printer must ensure that the first impression of each
117 * document instance in the job is placed on a new media sheet. This value
118 * allows multiple documents to be stapled together with a single staple where
119 * each document starts on a new sheet.
120 * </UL>
121 * <P>
122 * SINGLE_DOCUMENT is the same as SEPARATE_DOCUMENTS_COLLATED_COPIES with
123 * respect to ordering of print-stream pages, but not media sheet generation,
124 * since SINGLE_DOCUMENT will put the first page of the next document on the
125 * back side of a sheet if an odd number of pages have been produced so far
126 * for the job, while SEPARATE_DOCUMENTS_COLLATED_COPIES always forces the
127 * next document or document copy on to a new sheet.
128 * <P>
129 * In addition, if a {@link Finishings Finishings} attribute of
130 * {@link Finishings#STAPLE <CODE>STAPLE</CODE>} is specified, then:
131 * <UL>
132 * <LI>
133 * With SINGLE_DOCUMENT, documents <CODE>a</CODE> and <CODE>b</CODE> are
134 * stapled together as a single document with no regard to new sheets.
135 * <P>
136 * <LI>
137 * With SINGLE_DOCUMENT_NEW_SHEET, documents <CODE>a</CODE> and <CODE>b</CODE>
138 * are stapled together as a single document, but document <CODE>b</CODE>
139 * starts on a new sheet.
140 * <P>
141 * <LI>
142 * With SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and
143 * SEPARATE_DOCUMENTS_COLLATED_COPIES, documents <CODE>a</CODE> and
144 * <CODE>b</CODE> are stapled separately.
145 * </UL>
146 * <P>
147 * <I>Note:</I> None of these values provide means to produce uncollated
148 * sheets within a document, i.e., where multiple copies of sheet <I>n</I>
149 * are produced before sheet <I>n</I>+1 of the same document.
150 * To specify that, see the {@link SheetCollate SheetCollate} attribute.
151 * <P>
152 * <B>IPP Compatibility:</B> The category name returned by
153 * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
154 * integer value is the IPP enum value. The <code>toString()</code> method
155 * returns the IPP string representation of the attribute value.
156 * <P>
157 *
158 * @see Copies
159 * @see Finishings
160 * @see NumberUp
161 * @see PageRanges
162 * @see SheetCollate
163 * @see Sides
164 *
165 * @author David Mendenhall
166 * @author Alan Kaminsky
167 */
168 public class MultipleDocumentHandling extends EnumSyntax implements
169 PrintRequestAttribute, PrintJobAttribute {
170
171 private static final long serialVersionUID = 8098326460746413466L;
172
173 /**
174 * Single document -- see above for <A HREF="#sdfi">further
175 * information</A>.
176 */
177 public static final MultipleDocumentHandling SINGLE_DOCUMENT = new MultipleDocumentHandling(
178 0);
179
180 /**
181 * Separate documents uncollated copies -- see above for
182 * <A HREF="#sducfi">further information</A>.
183 */
184 public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling(
185 1);
186
187 /**
188 * Separate documents collated copies -- see above for
189 * <A HREF="#sdccfi">further information</A>.
190 */
191 public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling(
192 2);
193
194 /**
195 * Single document new sheet -- see above for
196 * <A HREF="#sdnsfi">further information</A>.
197 */
198 public static final MultipleDocumentHandling SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling(
199 3);
200
201 /**
202 * Construct a new multiple document handling enumeration value with the
203 * given integer value.
204 *
205 * @param value Integer value.
206 */
207 protected MultipleDocumentHandling(int value) {
208 super (value);
209 }
210
211 private static final String[] myStringTable = { "single-document",
212 "separate-documents-uncollated-copies",
213 "separate-documents-collated-copies",
214 "single-document-new-sheet" };
215
216 private static final MultipleDocumentHandling[] myEnumValueTable = {
217 SINGLE_DOCUMENT, SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
218 SEPARATE_DOCUMENTS_COLLATED_COPIES,
219 SINGLE_DOCUMENT_NEW_SHEET };
220
221 /**
222 * Returns the string table for class MultipleDocumentHandling.
223 */
224 protected String[] getStringTable() {
225 return (String[]) myStringTable.clone();
226 }
227
228 /**
229 * Returns the enumeration value table for class MultipleDocumentHandling.
230 */
231 protected EnumSyntax[] getEnumValueTable() {
232 return (EnumSyntax[]) myEnumValueTable.clone();
233 }
234
235 /**
236 * Get the printing attribute class which is to be used as the "category"
237 * for this printing attribute value.
238 * <P>
239 * For class MultipleDocumentHandling and any vendor-defined subclasses,
240 * the category is class MultipleDocumentHandling itself.
241 *
242 * @return Printing attribute class (category), an instance of class
243 * {@link java.lang.Class java.lang.Class}.
244 */
245 public final Class<? extends Attribute> getCategory() {
246 return MultipleDocumentHandling.class;
247 }
248
249 /**
250 * Get the name of the category of which this attribute value is an
251 * instance.
252 * <P>
253 * For class MultipleDocumentHandling and any vendor-defined subclasses,
254 * the category name is <CODE>"multiple-document-handling"</CODE>.
255 *
256 * @return Attribute category name.
257 */
258 public final String getName() {
259 return "multiple-document-handling";
260 }
261
262 }
|