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