1. /*
  2. * @(#)MultipleDocumentHandling.java 1.6 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.PrintRequestAttribute;
  10. import javax.print.attribute.PrintJobAttribute;
  11. /**
  12. * Class MultipleDocumentHandling is a printing attribute class, an enumeration,
  13. * that controls finishing operations and the placement of one or more
  14. * print-stream pages into impressions and onto media sheets. When the value of
  15. * the {@link Copies Copies} attribute exceeds 1, MultipleDocumentHandling also
  16. * controls the order in which the copies that result from processing the
  17. * documents are produced. This attribute is relevant only for a multidoc print
  18. * job consisting of two or more individual docs.
  19. * <P>
  20. * Briefly, MultipleDocumentHandling determines the relationship between the
  21. * multiple input (electronic) documents fed into a multidoc print job and the
  22. * output (physical) document or documents produced by the multidoc print job.
  23. * There are two possibilities:
  24. * <UL>
  25. * <LI>
  26. * The multiple input documents are combined into a single output document.
  27. * Finishing operations ({@link Finishings Finishings}),
  28. * are performed on this single output
  29. * document. The {@link Copies Copies} attribute tells how many copies of this
  30. * single output document to produce. The MultipleDocumentHandling values
  31. * SINGLE_DOCUMENT and SINGLE_DOCUMENT_NEW_SHEET specify two variations of
  32. * this possibility.
  33. * <P>
  34. * <LI>
  35. * The multiple input documents remain separate output documents. Finishing
  36. * operations ({@link Finishings Finishings}),
  37. * are performed on each output document
  38. * separately. The {@link Copies Copies} attribute tells how many copies of each
  39. * separate output document to produce. The MultipleDocumentHandling values
  40. * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and SEPARATE_DOCUMENTS_COLLATED_COPIES
  41. * specify two variations of this possibility.
  42. * </UL>
  43. * <P>
  44. * In the detailed explanations below, if "<CODE>a</CODE>" represents an
  45. * instance of document data, then the result of processing the data in
  46. * document "<CODE>a</CODE>" is a sequence of media sheets represented by
  47. * "<CODE>a(*)</CODE>".
  48. * <P>
  49. * The standard MultipleDocumentHandling values are:
  50. * <UL>
  51. * <LI>
  52. * <A NAME="sdfi">{@link #SINGLE_DOCUMENT
  53. * <B><CODE>SINGLE_DOCUMENT</CODE></B>}</A>. If a print job has multiple
  54. * documents -- say, the document data is called <CODE>a</CODE> and
  55. * <CODE>b</CODE> -- then the result of processing all the document data
  56. * (<CODE>a</CODE> and then <CODE>b</CODE>) must be treated as a single sequence
  57. * of media sheets for finishing operations; that is, finishing would be
  58. * performed on the concatenation of the sequences <CODE>a(*),b(*)</CODE>. The
  59. * printer must not force the data in each document instance to be formatted
  60. * onto a new print-stream page, nor to start a new impression on a new media
  61. * sheet. If more than one copy is made, the ordering of the sets of media
  62. * sheets resulting from processing the document data must be
  63. * <CODE>a(*),b(*),a(*),b(*),...</CODE>, and the printer object must force
  64. * each copy (<CODE>a(*),b(*)</CODE>) to start on a new media sheet.
  65. * <P>
  66. * <LI>
  67. * <A NAME="sducfi">{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
  68. * <B><CODE>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</CODE></B>}</A>. If a print job
  69. * has multiple documents -- say, the document data is called <CODE>a</CODE> and
  70. * <CODE>b</CODE> -- then the result of processing the data in each document
  71. * instance must be treated as a single sequence of media sheets for finishing
  72. * operations; that is, the sets <CODE>a(*)</CODE> and <CODE>b(*)</CODE> would
  73. * each be finished separately. The printer must force each copy of the result
  74. * of processing the data in a single document to start on a new media sheet.
  75. * If more than one copy is made, the ordering of the sets of media sheets
  76. * resulting from processing the document data must be
  77. * <CODE>a(*),a(*),...,b(*),b(*)...</CODE>.
  78. * <P>
  79. * <LI>
  80. * <A NAME="sdccfi">{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
  81. * <B><CODE>SEPARATE_DOCUMENTS_COLLATED_COPIES</CODE></B>}</A>. If a print job
  82. * has multiple documents -- say, the document data is called <CODE>a</CODE> and
  83. * <CODE>b</CODE> -- then the result of processing the data in each document
  84. * instance must be treated as a single sequence of media sheets for finishing
  85. * operations; that is, the sets <CODE>a(*)</CODE> and <CODE>b(*)</CODE> would
  86. * each be finished separately. The printer must force each copy of the result
  87. * of processing the data in a single document to start on a new media sheet.
  88. * If more than one copy is made, the ordering of the sets of media sheets
  89. * resulting from processing the document data must be
  90. * <CODE>a(*),b(*),a(*),b(*),...</CODE>.
  91. * <P>
  92. * <LI>
  93. * <A NAME="sdnsfi">{@link #SINGLE_DOCUMENT_NEW_SHEET
  94. * <B><CODE>SINGLE_DOCUMENT_NEW_SHEET</CODE></B>}</A>. Same as SINGLE_DOCUMENT,
  95. * except that the printer must ensure that the first impression of each
  96. * document instance in the job is placed on a new media sheet. This value
  97. * allows multiple documents to be stapled together with a single staple where
  98. * each document starts on a new sheet.
  99. * </UL>
  100. * <P>
  101. * SINGLE_DOCUMENT is the same as SEPARATE_DOCUMENTS_COLLATED_COPIES with
  102. * respect to ordering of print-stream pages, but not media sheet generation,
  103. * since SINGLE_DOCUMENT will put the first page of the next document on the
  104. * back side of a sheet if an odd number of pages have been produced so far
  105. * for the job, while SEPARATE_DOCUMENTS_COLLATED_COPIES always forces the
  106. * next document or document copy on to a new sheet.
  107. * <P>
  108. * In addition, if a {@link Finishings Finishings} attribute of
  109. * {@link Finishings#STAPLE <CODE>STAPLE</CODE>} is specified, then:
  110. * <UL>
  111. * <LI>
  112. * With SINGLE_DOCUMENT, documents <CODE>a</CODE> and <CODE>b</CODE> are
  113. * stapled together as a single document with no regard to new sheets.
  114. * <P>
  115. * <LI>
  116. * With SINGLE_DOCUMENT_NEW_SHEET, documents <CODE>a</CODE> and <CODE>b</CODE>
  117. * are stapled together as a single document, but document <CODE>b</CODE>
  118. * starts on a new sheet.
  119. * <P>
  120. * <LI>
  121. * With SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and
  122. * SEPARATE_DOCUMENTS_COLLATED_COPIES, documents <CODE>a</CODE> and
  123. * <CODE>b</CODE> are stapled separately.
  124. * </UL>
  125. * <P>
  126. * <I>Note:</I> None of these values provide means to produce uncollated
  127. * sheets within a document, i.e., where multiple copies of sheet <I>n</I>
  128. * are produced before sheet <I>n</I>+1 of the same document.
  129. * To specify that, see the {@link SheetCollate SheetCollate} attribute.
  130. * <P>
  131. * <B>IPP Compatibility:</B> The category name returned by
  132. * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
  133. * integer value is the IPP enum value. The <code>toString()</code> method
  134. * returns the IPP string representation of the attribute value.
  135. * <P>
  136. *
  137. * @see Copies
  138. * @see Finishings
  139. * @see NumberUp
  140. * @see PageRanges
  141. * @see SheetCollate
  142. * @see Sides
  143. *
  144. * @author David Mendenhall
  145. * @author Alan Kaminsky
  146. */
  147. public class MultipleDocumentHandling extends EnumSyntax
  148. implements PrintRequestAttribute, PrintJobAttribute {
  149. /**
  150. * Single document -- see above for <A HREF="#sdfi">further
  151. * information</A>.
  152. */
  153. public static final MultipleDocumentHandling
  154. SINGLE_DOCUMENT = new MultipleDocumentHandling (0);
  155. /**
  156. * Separate documents uncollated copies -- see above for
  157. * <A HREF="#sducfi">further information</A>.
  158. */
  159. public static final MultipleDocumentHandling
  160. SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling (1);
  161. /**
  162. * Separate documents collated copies -- see above for
  163. * <A HREF="#sdccfi">further information</A>.
  164. */
  165. public static final MultipleDocumentHandling
  166. SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling (2);
  167. /**
  168. * Single document new sheet -- see above for
  169. * <A HREF="#sdnsfi">further information</A>.
  170. */
  171. public static final MultipleDocumentHandling
  172. SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling (3);
  173. /**
  174. * Construct a new multiple document handling enumeration value with the
  175. * given integer value.
  176. *
  177. * @param value Integer value.
  178. */
  179. protected MultipleDocumentHandling(int value) {
  180. super (value);
  181. }
  182. private static final String[] myStringTable = {
  183. "single-document",
  184. "separate-documents-uncollated-copies",
  185. "separate-documents-collated-copies",
  186. "single-document-new-sheet"
  187. };
  188. private static final MultipleDocumentHandling[] myEnumValueTable = {
  189. SINGLE_DOCUMENT,
  190. SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
  191. SEPARATE_DOCUMENTS_COLLATED_COPIES,
  192. SINGLE_DOCUMENT_NEW_SHEET
  193. };
  194. /**
  195. * Returns the string table for class MultipleDocumentHandling.
  196. */
  197. protected String[] getStringTable() {
  198. return (String[])myStringTable.clone();
  199. }
  200. /**
  201. * Returns the enumeration value table for class MultipleDocumentHandling.
  202. */
  203. protected EnumSyntax[] getEnumValueTable() {
  204. return (EnumSyntax[])myEnumValueTable.clone();
  205. }
  206. /**
  207. * Get the printing attribute class which is to be used as the "category"
  208. * for this printing attribute value.
  209. * <P>
  210. * For class MultipleDocumentHandling and any vendor-defined subclasses,
  211. * the category is class MultipleDocumentHandling itself.
  212. *
  213. * @return Printing attribute class (category), an instance of class
  214. * {@link java.lang.Class java.lang.Class}.
  215. */
  216. public final Class getCategory() {
  217. return MultipleDocumentHandling.class;
  218. }
  219. /**
  220. * Get the name of the category of which this attribute value is an
  221. * instance.
  222. * <P>
  223. * For class MultipleDocumentHandling and any vendor-defined subclasses,
  224. * the category name is <CODE>"multiple-document-handling"</CODE>.
  225. *
  226. * @return Attribute category name.
  227. */
  228. public final String getName() {
  229. return "multiple-document-handling";
  230. }
  231. }