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