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