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