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