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