KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MultipleDocumentHandling.java 1.9 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.PrintRequestAttribute JavaDoc;
12 import javax.print.attribute.PrintJobAttribute JavaDoc;
13
14 /**
15  * Class MultipleDocumentHandling is a printing attribute class, an enumeration,
16  * that controls finishing operations and the placement of one or more
17  * print-stream pages into impressions and onto media sheets. When the value of
18  * the {@link Copies Copies} attribute exceeds 1, MultipleDocumentHandling also
19  * controls the order in which the copies that result from processing the
20  * documents are produced. This attribute is relevant only for a multidoc print
21  * job consisting of two or more individual docs.
22  * <P>
23  * Briefly, MultipleDocumentHandling determines the relationship between the
24  * multiple input (electronic) documents fed into a multidoc print job and the
25  * output (physical) document or documents produced by the multidoc print job.
26  * There are two possibilities:
27  * <UL>
28  * <LI>
29  * The multiple input documents are combined into a single output document.
30  * Finishing operations ({@link Finishings Finishings}),
31  * are performed on this single output
32  * document. The {@link Copies Copies} attribute tells how many copies of this
33  * single output document to produce. The MultipleDocumentHandling values
34  * SINGLE_DOCUMENT and SINGLE_DOCUMENT_NEW_SHEET specify two variations of
35  * this possibility.
36  * <P>
37  * <LI>
38  * The multiple input documents remain separate output documents. Finishing
39  * operations ({@link Finishings Finishings}),
40  * are performed on each output document
41  * separately. The {@link Copies Copies} attribute tells how many copies of each
42  * separate output document to produce. The MultipleDocumentHandling values
43  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and SEPARATE_DOCUMENTS_COLLATED_COPIES
44  * specify two variations of this possibility.
45  * </UL>
46  * <P>
47  * In the detailed explanations below, if "<CODE>a</CODE>" represents an
48  * instance of document data, then the result of processing the data in
49  * document "<CODE>a</CODE>" is a sequence of media sheets represented by
50  * "<CODE>a(*)</CODE>".
51  * <P>
52  * The standard MultipleDocumentHandling values are:
53  * <UL>
54  * <LI>
55  * <A NAME="sdfi">{@link #SINGLE_DOCUMENT
56  * <B><CODE>SINGLE_DOCUMENT</CODE></B>}</A>. If a print job has multiple
57  * documents -- say, the document data is called <CODE>a</CODE> and
58  * <CODE>b</CODE> -- then the result of processing all the document data
59  * (<CODE>a</CODE> and then <CODE>b</CODE>) must be treated as a single sequence
60  * of media sheets for finishing operations; that is, finishing would be
61  * performed on the concatenation of the sequences <CODE>a(*),b(*)</CODE>. The
62  * printer must not force the data in each document instance to be formatted
63  * onto a new print-stream page, nor to start a new impression on a new media
64  * sheet. If more than one copy is made, the ordering of the sets of media
65  * sheets resulting from processing the document data must be
66  * <CODE>a(*),b(*),a(*),b(*),...</CODE>, and the printer object must force
67  * each copy (<CODE>a(*),b(*)</CODE>) to start on a new media sheet.
68  * <P>
69  * <LI>
70  * <A NAME="sducfi">{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
71  * <B><CODE>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</CODE></B>}</A>. If a print job
72  * has multiple documents -- say, the document data is called <CODE>a</CODE> and
73  * <CODE>b</CODE> -- then the result of processing the data in each document
74  * instance must be treated as a single sequence of media sheets for finishing
75  * operations; that is, the sets <CODE>a(*)</CODE> and <CODE>b(*)</CODE> would
76  * each be finished separately. The printer must force each copy of the result
77  * of processing the data in a single document to start on a new media sheet.
78  * If more than one copy is made, the ordering of the sets of media sheets
79  * resulting from processing the document data must be
80  * <CODE>a(*),a(*),...,b(*),b(*)...</CODE>.
81  * <P>
82  * <LI>
83  * <A NAME="sdccfi">{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
84  * <B><CODE>SEPARATE_DOCUMENTS_COLLATED_COPIES</CODE></B>}</A>. If a print job
85  * has multiple documents -- say, the document data is called <CODE>a</CODE> and
86  * <CODE>b</CODE> -- then the result of processing the data in each document
87  * instance must be treated as a single sequence of media sheets for finishing
88  * operations; that is, the sets <CODE>a(*)</CODE> and <CODE>b(*)</CODE> would
89  * each be finished separately. The printer must force each copy of the result
90  * of processing the data in a single document to start on a new media sheet.
91  * If more than one copy is made, the ordering of the sets of media sheets
92  * resulting from processing the document data must be
93  * <CODE>a(*),b(*),a(*),b(*),...</CODE>.
94  * <P>
95  * <LI>
96  * <A NAME="sdnsfi">{@link #SINGLE_DOCUMENT_NEW_SHEET
97  * <B><CODE>SINGLE_DOCUMENT_NEW_SHEET</CODE></B>}</A>. Same as SINGLE_DOCUMENT,
98  * except that the printer must ensure that the first impression of each
99  * document instance in the job is placed on a new media sheet. This value
100  * allows multiple documents to be stapled together with a single staple where
101  * each document starts on a new sheet.
102  * </UL>
103  * <P>
104  * SINGLE_DOCUMENT is the same as SEPARATE_DOCUMENTS_COLLATED_COPIES with
105  * respect to ordering of print-stream pages, but not media sheet generation,
106  * since SINGLE_DOCUMENT will put the first page of the next document on the
107  * back side of a sheet if an odd number of pages have been produced so far
108  * for the job, while SEPARATE_DOCUMENTS_COLLATED_COPIES always forces the
109  * next document or document copy on to a new sheet.
110  * <P>
111  * In addition, if a {@link Finishings Finishings} attribute of
112  * {@link Finishings#STAPLE <CODE>STAPLE</CODE>} is specified, then:
113  * <UL>
114  * <LI>
115  * With SINGLE_DOCUMENT, documents <CODE>a</CODE> and <CODE>b</CODE> are
116  * stapled together as a single document with no regard to new sheets.
117  * <P>
118  * <LI>
119  * With SINGLE_DOCUMENT_NEW_SHEET, documents <CODE>a</CODE> and <CODE>b</CODE>
120  * are stapled together as a single document, but document <CODE>b</CODE>
121  * starts on a new sheet.
122  * <P>
123  * <LI>
124  * With SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and
125  * SEPARATE_DOCUMENTS_COLLATED_COPIES, documents <CODE>a</CODE> and
126  * <CODE>b</CODE> are stapled separately.
127  * </UL>
128  * <P>
129  * <I>Note:</I> None of these values provide means to produce uncollated
130  * sheets within a document, i.e., where multiple copies of sheet <I>n</I>
131  * are produced before sheet <I>n</I>+1 of the same document.
132  * To specify that, see the {@link SheetCollate SheetCollate} attribute.
133  * <P>
134  * <B>IPP Compatibility:</B> The category name returned by
135  * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
136  * integer value is the IPP enum value. The <code>toString()</code> method
137  * returns the IPP string representation of the attribute value.
138  * <P>
139  *
140  * @see Copies
141  * @see Finishings
142  * @see NumberUp
143  * @see PageRanges
144  * @see SheetCollate
145  * @see Sides
146  *
147  * @author David Mendenhall
148  * @author Alan Kaminsky
149  */

150 public class MultipleDocumentHandling extends EnumSyntax JavaDoc
151     implements PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
152
153     private static final long serialVersionUID = 8098326460746413466L;
154
155
156     /**
157      * Single document -- see above for <A HREF="#sdfi">further
158      * information</A>.
159      */

160     public static final MultipleDocumentHandling JavaDoc
161     SINGLE_DOCUMENT = new MultipleDocumentHandling JavaDoc (0);
162
163     /**
164      * Separate documents uncollated copies -- see above for
165      * <A HREF="#sducfi">further information</A>.
166      */

167     public static final MultipleDocumentHandling JavaDoc
168        SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling JavaDoc (1);
169
170     /**
171      * Separate documents collated copies -- see above for
172      * <A HREF="#sdccfi">further information</A>.
173      */

174     public static final MultipleDocumentHandling JavaDoc
175     SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling JavaDoc (2);
176
177     /**
178      * Single document new sheet -- see above for
179      * <A HREF="#sdnsfi">further information</A>.
180      */

181     public static final MultipleDocumentHandling JavaDoc
182     SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling JavaDoc (3);
183
184
185     /**
186      * Construct a new multiple document handling enumeration value with the
187      * given integer value.
188      *
189      * @param value Integer value.
190      */

191     protected MultipleDocumentHandling(int value) {
192     super (value);
193     }
194
195     private static final String JavaDoc[] myStringTable = {
196     "single-document",
197     "separate-documents-uncollated-copies",
198     "separate-documents-collated-copies",
199     "single-document-new-sheet"
200     };
201
202     private static final MultipleDocumentHandling JavaDoc[] myEnumValueTable = {
203     SINGLE_DOCUMENT,
204     SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
205     SEPARATE_DOCUMENTS_COLLATED_COPIES,
206     SINGLE_DOCUMENT_NEW_SHEET
207     };
208
209     /**
210      * Returns the string table for class MultipleDocumentHandling.
211      */

212     protected String JavaDoc[] getStringTable() {
213     return (String JavaDoc[])myStringTable.clone();
214     }
215
216     /**
217      * Returns the enumeration value table for class MultipleDocumentHandling.
218      */

219     protected EnumSyntax JavaDoc[] getEnumValueTable() {
220     return (EnumSyntax JavaDoc[])myEnumValueTable.clone();
221     }
222
223     /**
224      * Get the printing attribute class which is to be used as the "category"
225      * for this printing attribute value.
226      * <P>
227      * For class MultipleDocumentHandling and any vendor-defined subclasses,
228      * the category is class MultipleDocumentHandling itself.
229      *
230      * @return Printing attribute class (category), an instance of class
231      * {@link java.lang.Class java.lang.Class}.
232      */

233     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
234     return MultipleDocumentHandling JavaDoc.class;
235     }
236
237     /**
238      * Get the name of the category of which this attribute value is an
239      * instance.
240      * <P>
241      * For class MultipleDocumentHandling and any vendor-defined subclasses,
242      * the category name is <CODE>"multiple-document-handling"</CODE>.
243      *
244      * @return Attribute category name.
245      */

246     public final String JavaDoc getName() {
247     return "multiple-document-handling";
248     }
249     
250 }
251
Popular Tags