1. /*
  2. * @(#)PresentationDirection.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.PrintJobAttribute;
  11. import javax.print.attribute.PrintRequestAttribute;
  12. /**
  13. * Class PresentationDirection is a printing attribute class, an enumeration,
  14. * that is used in conjunction with the {@link NumberUp NumberUp} attribute to
  15. * indicate the layout of multiple print-stream pages to impose upon a
  16. * single side of an instance of a selected medium.
  17. * This is useful to mirror the text layout conventions of different scripts.
  18. * For example, English is "toright-tobottom", Hebrew is "toleft-tobottom"
  19. * and Japanese is usually "tobottom-toleft".
  20. * <P>
  21. * <B>IPP Compatibility:</B> This attribute is not an IPP 1.1
  22. * attribute; it is an attribute in the Production Printing Extension
  23. * (<a href="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>)
  24. * of IPP 1.1. The category name returned by
  25. * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
  26. * integer value is the IPP enum value. The <code>toString()</code> method
  27. * returns the IPP string representation of the attribute value.
  28. * <P>
  29. *
  30. * @author Phil Race.
  31. */
  32. public final class PresentationDirection extends EnumSyntax
  33. implements PrintJobAttribute, PrintRequestAttribute {
  34. private static final long serialVersionUID = 8294728067230931780L;
  35. /**
  36. * Pages are laid out in columns starting at the top left,
  37. * proceeeding towards the bottom & right.
  38. */
  39. public static final PresentationDirection TOBOTTOM_TORIGHT =
  40. new PresentationDirection(0);
  41. /**
  42. * Pages are laid out in columns starting at the top right,
  43. * proceeeding towards the bottom & left.
  44. */
  45. public static final PresentationDirection TOBOTTOM_TOLEFT =
  46. new PresentationDirection(1);
  47. /**
  48. * Pages are laid out in columns starting at the bottom left,
  49. * proceeeding towards the top & right.
  50. */
  51. public static final PresentationDirection TOTOP_TORIGHT =
  52. new PresentationDirection(2);
  53. /**
  54. * Pages are laid out in columns starting at the bottom right,
  55. * proceeeding towards the top & left.
  56. */
  57. public static final PresentationDirection TOTOP_TOLEFT =
  58. new PresentationDirection(3);
  59. /**
  60. * Pages are laid out in rows starting at the top left,
  61. * proceeeding towards the right & bottom.
  62. */
  63. public static final PresentationDirection TORIGHT_TOBOTTOM =
  64. new PresentationDirection(4);
  65. /**
  66. * Pages are laid out in rows starting at the bottom left,
  67. * proceeeding towards the right & top.
  68. */
  69. public static final PresentationDirection TORIGHT_TOTOP =
  70. new PresentationDirection(5);
  71. /**
  72. * Pages are laid out in rows starting at the top right,
  73. * proceeeding towards the left & bottom.
  74. */
  75. public static final PresentationDirection TOLEFT_TOBOTTOM =
  76. new PresentationDirection(6);
  77. /**
  78. * Pages are laid out in rows starting at the bottom right,
  79. * proceeeding towards the left & top.
  80. */
  81. public static final PresentationDirection TOLEFT_TOTOP =
  82. new PresentationDirection(7);
  83. /**
  84. * Construct a new presentation direction enumeration value with the given
  85. * integer value.
  86. *
  87. * @param value Integer value.
  88. */
  89. private PresentationDirection(int value) {
  90. super (value);
  91. }
  92. private static final String[] myStringTable = {
  93. "tobottom-toright",
  94. "tobottom-toleft",
  95. "totop-toright",
  96. "totop-toleft",
  97. "toright-tobottom",
  98. "toright-totop",
  99. "toleft-tobottom",
  100. "toleft-totop",
  101. };
  102. private static final PresentationDirection[] myEnumValueTable = {
  103. TOBOTTOM_TORIGHT,
  104. TOBOTTOM_TOLEFT,
  105. TOTOP_TORIGHT,
  106. TOTOP_TOLEFT,
  107. TORIGHT_TOBOTTOM,
  108. TORIGHT_TOTOP,
  109. TOLEFT_TOBOTTOM,
  110. TOLEFT_TOTOP,
  111. };
  112. /**
  113. * Returns the string table for class PresentationDirection.
  114. */
  115. protected String[] getStringTable() {
  116. return myStringTable;
  117. }
  118. /**
  119. * Returns the enumeration value table for class PresentationDirection.
  120. */
  121. protected EnumSyntax[] getEnumValueTable() {
  122. return myEnumValueTable;
  123. }
  124. /**
  125. * Get the printing attribute class which is to be used as the "category"
  126. * for this printing attribute value.
  127. * <P>
  128. * For class PresentationDirection
  129. * the category is class PresentationDirection itself.
  130. *
  131. * @return Printing attribute class (category), an instance of class
  132. * {@link java.lang.Class java.lang.Class}.
  133. */
  134. public final Class<? extends Attribute> getCategory() {
  135. return PresentationDirection.class;
  136. }
  137. /**
  138. * Get the name of the category of which this attribute value is an
  139. * instance.
  140. * <P>
  141. * For class PresentationDirection
  142. * the category name is <CODE>"presentation-direction"</CODE>.
  143. *
  144. * @return Attribute category name.
  145. */
  146. public final String getName() {
  147. return "presentation-direction";
  148. }
  149. }