< prev index next >

src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */

  25 package javax.print.attribute.standard;
  26 
  27 import javax.print.attribute.Attribute;
  28 import javax.print.attribute.EnumSyntax;
  29 import javax.print.attribute.PrintRequestAttribute;
  30 import javax.print.attribute.PrintJobAttribute;

  31 
  32 /**
  33  * Class MultipleDocumentHandling is a printing attribute class, an enumeration,
  34  * that controls finishing operations and the placement of one or more
  35  * print-stream pages into impressions and onto media sheets. When the value of
  36  * the {@link Copies Copies} attribute exceeds 1, MultipleDocumentHandling also
  37  * controls the order in which the copies that result from processing the
  38  * documents are produced. This attribute is relevant only for a multidoc print
  39  * job consisting of two or more individual docs.
  40  * <P>
  41  * Briefly, MultipleDocumentHandling determines the relationship between the
  42  * multiple input (electronic) documents fed into a multidoc print job and the
  43  * output (physical) document or documents produced by the multidoc print job.


  44  * There are two possibilities:
  45  * <UL>
  46  * <LI>
  47  * The multiple input documents are combined into a single output document.
  48  * Finishing operations ({@link Finishings Finishings}),
  49  * are performed on this single output
  50  * document. The {@link Copies Copies} attribute tells how many copies of this
  51  * single output document to produce. The MultipleDocumentHandling values
  52  * SINGLE_DOCUMENT and SINGLE_DOCUMENT_NEW_SHEET specify two variations of
  53  * this  possibility.
  54  *
  55  * <LI>
  56  * The multiple input documents remain separate output documents. Finishing
  57  * operations ({@link Finishings Finishings}),
  58  * are performed on each output document
  59  * separately. The {@link Copies Copies} attribute tells how many copies of each
  60  * separate output document to produce. The MultipleDocumentHandling values
  61  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and SEPARATE_DOCUMENTS_COLLATED_COPIES
  62  * specify two variations of this possibility.
  63  * </UL>
  64  * <P>
  65  * In the detailed explanations below, if "{@code a}" represents an
  66  * instance of document data, then the result of processing the data in
  67  * document "{@code a}" is a sequence of media sheets represented by
  68  * "{@code a(*)}".
  69  * <P>
  70  * The standard MultipleDocumentHandling values are:
  71  * <UL>
  72  * <LI>
  73  * <a id="sdfi"></a>{@link #SINGLE_DOCUMENT
  74  * <B>SINGLE_DOCUMENT</B>}. If a print job has multiple
  75  * documents -- say, the document data is called {@code a} and
  76  * {@code b} -- then the result of processing all the document data
  77  * ({@code a} and then {@code b}) must be treated as a single sequence
  78  * of media sheets for finishing operations; that is, finishing would be
  79  * performed on the concatenation of the sequences {@code a(*),b(*)}. The
  80  * printer must not force the data in each document instance to be formatted
  81  * onto a new print-stream page, nor to start a new impression on a new media
  82  * sheet. If more than one copy is made, the ordering of the sets of media
  83  * sheets resulting from processing the document data must be
  84  * {@code a(*),b(*),a(*),b(*),...}, and the printer object must force
  85  * each copy ({@code a(*),b(*)}) to start on a new media sheet.
  86  *
  87  * <LI>
  88  * <a id="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
  89  * <B>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</B>}. If a print job
  90  * has multiple documents -- say, the document data is called {@code a} and
  91  * {@code b} -- then the result of processing the data in each document
  92  * instance must be treated as a single sequence of media sheets for finishing
  93  * operations; that is, the sets {@code a(*)} and {@code b(*)} would
  94  * each be finished separately. The printer must force each copy of the result
  95  * of processing the data in a single document to start on a new media sheet.
  96  * If more than one copy is made, the ordering of the sets of media sheets
  97  * resulting from processing the document data must be
  98  * {@code a(*),a(*),...,b(*),b(*)...}.
  99  *
 100  * <LI>
 101  * <a id="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
 102  * <B>SEPARATE_DOCUMENTS_COLLATED_COPIES</B>}. If a print job
 103  * has multiple documents -- say, the document data is called {@code a} and
 104  * {@code b} -- 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(*)} and {@code b(*)} 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(*),...}.
 112  *
 113  * <LI>
 114  * <a id="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
 115  * <B>SINGLE_DOCUMENT_NEW_SHEET</B>}. 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 STAPLE} is specified, then:
 131  * <UL>
 132  * <LI>
 133  * With SINGLE_DOCUMENT, documents {@code a} and {@code b} are
 134  * stapled together as a single document with no regard to new sheets.
 135  *
 136  * <LI>
 137  * With SINGLE_DOCUMENT_NEW_SHEET, documents {@code a} and {@code b}
 138  * are stapled together as a single document, but document {@code b}
 139  * starts on a new sheet.
 140  *
 141  * <LI>
 142  * With SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and
 143  * SEPARATE_DOCUMENTS_COLLATED_COPIES, documents {@code a} and
 144  * {@code b} 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()} is the IPP attribute name.  The enumeration's
 154  * integer value is the IPP enum value.  The {@code toString()} method
 155  * returns the IPP string representation of the attribute value.
 156  *


 157  * @see  Copies
 158  * @see  Finishings
 159  * @see  NumberUp
 160  * @see  PageRanges
 161  * @see  SheetCollate
 162  * @see  Sides
 163  *
 164  * @author  David Mendenhall
 165  * @author  Alan Kaminsky
 166  */
 167 public class MultipleDocumentHandling extends EnumSyntax
 168     implements PrintRequestAttribute, PrintJobAttribute {
 169 



 170     private static final long serialVersionUID = 8098326460746413466L;
 171 
 172 
 173     /**
 174      * Single document -- see above for <A HREF="#sdfi">further
 175      * information</A>.
 176      */
 177     public static final MultipleDocumentHandling
 178         SINGLE_DOCUMENT = new MultipleDocumentHandling (0);
 179 
 180     /**
 181      * Separate documents uncollated copies -- see above for
 182      * <A HREF="#sducfi">further information</A>.
 183      */
 184     public static final MultipleDocumentHandling
 185        SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling (1);
 186 
 187     /**
 188      * Separate documents collated copies -- see above for
 189      * <A HREF="#sdccfi">further information</A>.
 190      */
 191     public static final MultipleDocumentHandling
 192         SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling (2);
 193 
 194     /**
 195      * Single document new sheet -- see above for
 196      * <A HREF="#sdnsfi">further information</A>.
 197      */
 198     public static final MultipleDocumentHandling
 199         SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling (3);
 200 
 201 
 202     /**
 203      * Construct a new multiple document handling enumeration value with the
 204      * given integer value.
 205      *
 206      * @param  value  Integer value.
 207      */
 208     protected MultipleDocumentHandling(int value) {
 209         super (value);
 210     }
 211 



 212     private static final String[] myStringTable = {
 213         "single-document",
 214         "separate-documents-uncollated-copies",
 215         "separate-documents-collated-copies",
 216         "single-document-new-sheet"
 217     };
 218 



 219     private static final MultipleDocumentHandling[] myEnumValueTable = {
 220         SINGLE_DOCUMENT,
 221         SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
 222         SEPARATE_DOCUMENTS_COLLATED_COPIES,
 223         SINGLE_DOCUMENT_NEW_SHEET
 224     };
 225 
 226     /**
 227      * Returns the string table for class MultipleDocumentHandling.
 228      */
 229     protected String[] getStringTable() {
 230         return myStringTable.clone();
 231     }
 232 
 233     /**
 234      * Returns the enumeration value table for class MultipleDocumentHandling.

 235      */
 236     protected EnumSyntax[] getEnumValueTable() {
 237         return (EnumSyntax[])myEnumValueTable.clone();
 238     }
 239 
 240     /**
 241      * Get the printing attribute class which is to be used as the "category"
 242      * for this printing attribute value.
 243      * <P>
 244      * For class MultipleDocumentHandling and any vendor-defined subclasses,
 245      * the category is class MultipleDocumentHandling itself.

 246      *
 247      * @return  Printing attribute class (category), an instance of class
 248      *          {@link java.lang.Class java.lang.Class}.
 249      */
 250     public final Class<? extends Attribute> getCategory() {
 251         return MultipleDocumentHandling.class;
 252     }
 253 
 254     /**
 255      * Get the name of the category of which this attribute value is an
 256      * instance.
 257      * <P>
 258      * For class MultipleDocumentHandling and any vendor-defined subclasses,
 259      * the category name is {@code "multiple-document-handling"}.
 260      *
 261      * @return  Attribute category name.
 262      */
 263     public final String getName() {
 264         return "multiple-document-handling";
 265     }
 266 
 267 }


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.print.attribute.standard;
  27 
  28 import javax.print.attribute.Attribute;
  29 import javax.print.attribute.EnumSyntax;

  30 import javax.print.attribute.PrintJobAttribute;
  31 import javax.print.attribute.PrintRequestAttribute;
  32 
  33 /**
  34  * Class {@code MultipleDocumentHandling} is a printing attribute class, an
  35  * enumeration, that controls finishing operations and the placement of one or
  36  * more print-stream pages into impressions and onto media sheets. When the
  37  * value of the {@link Copies Copies} attribute exceeds 1,
  38  * {@code MultipleDocumentHandling} also controls the order in which the copies
  39  * that result from processing the documents are produced. This attribute is
  40  * relevant only for a multidoc print job consisting of two or more individual
  41  * docs.
  42  * <p>
  43  * Briefly, {@code MultipleDocumentHandling} determines the relationship between
  44  * the multiple input (electronic) documents fed into a multidoc print job and
  45  * the output (physical) document or documents produced by the multidoc print
  46  * job.
  47  * There are two possibilities:
  48  * <ul>
  49  *   <li>The multiple input documents are combined into a single output
  50  *   document. Finishing operations ({@link Finishings Finishings}), are
  51  *   performed on this single output document. The {@link Copies Copies}
  52  *   attribute tells how many copies of this single output document to produce.
  53  *   The {@code MultipleDocumentHandling} values {@code SINGLE_DOCUMENT} and
  54  *   {@code SINGLE_DOCUMENT_NEW_SHEET} specify two variations of this
  55  *   possibility.
  56  *   <li>The multiple input documents remain separate output documents.
  57  *   Finishing operations ({@link Finishings Finishings}), are performed on each
  58  *   output document separately. The {@link Copies Copies} attribute tells how
  59  *   many copies of each separate output document to produce. The
  60  *   {@code MultipleDocumentHandling} values
  61  *   {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} and
  62  *   {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} specify two variations of this
  63  *   possibility.
  64  * </ul>
  65  * In the detailed explanations below, if "{@code a}" represents an instance of
  66  * document data, then the result of processing the data in document "{@code a}"
  67  * is a sequence of media sheets represented by "{@code a(*)}".
  68  * <p>
  69  * The standard {@code MultipleDocumentHandling} values are:
  70  * <ul>
  71  *   <li><a id="sdfi"></a>{@link #SINGLE_DOCUMENT <b>SINGLE_DOCUMENT</b>}. If a
  72  *   print job has multiple documents -- say, the document data is called
  73  *   {@code a} and {@code b} -- then the result of processing all the document
  74  *   data ({@code a} and then {@code b}) must be treated as a single sequence of
  75  *   media sheets for finishing operations; that is, finishing would be






  76  *   performed on the concatenation of the sequences {@code a(*),b(*)}. The
  77  *   printer must not force the data in each document instance to be formatted
  78  *   onto a new print-stream page, nor to start a new impression on a new media
  79  *   sheet. If more than one copy is made, the ordering of the sets of media
  80  *   sheets resulting from processing the document data must be
  81  *   {@code a(*),b(*),a(*),b(*),...}, and the printer object must force each
  82  *   copy ({@code a(*),b(*)}) to start on a new media sheet.
  83  *   <li><a id="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
  84  *   <b>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</b>}. If a print job has multiple
  85  *   documents -- say, the document data is called {@code a} and {@code b} --
  86  *   then the result of processing the data in each document instance must be
  87  *   treated as a single sequence of media sheets for finishing operations; that
  88  *   is, the sets {@code a(*)} and {@code b(*)} would each be finished
  89  *   separately. The printer must force each copy of the result of processing
  90  *   the data in a single document to start on a new media sheet. If more than
  91  *   one copy is made, the ordering of the sets of media sheets resulting from
  92  *   processing the document data must be {@code a(*),a(*),...,b(*),b(*)...}.
  93  *   <li><a id="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
  94  *   <b>SEPARATE_DOCUMENTS_COLLATED_COPIES</b>}. If a print job has multiple
  95  *   documents -- say, the document data is called {@code a} and {@code b} --
  96  *   then the result of processing the data in each document instance must be
  97  *   treated as a single sequence of media sheets for finishing operations; that
  98  *   is, the sets {@code a(*)} and {@code b(*)} would each be finished
  99  *   separately. The printer must force each copy of the result of processing
 100  *   the data in a single document to start on a new media sheet. If more than
 101  *   one copy is made, the ordering of the sets of media sheets resulting from
 102  *   processing the document data must be {@code a(*),b(*),a(*),b(*),...}.
 103  *   <li><a id="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
 104  *   <b>SINGLE_DOCUMENT_NEW_SHEET</b>}. Same as SINGLE_DOCUMENT, except that the
 105  *   printer must ensure that the first impression of each document instance in
 106  *   the job is placed on a new media sheet. This value allows multiple
 107  *   documents to be stapled together with a single staple where each document
 108  *   starts on a new sheet.
 109  * </ul>
 110  * <p>
 111  * {@code SINGLE_DOCUMENT} is the same as
 112  * {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} with respect to ordering of
 113  * print-stream pages, but not media sheet generation, since
 114  * {@code SINGLE_DOCUMENT} will put the first page of the next document on the
 115  * back side of a sheet if an odd number of pages have been produced so far for
 116  * the job, while {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} always forces the







 117  * next document or document copy on to a new sheet.
 118  * <p>
 119  * In addition, if a {@link Finishings Finishings} attribute of
 120  * {@link Finishings#STAPLE STAPLE} is specified, then:
 121  * <ul>
 122  *   <li>With {@code SINGLE_DOCUMENT}, documents {@code a} and {@code b} are

 123  *   stapled together as a single document with no regard to new sheets.
 124  *   <li>With {@code SINGLE_DOCUMENT_NEW_SHEET}, documents {@code a} and
 125  *   {@code b} are stapled together as a single document, but document {@code b}


 126  *   starts on a new sheet.
 127  *   <li>With {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} and
 128  *   {@code SEPARATE_DOCUMENTS_COLLATED_COPIES}, documents {@code a} and


 129  *   {@code b} are stapled separately.
 130  * </ul>
 131  * <i>Note:</i> None of these values provide means to produce uncollated sheets
 132  * within a document, i.e., where multiple copies of sheet <i>n</i> are produced
 133  * before sheet <i>n</i>+1 of the same document. To specify that, see the
 134  * {@link SheetCollate SheetCollate} attribute.
 135  * <p>
 136  * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
 137  * the IPP attribute name. The enumeration's integer value is the IPP enum
 138  * value. The {@code toString()} method returns the IPP string representation of
 139  * the attribute value.

 140  *
 141  * @author David Mendenhall
 142  * @author Alan Kaminsky
 143  * @see Copies
 144  * @see Finishings
 145  * @see NumberUp
 146  * @see PageRanges
 147  * @see SheetCollate
 148  * @see Sides



 149  */
 150 public class MultipleDocumentHandling extends EnumSyntax
 151     implements PrintRequestAttribute, PrintJobAttribute {
 152 
 153     /**
 154      * Use serialVersionUID from JDK 1.4 for interoperability.
 155      */
 156     private static final long serialVersionUID = 8098326460746413466L;
 157 

 158     /**
 159      * Single document -- see above for <a href="#sdfi">further information</a>.

 160      */
 161     public static final MultipleDocumentHandling
 162         SINGLE_DOCUMENT = new MultipleDocumentHandling (0);
 163 
 164     /**
 165      * Separate documents uncollated copies -- see above for
 166      * <a href="#sducfi">further information</a>.
 167      */
 168     public static final MultipleDocumentHandling
 169        SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling (1);
 170 
 171     /**
 172      * Separate documents collated copies -- see above for
 173      * <a href="#sdccfi">further information</a>.
 174      */
 175     public static final MultipleDocumentHandling
 176         SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling (2);
 177 
 178     /**
 179      * Single document new sheet -- see above for <a href="#sdnsfi">further
 180      * information</a>.
 181      */
 182     public static final MultipleDocumentHandling
 183         SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling (3);
 184 
 185 
 186     /**
 187      * Construct a new multiple document handling enumeration value with the
 188      * given integer value.
 189      *
 190      * @param  value Integer value
 191      */
 192     protected MultipleDocumentHandling(int value) {
 193         super (value);
 194     }
 195 
 196     /**
 197      * The string table for class {@code MultipleDocumentHandling}.
 198      */
 199     private static final String[] myStringTable = {
 200         "single-document",
 201         "separate-documents-uncollated-copies",
 202         "separate-documents-collated-copies",
 203         "single-document-new-sheet"
 204     };
 205 
 206     /**
 207      * The enumeration value table for class {@code MultipleDocumentHandling}.
 208      */
 209     private static final MultipleDocumentHandling[] myEnumValueTable = {
 210         SINGLE_DOCUMENT,
 211         SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
 212         SEPARATE_DOCUMENTS_COLLATED_COPIES,
 213         SINGLE_DOCUMENT_NEW_SHEET
 214     };
 215 
 216     /**
 217      * Returns the string table for class {@code MultipleDocumentHandling}.
 218      */
 219     protected String[] getStringTable() {
 220         return myStringTable.clone();
 221     }
 222 
 223     /**
 224      * Returns the enumeration value table for class
 225      * {@code MultipleDocumentHandling}.
 226      */
 227     protected EnumSyntax[] getEnumValueTable() {
 228         return (EnumSyntax[])myEnumValueTable.clone();
 229     }
 230 
 231     /**
 232      * Get the printing attribute class which is to be used as the "category"
 233      * for this printing attribute value.
 234      * <p>
 235      * For class {@code MultipleDocumentHandling} and any vendor-defined
 236      * subclasses, the category is class {@code MultipleDocumentHandling}
 237      * itself.
 238      *
 239      * @return printing attribute class (category), an instance of class
 240      *         {@link Class java.lang.Class}
 241      */
 242     public final Class<? extends Attribute> getCategory() {
 243         return MultipleDocumentHandling.class;
 244     }
 245 
 246     /**
 247      * Get the name of the category of which this attribute value is an
 248      * instance.
 249      * <p>
 250      * For class {@code MultipleDocumentHandling} and any vendor-defined
 251      * subclasses, the category name is {@code "multiple-document-handling"}.
 252      *
 253      * @return attribute category name
 254      */
 255     public final String getName() {
 256         return "multiple-document-handling";
 257     }

 258 }
< prev index next >