jdk/src/java.desktop/share/classes/javax/print/attribute/standard/SheetCollate.java
changeset 47196 a3211bb4daff
parent 35667 ed476aba94de
equal deleted inserted replaced
47195:b309b58eb190 47196:a3211bb4daff
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    20  *
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    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
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
       
    25 
    25 package javax.print.attribute.standard;
    26 package javax.print.attribute.standard;
    26 
    27 
    27 import javax.print.attribute.Attribute;
    28 import javax.print.attribute.Attribute;
       
    29 import javax.print.attribute.DocAttribute;
    28 import javax.print.attribute.EnumSyntax;
    30 import javax.print.attribute.EnumSyntax;
    29 import javax.print.attribute.DocAttribute;
    31 import javax.print.attribute.PrintJobAttribute;
    30 import javax.print.attribute.PrintRequestAttribute;
    32 import javax.print.attribute.PrintRequestAttribute;
    31 import javax.print.attribute.PrintJobAttribute;
       
    32 
    33 
    33 /**
    34 /**
    34  * Class SheetCollate is a printing attribute class, an enumeration, that
    35  * Class {@code SheetCollate} is a printing attribute class, an enumeration,
    35  * specifies whether or not the media sheets of each copy of each printed
    36  * that specifies whether or not the media sheets of each copy of each printed
    36  * document in a job are to be in sequence, when multiple copies of the document
    37  * document in a job are to be in sequence, when multiple copies of the document
    37  * are specified by the {@link Copies Copies} attribute. When SheetCollate is
    38  * are specified by the {@link Copies Copies} attribute. When
    38  * COLLATED, each copy of each document is printed with the print-stream sheets
    39  * {@code SheetCollate} is {@code COLLATED}, each copy of each document is
    39  * in sequence. When SheetCollate is UNCOLLATED, each print-stream sheet is
    40  * printed with the print-stream sheets in sequence. When {@code SheetCollate}
    40  * printed a number of times equal to the value of the {@link Copies Copies}
    41  * is {@code UNCOLLATED}, each print-stream sheet is printed a number of times
    41  * attribute in succession. For example, suppose a document produces two media
    42  * equal to the value of the {@link Copies Copies} attribute in succession. For
    42  * sheets as output, {@link Copies Copies} is 6, and SheetCollate is UNCOLLATED;
    43  * example, suppose a document produces two media sheets as output,
    43  * in this case six copies of the first media sheet are printed followed by
    44  * {@link Copies Copies} is 6, and {@code SheetCollate} is UNCOLLATED; in this
    44  * six copies of the second media sheet.
    45  * case six copies of the first media sheet are printed followed by six copies
    45  * <P>
    46  * of the second media sheet.
       
    47  * <p>
    46  * Whether the effect of sheet collation is achieved by placing copies of a
    48  * Whether the effect of sheet collation is achieved by placing copies of a
    47  * document in multiple output bins or in the same output bin with
    49  * document in multiple output bins or in the same output bin with
    48  * implementation defined document separation is implementation dependent.
    50  * implementation defined document separation is implementation dependent. Also
    49  * Also whether it is achieved by making multiple passes over the job or by
    51  * whether it is achieved by making multiple passes over the job or by using an
    50  * using an output sorter is implementation dependent.
    52  * output sorter is implementation dependent.
    51  * <P>
    53  * <p>
    52  * If a printer does not support the SheetCollate attribute (meaning the client
    54  * If a printer does not support the {@code SheetCollate} attribute (meaning the
    53  * cannot specify any particular sheet collation), the printer must behave as
    55  * client cannot specify any particular sheet collation), the printer must
    54  * though SheetCollate were always set to COLLATED.
    56  * behave as though {@code SheetCollate} were always set to {@code COLLATED}.
    55  * <P>
    57  * <p>
    56  * The SheetCollate attribute interacts with the {@link MultipleDocumentHandling
    58  * The {@code SheetCollate} attribute interacts with the
    57  * MultipleDocumentHandling} attribute. The {@link MultipleDocumentHandling
    59  * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute. The
    58  * MultipleDocumentHandling} attribute describes the collation of entire
    60  * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute describes
    59  * documents, and the SheetCollate attribute describes the semantics of
    61  * the collation of entire documents, and the {@code SheetCollate} attribute
    60  * collating individual pages within a document.
    62  * describes the semantics of collating individual pages within a document.
    61  * <P>
    63  * <p>
    62  * The effect of a SheetCollate attribute on a multidoc print job (a job with
    64  * The effect of a {@code SheetCollate} attribute on a multidoc print job (a job
    63  * multiple documents) depends on whether all the docs have the same sheet
    65  * with multiple documents) depends on whether all the docs have the same sheet
    64  * collation specified or whether different docs have different sheet
    66  * collation specified or whether different docs have different sheet collations
    65  * collations specified, and on the (perhaps defaulted) value of the {@link
    67  * specified, and on the (perhaps defaulted) value of the
    66  * MultipleDocumentHandling MultipleDocumentHandling} attribute.
    68  * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute.
    67  * <UL>
    69  * <ul>
    68  * <LI>
    70  *   <li>If all the docs have the same sheet collation specified, then the
    69  * If all the docs have the same sheet collation specified, then the following
    71  *   following combinations of {@code SheetCollate} and
    70  * combinations of SheetCollate and {@link MultipleDocumentHandling
    72  *   {@link MultipleDocumentHandling MultipleDocumentHandling} are permitted,
    71  * MultipleDocumentHandling} are permitted, and the printer reports an error
    73  *   and the printer reports an error when the job is submitted if any other
    72  * when the job is submitted if any other combination is specified:
    74  *   combination is specified:
    73  * <UL>
    75  *   <ul>
    74  * <LI>
    76  *     <li>SheetCollate = COLLATED, {@link MultipleDocumentHandling
    75  * SheetCollate = COLLATED, {@link MultipleDocumentHandling
    77  *     MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
    76  * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
    78  *     combined into one output document. Multiple copies of the output document
    77  * combined into one output document. Multiple copies of the output document
    79  *     will be produced with pages in collated order, i.e. pages 1, 2, 3, . . .,
    78  * will be produced with pages in collated order, i.e. pages 1, 2, 3, . . .,
    80  *     1, 2, 3, . . .
    79  * 1, 2, 3, . . .
    81  *     <li>SheetCollate = COLLATED, {@link MultipleDocumentHandling
    80  *
    82  *     MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input
    81  * <LI>
    83  *     docs will be combined into one output document, and the first impression
    82  * SheetCollate = COLLATED, {@link MultipleDocumentHandling
    84  *     of each input doc will always start on a new media sheet. Multiple copies
    83  * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs
    85  *     of the output document will be produced with pages in collated order,
    84  * will be combined into one output document, and the first impression of each
    86  *     i.e. pages 1, 2, 3, . . ., 1, 2, 3, . . .
    85  * input doc will always start on a new media sheet. Multiple copies of the
    87  *     <li>SheetCollate = COLLATED, {@link MultipleDocumentHandling
    86  * output document will be produced with pages in collated order, i.e. pages
    88  *     MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
    87  * 1, 2, 3, . . ., 1, 2, 3, . . .
    89  *     input doc will remain a separate output document. Multiple copies of each
    88  *
    90  *     output document (call them A, B, . . .) will be produced with each
    89  * <LI>
    91  *     document's pages in collated order, but the documents themselves in
    90  * SheetCollate = COLLATED, {@link MultipleDocumentHandling
    92  *     uncollated order, i.e. pages A1, A2, A3, . . ., A1, A2, A3, . . ., B1,
    91  * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
    93  *     B2, B3, . . ., B1, B2, B3, . . .
    92  * input doc will remain a separate output document. Multiple copies of each
    94  *     <li>SheetCollate = COLLATED, {@link MultipleDocumentHandling
    93  * output document (call them A, B, . . .) will be produced with each document's
    95  *     MultipleDocumentHandling} = SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each
    94  * pages in collated order, but the documents themselves in uncollated order,
    96  *     input doc will remain a separate output document. Multiple copies of each
    95  * i.e. pages A1, A2, A3, . . ., A1, A2, A3, . . ., B1, B2, B3, . . ., B1, B2,
    97  *     output document (call them A, B, . . .) will be produced with each
    96  * B3, . . .
    98  *     document's pages in collated order, with the documents themselves also in
    97  *
    99  *     collated order, i.e. pages A1, A2, A3, . . ., B1, B2, B3, . . ., A1, A2,
    98  * <LI>
   100  *     A3, . . ., B1, B2, B3, . . .
    99  * SheetCollate = COLLATED, {@link MultipleDocumentHandling
   101  *     <li>SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
   100  * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input
   102  *     MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
   101  * doc will remain a separate output document. Multiple copies of each output
   103  *     combined into one output document. Multiple copies of the output document
   102  * document (call them A, B, . . .) will be produced with each document's pages
   104  *     will be produced with pages in uncollated order, i.e. pages 1, 1, . . .,
   103  * in collated order, with the documents themselves also in collated order, i.e.
   105  *     2, 2, . . ., 3, 3, . . .
   104  * pages A1, A2, A3, . . ., B1, B2, B3, . . ., A1, A2, A3, . . ., B1, B2, B3,
   106  *     <li>SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
   105  * . . .
   107  *     MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input
   106  *
   108  *     docs will be combined into one output document, and the first impression
   107  * <LI>
   109  *     of each input doc will always start on a new media sheet. Multiple copies
   108  * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
   110  *     of the output document will be produced with pages in uncollated order,
   109  * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
   111  *     i.e. pages 1, 1, . . ., 2, 2, . . ., 3, 3, . . .
   110  * combined into one output document. Multiple copies of the output document
   112  *     <li>SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
   111  * will be produced with pages in uncollated order, i.e. pages 1, 1, . . .,
   113  *     MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
   112  * 2, 2, . . ., 3, 3, . . .
   114  *     input doc will remain a separate output document. Multiple copies of each
   113  *
   115  *     output document (call them A, B, . . .) will be produced with each
   114  * <LI>
   116  *     document's pages in uncollated order, with the documents themselves also
   115  * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
   117  *     in uncollated order, i.e. pages A1, A1, . . ., A2, A2, . . ., A3, A3, . .
   116  * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs
   118  *     ., B1, B1, . . ., B2, B2, . . ., B3, B3, . . .
   117  * will be combined into one output document, and the first impression of each
   119  *   </ul>
   118  * input doc will always start on a new media sheet. Multiple copies of the
   120  *   <li>If different docs have different sheet collations specified, then only
   119  * output document will be produced with pages in uncollated order, i.e. pages
   121  *   one value of {@link MultipleDocumentHandling MultipleDocumentHandling} is
   120  * 1, 1, . . ., 2, 2, . . ., 3, 3, . . .
   122  *   permitted, and the printer reports an error when the job is submitted if
   121  *
   123  *   any other value is specified:
   122  * <LI>
   124  *   <ul>
   123  * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
   125  *     <li>{@link MultipleDocumentHandling MultipleDocumentHandling} =
   124  * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
   126  *     SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will remain a
   125  * input doc will remain a separate output document. Multiple copies of each
   127  *     separate output document. Multiple copies of each output document (call
   126  * output document (call them A, B, . . .) will be produced with each document's
   128  *     them A, B, . . .) will be produced with each document's pages in collated
   127  * pages in uncollated order, with the documents themselves also in uncollated
   129  *     or uncollated order as the corresponding input doc's SheetCollate
   128  * order, i.e. pages A1, A1, . . ., A2, A2, . . ., A3, A3, . . ., B1, B1, . . .,
   130  *     attribute specifies, and with the documents themselves in uncollated
   129  * B2, B2, . . ., B3, B3, . . .
   131  *     order. If document A had SheetCollate = UNCOLLATED and document B had
   130  * </UL>
   132  *     SheetCollate = COLLATED, the following pages would be produced: A1, A1, .
   131  *
   133  *     . ., A2, A2, . . ., A3, A3, . . ., B1, B2, B3, . . ., B1, B2, B3, . . .
   132  * <LI>
   134  *   </ul>
   133  * If different docs have different sheet collations specified, then only one
   135  * </ul>
   134  * value of {@link MultipleDocumentHandling MultipleDocumentHandling} is
   136  * <p>
   135  * permitted, and the printer reports an error when the job is submitted if any
   137  * <b>IPP Compatibility:</b> SheetCollate is not an IPP attribute at present.
   136  * other value is specified:
   138  *
   137  * <UL>
   139  * @author Alan Kaminsky
   138  * <LI>
   140  * @see MultipleDocumentHandling
   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  *
       
   153  * @see  MultipleDocumentHandling
       
   154  *
       
   155  * @author  Alan Kaminsky
       
   156  */
   141  */
   157 public final class SheetCollate extends EnumSyntax
   142 public final class SheetCollate extends EnumSyntax
   158     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
   143     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
   159 
   144 
       
   145     /**
       
   146      * Use serialVersionUID from JDK 1.4 for interoperability.
       
   147      */
   160     private static final long serialVersionUID = 7080587914259873003L;
   148     private static final long serialVersionUID = 7080587914259873003L;
   161 
   149 
   162     /**
   150     /**
   163      * Sheets within a document appear in uncollated order when multiple
   151      * Sheets within a document appear in uncollated order when multiple copies
   164      * copies are printed.
   152      * are printed.
   165      */
   153      */
   166     public static final SheetCollate UNCOLLATED = new SheetCollate(0);
   154     public static final SheetCollate UNCOLLATED = new SheetCollate(0);
   167 
   155 
   168     /**
   156     /**
   169      * Sheets within a document appear in collated order when multiple copies
   157      * Sheets within a document appear in collated order when multiple copies
   173 
   161 
   174     /**
   162     /**
   175      * Construct a new sheet collate enumeration value with the given integer
   163      * Construct a new sheet collate enumeration value with the given integer
   176      * value.
   164      * value.
   177      *
   165      *
   178      * @param  value  Integer value.
   166      * @param  value Integer value
   179      */
   167      */
   180     protected SheetCollate(int value) {
   168     protected SheetCollate(int value) {
   181         super (value);
   169         super (value);
   182     }
   170     }
   183 
   171 
       
   172     /**
       
   173      * The string table for class {@code SheetCollate}.
       
   174      */
   184     private static final String[] myStringTable = {
   175     private static final String[] myStringTable = {
   185         "uncollated",
   176         "uncollated",
   186         "collated"
   177         "collated"
   187     };
   178     };
   188 
   179 
       
   180     /**
       
   181      * The enumeration value table for class {@code SheetCollate}.
       
   182      */
   189     private static final SheetCollate[] myEnumValueTable = {
   183     private static final SheetCollate[] myEnumValueTable = {
   190         UNCOLLATED,
   184         UNCOLLATED,
   191         COLLATED
   185         COLLATED
   192     };
   186     };
   193 
   187 
   194     /**
   188     /**
   195      * Returns the string table for class SheetCollate.
   189      * Returns the string table for class {@code SheetCollate}.
   196      */
   190      */
   197     protected String[] getStringTable() {
   191     protected String[] getStringTable() {
   198         return myStringTable;
   192         return myStringTable;
   199     }
   193     }
   200 
   194 
   201     /**
   195     /**
   202      * Returns the enumeration value table for class SheetCollate.
   196      * Returns the enumeration value table for class {@code SheetCollate}.
   203      */
   197      */
   204     protected EnumSyntax[] getEnumValueTable() {
   198     protected EnumSyntax[] getEnumValueTable() {
   205         return myEnumValueTable;
   199         return myEnumValueTable;
   206     }
   200     }
   207 
   201 
   208     /**
   202     /**
   209      * Get the printing attribute class which is to be used as the "category"
   203      * Get the printing attribute class which is to be used as the "category"
   210      * for this printing attribute value.
   204      * for this printing attribute value.
   211      * <P>
   205      * <p>
   212      * For class SheetCollate, the category is class SheetCollate itself.
   206      * For class {@code SheetCollate}, the category is class
       
   207      * {@code SheetCollate} itself.
   213      *
   208      *
   214      * @return  Printing attribute class (category), an instance of class
   209      * @return printing attribute class (category), an instance of class
   215      *          {@link java.lang.Class java.lang.Class}.
   210      *         {@link Class java.lang.Class}
   216      */
   211      */
   217     public final Class<? extends Attribute> getCategory() {
   212     public final Class<? extends Attribute> getCategory() {
   218         return SheetCollate.class;
   213         return SheetCollate.class;
   219     }
   214     }
   220 
   215 
   221     /**
   216     /**
   222      * Get the name of the category of which this attribute value is an
   217      * Get the name of the category of which this attribute value is an
   223      * instance.
   218      * instance.
   224      * <P>
   219      * <p>
   225      * For class SheetCollate, the category name is {@code "sheet-collate"}.
   220      * For class {@code SheetCollate}, the category name is
       
   221      * {@code "sheet-collate"}.
   226      *
   222      *
   227      * @return  Attribute category name.
   223      * @return attribute category name
   228      */
   224      */
   229     public final String getName() {
   225     public final String getName() {
   230         return "sheet-collate";
   226         return "sheet-collate";
   231     }
   227     }
   232 
       
   233 }
   228 }