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