Finishings.java 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. /* Finishings.java --
  2. Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package javax.print.attribute.standard;
  32. import javax.print.attribute.Attribute;
  33. import javax.print.attribute.DocAttribute;
  34. import javax.print.attribute.EnumSyntax;
  35. import javax.print.attribute.PrintJobAttribute;
  36. import javax.print.attribute.PrintRequestAttribute;
  37. /**
  38. * The <code>Finishings</code> attribute specifies the finishing operations
  39. * that the Printer applies to every copy of each printed document in the Job.
  40. * <p>
  41. * Standard enum values are: <code>NONE</code>, <code>STAPLE</code>,
  42. * <code>COVER</code>, <code>BIND</code>, <code>SADDLE_STITCH</code>,
  43. * <code>EDGE_STITCH</code>.
  44. * <br><br>
  45. * The following values are more specific:
  46. * <code>STAPLE_TOP_LEFT</code>, <code>STAPLE_BOTTOM_LEFT</code>,
  47. * <code>STAPLE_TOP_RIGHT</code>, <code>STAPLE_BOTTOM_RIGHT</code>,
  48. * <code>EDGE_STITCH_LEFT</code>, <code>EDGE_STITCH_TOP</code>,
  49. * <code>EDGE_STITCH_RIGHT</code>, <code>EDGE_STITCH_BOTTOM</code>,
  50. * <code>STAPLE_DUAL_LEFT</code>, <code>STAPLE_DUAL_TOP</code>,
  51. * <code>STAPLE_DUAL_RIGHT</code>, <code>STAPLE_DUAL_BOTTOM</code>.
  52. * </p>
  53. * <p>
  54. * <b>Note:</b> The effect of this attribute on jobs with multiple documents
  55. * is controlled by the job attribute
  56. * {@link javax.print.attribute.standard.MultipleDocumentHandling}.
  57. * </p>
  58. * <p>
  59. * <b>IPP Compatibility:</b> Finishings is an IPP 1.1 attribute. Differences
  60. * to the IPP specification are that in the Java Print Service API only one
  61. * enum value is supported (in IPP a set of enums). Further the enum
  62. * <code>punch</code> is not supported.
  63. * </p>
  64. *
  65. * @author Michael Koch (konqueror@gmx.de)
  66. * @author Wolfgang Baer (WBaer@gmx.de)
  67. */
  68. public class Finishings extends EnumSyntax
  69. implements DocAttribute, PrintJobAttribute, PrintRequestAttribute
  70. {
  71. private static final long serialVersionUID = -627840419548391754L;
  72. /**
  73. * Perform no finishings of the documents.
  74. */
  75. public static final Finishings NONE = new Finishings(3);
  76. /**
  77. * Selects binding of the documents with one or more staples.
  78. */
  79. public static final Finishings STAPLE = new Finishings(4);
  80. /**
  81. * Selects the use of a non-printed (or pre-printed) cover for
  82. * the document.
  83. */
  84. public static final Finishings COVER = new Finishings(6);
  85. /**
  86. * Selects that a binding is to be applied to the document.
  87. * The type and placement of the binding is site-defined.
  88. */
  89. public static final Finishings BIND = new Finishings(7);
  90. /**
  91. * Selects binding of the documents with one or more staples
  92. * along the middle fold.
  93. */
  94. public static final Finishings SADDLE_STITCH = new Finishings(8);
  95. /**
  96. * Selects binding of the documents with one or more staples
  97. * along one edge.
  98. */
  99. public static final Finishings EDGE_STITCH = new Finishings(9);
  100. /**
  101. * Selects binding of the documents with one or more staples
  102. * in the top left corner.
  103. */
  104. public static final Finishings STAPLE_TOP_LEFT = new Finishings(20);
  105. /**
  106. * Selects binding of the documents with one or more staples in the bottom
  107. * left corner.
  108. */
  109. public static final Finishings STAPLE_BOTTOM_LEFT = new Finishings(21);
  110. /**
  111. * Selects binding of the documents with one or more staples in
  112. * the top right corner.
  113. */
  114. public static final Finishings STAPLE_TOP_RIGHT = new Finishings(22);
  115. /**
  116. * Selects binding of the documents with one or more staples in
  117. * the bottom right corner.
  118. */
  119. public static final Finishings STAPLE_BOTTOM_RIGHT = new Finishings(23);
  120. /**
  121. * Selects binding of the documents with one or more staples
  122. * along the left edge.
  123. */
  124. public static final Finishings EDGE_STITCH_LEFT = new Finishings(24);
  125. /**
  126. * Selects binding of the documents with one or more staples along
  127. * the top edge.
  128. */
  129. public static final Finishings EDGE_STITCH_TOP = new Finishings(25);
  130. /**
  131. * Selects binding of the documents with one or more staples along
  132. * the right edge.
  133. */
  134. public static final Finishings EDGE_STITCH_RIGHT = new Finishings(26);
  135. /**
  136. * Selects binding of the documents with one or more staples along
  137. * the bottom edge.
  138. */
  139. public static final Finishings EDGE_STITCH_BOTTOM = new Finishings(27);
  140. /**
  141. * Selects binding of the documents with two staples along the
  142. * left edge assuming a portrait document.
  143. */
  144. public static final Finishings STAPLE_DUAL_LEFT = new Finishings(28);
  145. /**
  146. * Selects binding of the documents with two staples along the
  147. * top edge assuming a portrait document.
  148. */
  149. public static final Finishings STAPLE_DUAL_TOP = new Finishings(29);
  150. /**
  151. * Selects binding of the documents with two staples along the
  152. * right edge assuming a portrait document.
  153. */
  154. public static final Finishings STAPLE_DUAL_RIGHT = new Finishings(30);
  155. /**
  156. * Selects binding of the documents with two staples along the
  157. * bottom edge assuming a portrait document.
  158. */
  159. public static final Finishings STAPLE_DUAL_BOTTOM = new Finishings(31);
  160. private static final String[] stringTable = { "none", "staple", null,
  161. "cover", "bind", "saddle-stitch",
  162. "edge-stitch", null, null, null,
  163. null, null, null, null, null,
  164. null, null, "staple-top-left",
  165. "staple-bottom-left",
  166. "staple-top-right",
  167. "staple-bottom-right",
  168. "edge-stitch-left",
  169. "edge-stitch-top",
  170. "edge-stitch-right",
  171. "edge-stitch-bottom",
  172. "staple-dual-left",
  173. "staple-dual-top",
  174. "staple-dual-right",
  175. "staple-dual-bottom" };
  176. private static final Finishings[] enumValueTable = { NONE, STAPLE, null,
  177. COVER, BIND,
  178. SADDLE_STITCH,
  179. EDGE_STITCH, null,
  180. null, null, null,
  181. null, null, null,
  182. null, null, null,
  183. STAPLE_TOP_LEFT,
  184. STAPLE_BOTTOM_LEFT,
  185. STAPLE_TOP_RIGHT,
  186. STAPLE_BOTTOM_RIGHT,
  187. EDGE_STITCH_LEFT,
  188. EDGE_STITCH_TOP,
  189. EDGE_STITCH_RIGHT,
  190. EDGE_STITCH_BOTTOM,
  191. STAPLE_DUAL_LEFT,
  192. STAPLE_DUAL_TOP,
  193. STAPLE_DUAL_RIGHT,
  194. STAPLE_DUAL_BOTTOM };
  195. /**
  196. * Constructs a <code>Finishings</code> object.
  197. *
  198. * @param value the value
  199. */
  200. protected Finishings(int value)
  201. {
  202. super(value);
  203. }
  204. /**
  205. * Returns category of this class.
  206. *
  207. * @return the class <code>Finishings</code> itself
  208. */
  209. public Class< ? extends Attribute> getCategory()
  210. {
  211. return Finishings.class;
  212. }
  213. /**
  214. * Returns the name of this attribute.
  215. *
  216. * @return The name "finishings".
  217. */
  218. public final String getName()
  219. {
  220. return "finishings";
  221. }
  222. /**
  223. * Returns a table with the enumeration values represented as strings
  224. * for this object.
  225. *
  226. * @return The enumeration values as strings.
  227. */
  228. protected String[] getStringTable()
  229. {
  230. return stringTable;
  231. }
  232. /**
  233. * Returns a table with the enumeration values for this object.
  234. *
  235. * @return The enumeration values.
  236. */
  237. protected EnumSyntax[] getEnumValueTable()
  238. {
  239. return enumValueTable;
  240. }
  241. /**
  242. * Returns the lowest used value by the enumerations of this class.
  243. * .
  244. * @return The lowest value used.
  245. */
  246. protected int getOffset()
  247. {
  248. return 3;
  249. }
  250. }