1. /*
  2. * @(#)Finishings.java 1.7 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 Finishings is a printing attribute class, an enumeration, that
  14. * identifies whether the printer applies a finishing operation of some kind
  15. * of binding to each copy of each printed document in the job. For multidoc
  16. * print jobs (jobs with multiple documents), the
  17. * {@link MultipleDocumentHandling
  18. * MultipleDocumentHandling} attribute determines what constitutes a "copy"
  19. * for purposes of finishing.
  20. * <P>
  21. * Standard Finishings values are:
  22. * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
  23. * <TR>
  24. * <TD WIDTH=10%>
  25. *  
  26. * </TD>
  27. * <TD WIDTH=27%>
  28. * {@link #NONE <CODE>NONE</CODE>}
  29. * </TD>
  30. * <TD WIDTH=27%>
  31. * {@link #STAPLE <CODE>STAPLE</CODE>}
  32. * </TD>
  33. * <TD WIDTH=36%>
  34. * {@link #EDGE_STITCH <CODE>EDGE_STITCH</CODE>}
  35. * </TD>
  36. * </TR>
  37. * <TR>
  38. * <TD>
  39. *  
  40. * </TD>
  41. * <TD>
  42. * {@link #BIND <CODE>BIND</CODE>}
  43. * </TD>
  44. * <TD>
  45. * {@link #SADDLE_STITCH <CODE>SADDLE_STITCH</CODE>}
  46. * </TD>
  47. * <TD>
  48. * {@link #COVER <CODE>COVER</CODE>}
  49. * </TD>
  50. * <TD>
  51. *  
  52. * </TD>
  53. * </TR>
  54. * </TABLE>
  55. * <P>
  56. * The following Finishings values are more specific; they indicate a
  57. * corner or an edge as if the document were a portrait document:
  58. * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">
  59. * <TR>
  60. * <TD WIDTH=10%>
  61. *  
  62. * </TD>
  63. * <TD WIDTH=27%>
  64. * {@link #STAPLE_TOP_LEFT <CODE>STAPLE_TOP_LEFT</CODE>}
  65. * </TD>
  66. * <TD WIDTH=27%>
  67. * {@link #EDGE_STITCH_LEFT <CODE>EDGE_STITCH_LEFT</CODE>}
  68. * </TD>
  69. * <TD WIDTH=27%>
  70. * {@link #STAPLE_DUAL_LEFT <CODE>STAPLE_DUAL_LEFT</CODE>}
  71. * </TD>
  72. * <TD WIDTH=9%>
  73. *  
  74. * </TD>
  75. * </TR>
  76. * <TR>
  77. * <TD WIDTH=10%>
  78. *  
  79. * </TD>
  80. * <TD WIDTH=27%>
  81. * {@link #STAPLE_BOTTOM_LEFT <CODE>STAPLE_BOTTOM_LEFT</CODE>}
  82. * </TD>
  83. * <TD WIDTH=27%>
  84. * {@link #EDGE_STITCH_TOP <CODE>EDGE_STITCH_TOP</CODE>}
  85. * </TD>
  86. * <TD WIDTH=27%>
  87. * {@link #STAPLE_DUAL_TOP <CODE>STAPLE_DUAL_TOP</CODE>}
  88. * </TD>
  89. * <TD WIDTH=9%>
  90. *  
  91. * </TD>
  92. * </TR>
  93. * <TR>
  94. * <TD WIDTH=10%>
  95. *  
  96. * </TD>
  97. * <TD WIDTH=27%>
  98. * {@link #STAPLE_TOP_RIGHT <CODE>STAPLE_TOP_RIGHT</CODE>}
  99. * </TD>
  100. * <TD WIDTH=27%>
  101. * {@link #EDGE_STITCH_RIGHT <CODE>EDGE_STITCH_RIGHT</CODE>}
  102. * </TD>
  103. * <TD WIDTH=27%>
  104. * {@link #STAPLE_DUAL_RIGHT <CODE>STAPLE_DUAL_RIGHT</CODE>}
  105. * </TD>
  106. * <TD WIDTH=9%>
  107. *  
  108. * </TD>
  109. * </TR>
  110. * <TR>
  111. * <TD WIDTH=10%>
  112. *  
  113. * </TD>
  114. * <TD WIDTH=27%>
  115. * {@link #STAPLE_BOTTOM_RIGHT <CODE>STAPLE_BOTTOM_RIGHT</CODE>}
  116. * </TD>
  117. * <TD WIDTH=27%>
  118. * {@link #EDGE_STITCH_BOTTOM <CODE>EDGE_STITCH_BOTTOM</CODE>}
  119. * </TD>
  120. * <TD WIDTH=27%>
  121. * {@link #STAPLE_DUAL_BOTTOM <CODE>STAPLE_DUAL_BOTTOM</CODE>}
  122. * </TD>
  123. * <TD WIDTH=9%>
  124. *  
  125. * </TD>
  126. * </TR>
  127. * </TABLE>
  128. * <P>
  129. * The <CODE>STAPLE_<I>XXX</I></CODE> values are specified with respect to the
  130. * document as if the document were a portrait document. If the document is
  131. * actually a landscape or a reverse-landscape document, the client supplies the
  132. * appropriate transformed value. For example, to position a staple in the upper
  133. * left hand corner of a landscape document when held for reading, the client
  134. * supplies the <CODE>STAPLE_BOTTOM_LEFT</CODE> value (since landscape is
  135. * defined as a +90 degree rotation from portrait, i.e., anti-clockwise). On the
  136. * other hand, to position a staple in the upper left hand corner of a
  137. * reverse-landscape document when held for reading, the client supplies the
  138. * <CODE>STAPLE_TOP_RIGHT</CODE> value (since reverse-landscape is defined as a
  139. * -90 degree rotation from portrait, i.e., clockwise).
  140. * <P>
  141. * The angle (vertical, horizontal, angled) of each staple with respect to the
  142. * document depends on the implementation which may in turn depend on the value
  143. * of the attribute.
  144. * <P>
  145. * The effect of a Finishings attribute on a multidoc print job (a job
  146. * with multiple documents) depends on whether all the docs have the same
  147. * binding specified or whether different docs have different bindings
  148. * specified, and on the (perhaps defaulted) value of the {@link
  149. * MultipleDocumentHandling MultipleDocumentHandling} attribute.
  150. * <UL>
  151. * <LI>
  152. * If all the docs have the same binding specified, then any value of {@link
  153. * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the
  154. * printer's processing depends on the {@link MultipleDocumentHandling
  155. * MultipleDocumentHandling} value:
  156. * <UL>
  157. * <LI>
  158. * SINGLE_DOCUMENT -- All the input docs will be bound together as one output
  159. * document with the specified binding.
  160. * <P>
  161. * <LI>
  162. * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be bound together as one
  163. * output document with the specified binding, and the first impression of each
  164. * input doc will always start on a new media sheet.
  165. * <P>
  166. * <LI>
  167. * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound
  168. * separately with the specified binding.
  169. * <P>
  170. * <LI>
  171. * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately
  172. * with the specified binding.
  173. * </UL>
  174. * <P>
  175. * <LI>
  176. * If different docs have different bindings specified, then only two values of
  177. * {@link MultipleDocumentHandling MultipleDocumentHandling} make sense, and the
  178. * printer reports an error when the job is submitted if any other value is
  179. * specified:
  180. * <UL>
  181. * <LI>
  182. * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound
  183. * separately with its own specified binding.
  184. * <P>
  185. * <LI>
  186. * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately
  187. * with its own specified binding.
  188. * </UL>
  189. * </UL>
  190. * <P>
  191. * <B>IPP Compatibility:</B> Class Finishings encapsulates some of the
  192. * IPP enum values that can be included in an IPP "finishings" attribute, which
  193. * is a set of enums. The category name returned by
  194. * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
  195. * integer value is the IPP enum value. The <code>toString()</code> method
  196. * returns the IPP string representation of the attribute value.
  197. * In IPP Finishings is a multi-value attribute, this API currently allows
  198. * only one binding to be specified.
  199. *
  200. * @author Alan Kaminsky
  201. */
  202. public class Finishings extends EnumSyntax
  203. implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
  204. /**
  205. * Perform no binding.
  206. */
  207. public static final Finishings NONE = new Finishings(3);
  208. /**
  209. * Bind the document(s) with one or more staples. The exact number and
  210. * placement of the staples is site-defined.
  211. */
  212. public static final Finishings STAPLE = new Finishings(4);
  213. /**
  214. * This value is specified when it is desired to select a non-printed (or
  215. * pre-printed) cover for the document. This does not supplant the
  216. * specification of a printed cover (on cover stock medium) by the
  217. * document itself.
  218. */
  219. public static final Finishings COVER = new Finishings(6);
  220. /**
  221. * This value indicates that a binding is to be applied to the document;
  222. * the type and placement of the binding is site-defined.
  223. */
  224. public static final Finishings BIND = new Finishings(7);
  225. /**
  226. * Bind the document(s) with one or more staples (wire stitches) along the
  227. * middle fold. The exact number and placement of the staples and the
  228. * middle fold is implementation- and/or site-defined.
  229. */
  230. public static final Finishings SADDLE_STITCH =
  231. new Finishings(8);
  232. /**
  233. * Bind the document(s) with one or more staples (wire stitches) along one
  234. * edge. The exact number and placement of the staples is implementation-
  235. * and/or site- defined.
  236. */
  237. public static final Finishings EDGE_STITCH =
  238. new Finishings(9);
  239. /**
  240. * Bind the document(s) with one or more staples in the top left corner.
  241. */
  242. public static final Finishings STAPLE_TOP_LEFT =
  243. new Finishings(20);
  244. /**
  245. * Bind the document(s) with one or more staples in the bottom left
  246. * corner.
  247. */
  248. public static final Finishings STAPLE_BOTTOM_LEFT =
  249. new Finishings(21);
  250. /**
  251. * Bind the document(s) with one or more staples in the top right corner.
  252. */
  253. public static final Finishings STAPLE_TOP_RIGHT =
  254. new Finishings(22);
  255. /**
  256. * Bind the document(s) with one or more staples in the bottom right
  257. * corner.
  258. */
  259. public static final Finishings STAPLE_BOTTOM_RIGHT =
  260. new Finishings(23);
  261. /**
  262. * Bind the document(s) with one or more staples (wire stitches) along the
  263. * left edge. The exact number and placement of the staples is
  264. * implementation- and/or site-defined.
  265. */
  266. public static final Finishings EDGE_STITCH_LEFT =
  267. new Finishings(24);
  268. /**
  269. * Bind the document(s) with one or more staples (wire stitches) along the
  270. * top edge. The exact number and placement of the staples is
  271. * implementation- and/or site-defined.
  272. */
  273. public static final Finishings EDGE_STITCH_TOP =
  274. new Finishings(25);
  275. /**
  276. * Bind the document(s) with one or more staples (wire stitches) along the
  277. * right edge. The exact number and placement of the staples is
  278. * implementation- and/or site-defined.
  279. */
  280. public static final Finishings EDGE_STITCH_RIGHT =
  281. new Finishings(26);
  282. /**
  283. * Bind the document(s) with one or more staples (wire stitches) along the
  284. * bottom edge. The exact number and placement of the staples is
  285. * implementation- and/or site-defined.
  286. */
  287. public static final Finishings EDGE_STITCH_BOTTOM =
  288. new Finishings(27);
  289. /**
  290. * Bind the document(s) with two staples (wire stitches) along the left
  291. * edge assuming a portrait document (see above).
  292. */
  293. public static final Finishings STAPLE_DUAL_LEFT =
  294. new Finishings(28);
  295. /**
  296. * Bind the document(s) with two staples (wire stitches) along the top
  297. * edge assuming a portrait document (see above).
  298. */
  299. public static final Finishings STAPLE_DUAL_TOP =
  300. new Finishings(29);
  301. /**
  302. * Bind the document(s) with two staples (wire stitches) along the right
  303. * edge assuming a portrait document (see above).
  304. */
  305. public static final Finishings STAPLE_DUAL_RIGHT =
  306. new Finishings(30);
  307. /**
  308. * Bind the document(s) with two staples (wire stitches) along the bottom
  309. * edge assuming a portrait document (see above).
  310. */
  311. public static final Finishings STAPLE_DUAL_BOTTOM =
  312. new Finishings(31);
  313. /**
  314. * Construct a new finishings binding enumeration value with the given
  315. * integer value.
  316. *
  317. * @param value Integer value.
  318. */
  319. protected Finishings(int value) {
  320. super(value);
  321. }
  322. private static final String[] myStringTable =
  323. {"none",
  324. "staple",
  325. null,
  326. "cover",
  327. "bind",
  328. "saddle-stitch",
  329. "edge-stitch",
  330. null, // The next ten enum values are reserved.
  331. null,
  332. null,
  333. null,
  334. null,
  335. null,
  336. null,
  337. null,
  338. null,
  339. null,
  340. "staple-top-left",
  341. "staple-bottom-left",
  342. "staple-top-right",
  343. "staple-bottom-right",
  344. "edge-stitch-left",
  345. "edge-stitch-top",
  346. "edge-stitch-right",
  347. "edge-stitch-bottom",
  348. "staple-dual-left",
  349. "staple-dual-top",
  350. "staple-dual-right",
  351. "staple-dual-bottom"
  352. };
  353. private static final Finishings[] myEnumValueTable =
  354. {NONE,
  355. STAPLE,
  356. null,
  357. COVER,
  358. BIND,
  359. SADDLE_STITCH,
  360. EDGE_STITCH,
  361. null, // The next ten enum values are reserved.
  362. null,
  363. null,
  364. null,
  365. null,
  366. null,
  367. null,
  368. null,
  369. null,
  370. null,
  371. STAPLE_TOP_LEFT,
  372. STAPLE_BOTTOM_LEFT,
  373. STAPLE_TOP_RIGHT,
  374. STAPLE_BOTTOM_RIGHT,
  375. EDGE_STITCH_LEFT,
  376. EDGE_STITCH_TOP,
  377. EDGE_STITCH_RIGHT,
  378. EDGE_STITCH_BOTTOM,
  379. STAPLE_DUAL_LEFT,
  380. STAPLE_DUAL_TOP,
  381. STAPLE_DUAL_RIGHT,
  382. STAPLE_DUAL_BOTTOM
  383. };
  384. /**
  385. * Returns the string table for class Finishings.
  386. */
  387. protected String[] getStringTable() {
  388. return (String[])myStringTable.clone();
  389. }
  390. /**
  391. * Returns the enumeration value table for class Finishings.
  392. */
  393. protected EnumSyntax[] getEnumValueTable() {
  394. return (EnumSyntax[])myEnumValueTable.clone();
  395. }
  396. /**
  397. * Returns the lowest integer value used by class Finishings.
  398. */
  399. protected int getOffset() {
  400. return 3;
  401. }
  402. /**
  403. * Get the printing attribute class which is to be used as the "category"
  404. * for this printing attribute value.
  405. * <P>
  406. * For class Finishings and any vendor-defined subclasses, the
  407. * category is class Finishings itself.
  408. *
  409. * @return Printing attribute class (category), an instance of class
  410. * {@link java.lang.Class java.lang.Class}.
  411. */
  412. public final Class getCategory() {
  413. return Finishings.class;
  414. }
  415. /**
  416. * Get the name of the category of which this attribute value is an
  417. * instance.
  418. * <P>
  419. * For class Finishings and any vendor-defined subclasses, the
  420. * category name is <CODE>"finishings"</CODE>.
  421. *
  422. * @return Attribute category name.
  423. */
  424. public final String getName() {
  425. return "finishings";
  426. }
  427. }