1. /*
  2. * @(#)PrinterState.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.PrintServiceAttribute;
  11. /**
  12. * Class PrinterState is a printing attribute class, an enumeration, that
  13. * identifies the current state of a printer. Class PrinterState defines
  14. * standard printer state values. A Print Service implementation only needs
  15. * to report those printer states which are appropriate for the particular
  16. * implementation; it does not have to report every defined printer state. The
  17. * {@link PrinterStateReasons PrinterStateReasons} attribute augments the
  18. * PrinterState attribute to give more detailed information about the printer
  19. * in given printer state.
  20. * <P>
  21. * <B>IPP Compatibility:</B> The category name returned by
  22. * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
  23. * integer value is the IPP enum value. The <code>toString()</code> method
  24. * returns the IPP string representation of the attribute value.
  25. * <P>
  26. *
  27. * @author Alan Kaminsky
  28. */
  29. public final class PrinterState extends EnumSyntax
  30. implements PrintServiceAttribute {
  31. private static final long serialVersionUID = -649578618346507718L;
  32. /**
  33. * The printer state is unknown.
  34. */
  35. public static final PrinterState UNKNOWN = new PrinterState(0);
  36. /**
  37. * Indicates that new jobs can start processing without waiting.
  38. */
  39. public static final PrinterState IDLE = new PrinterState(3);
  40. /**
  41. * Indicates that jobs are processing;
  42. * new jobs will wait before processing.
  43. */
  44. public static final PrinterState PROCESSING = new PrinterState(4);
  45. /**
  46. * Indicates that no jobs can be processed and intervention is required.
  47. */
  48. public static final PrinterState STOPPED = new PrinterState(5);
  49. /**
  50. * Construct a new printer state enumeration value with the given integer
  51. * value.
  52. *
  53. * @param value Integer value.
  54. */
  55. protected PrinterState(int value) {
  56. super (value);
  57. }
  58. private static final String[] myStringTable = {
  59. "unknown",
  60. null,
  61. null,
  62. "idle",
  63. "processing",
  64. "stopped"
  65. };
  66. private static final PrinterState[] myEnumValueTable = {
  67. UNKNOWN,
  68. null,
  69. null,
  70. IDLE,
  71. PROCESSING,
  72. STOPPED
  73. };
  74. /**
  75. * Returns the string table for class PrinterState.
  76. */
  77. protected String[] getStringTable() {
  78. return myStringTable;
  79. }
  80. /**
  81. * Returns the enumeration value table for class PrinterState.
  82. */
  83. protected EnumSyntax[] getEnumValueTable() {
  84. return myEnumValueTable;
  85. }
  86. /**
  87. * Get the printing attribute class which is to be used as the "category"
  88. * for this printing attribute value.
  89. * <P>
  90. * For class PrinterState, the category is class PrinterState itself.
  91. *
  92. * @return Printing attribute class (category), an instance of class
  93. * {@link java.lang.Class java.lang.Class}.
  94. */
  95. public final Class<? extends Attribute> getCategory() {
  96. return PrinterState.class;
  97. }
  98. /**
  99. * Get the name of the category of which this attribute value is an
  100. * instance.
  101. * <P>
  102. * For class PrinterState, the category name is <CODE>"printer-state"</CODE>.
  103. *
  104. * @return Attribute category name.
  105. */
  106. public final String getName() {
  107. return "printer-state";
  108. }
  109. }