1. /*
  2. * @(#)PrintQuality.java 1.5 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 PrintQuality is a printing attribute class, an enumeration,
  14. * that specifies the print quality that the printer uses for the job.
  15. * <P>
  16. * <B>IPP Compatibility:</B> The category name returned by
  17. * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
  18. * integer value is the IPP enum value. The <code>toString()</code> method
  19. * returns the IPP string representation of the attribute value.
  20. * <P>
  21. *
  22. * @author David Mendenhall
  23. * @author Alan Kaminsky
  24. */
  25. public class PrintQuality extends EnumSyntax
  26. implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
  27. /**
  28. * Lowest quality available on the printer.
  29. */
  30. public static final PrintQuality DRAFT = new PrintQuality(3);
  31. /**
  32. * Normal or intermediate quality on the printer.
  33. */
  34. public static final PrintQuality NORMAL = new PrintQuality(4);
  35. /**
  36. * Highest quality available on the printer.
  37. */
  38. public static final PrintQuality HIGH = new PrintQuality(5);
  39. /**
  40. * Construct a new print quality enumeration value with the given integer
  41. * value.
  42. *
  43. * @param value Integer value.
  44. */
  45. protected PrintQuality(int value) {
  46. super (value);
  47. }
  48. private static final String[] myStringTable = {
  49. "draft",
  50. "normal",
  51. "high"
  52. };
  53. private static final PrintQuality[] myEnumValueTable = {
  54. DRAFT,
  55. NORMAL,
  56. HIGH
  57. };
  58. /**
  59. * Returns the string table for class PrintQuality.
  60. */
  61. protected String[] getStringTable() {
  62. return (String[])myStringTable.clone();
  63. }
  64. /**
  65. * Returns the enumeration value table for class PrintQuality.
  66. */
  67. protected EnumSyntax[] getEnumValueTable() {
  68. return (EnumSyntax[])myEnumValueTable.clone();
  69. }
  70. /**
  71. * Returns the lowest integer value used by class PrintQuality.
  72. */
  73. protected int getOffset() {
  74. return 3;
  75. }
  76. /**
  77. * Get the printing attribute class which is to be used as the "category"
  78. * for this printing attribute value.
  79. * <P>
  80. * For class PrintQuality and any vendor-defined subclasses, the category is
  81. * class PrintQuality itself.
  82. *
  83. * @return Printing attribute class (category), an instance of class
  84. * {@link java.lang.Class java.lang.Class}.
  85. */
  86. public final Class getCategory() {
  87. return PrintQuality.class;
  88. }
  89. /**
  90. * Get the name of the category of which this attribute value is an
  91. * instance.
  92. * <P>
  93. * For class PrintQuality and any vendor-defined subclasses, the category
  94. * name is <CODE>"print-quality"</CODE>.
  95. *
  96. * @return Attribute category name.
  97. */
  98. public final String getName() {
  99. return "print-quality";
  100. }
  101. }