KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > PrinterState


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
9 import javax.print.attribute.Attribute JavaDoc;
10 import javax.print.attribute.EnumSyntax JavaDoc;
11 import javax.print.attribute.PrintServiceAttribute JavaDoc;
12
13 /**
14  * Class PrinterState is a printing attribute class, an enumeration, that
15  * identifies the current state of a printer. Class PrinterState defines
16  * standard printer state values. A Print Service implementation only needs
17  * to report those printer states which are appropriate for the particular
18  * implementation; it does not have to report every defined printer state. The
19  * {@link PrinterStateReasons PrinterStateReasons} attribute augments the
20  * PrinterState attribute to give more detailed information about the printer
21  * in given printer state.
22  * <P>
23  * <B>IPP Compatibility:</B> 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 Alan Kaminsky
30  */

31 public final class PrinterState extends EnumSyntax JavaDoc
32 implements PrintServiceAttribute JavaDoc {
33
34     private static final long serialVersionUID = -649578618346507718L;
35
36     /**
37      * The printer state is unknown.
38      */

39     public static final PrinterState JavaDoc UNKNOWN = new PrinterState JavaDoc(0);
40
41     /**
42      * Indicates that new jobs can start processing without waiting.
43      */

44     public static final PrinterState JavaDoc IDLE = new PrinterState JavaDoc(3);
45
46     /**
47      * Indicates that jobs are processing;
48      * new jobs will wait before processing.
49      */

50     public static final PrinterState JavaDoc PROCESSING = new PrinterState JavaDoc(4);
51
52     /**
53      * Indicates that no jobs can be processed and intervention is required.
54      */

55     public static final PrinterState JavaDoc STOPPED = new PrinterState JavaDoc(5);
56
57     /**
58      * Construct a new printer state enumeration value with the given integer
59      * value.
60      *
61      * @param value Integer value.
62      */

63     protected PrinterState(int value) {
64     super (value);
65     }
66
67     private static final String JavaDoc[] myStringTable = {
68     "unknown",
69     null,
70     null,
71     "idle",
72     "processing",
73     "stopped"
74     };
75
76     private static final PrinterState JavaDoc[] myEnumValueTable = {
77     UNKNOWN,
78     null,
79     null,
80     IDLE,
81     PROCESSING,
82     STOPPED
83     };
84
85     /**
86      * Returns the string table for class PrinterState.
87      */

88     protected String JavaDoc[] getStringTable() {
89     return myStringTable;
90     }
91
92     /**
93      * Returns the enumeration value table for class PrinterState.
94      */

95     protected EnumSyntax JavaDoc[] getEnumValueTable() {
96     return myEnumValueTable;
97     }
98
99     /**
100      * Get the printing attribute class which is to be used as the "category"
101      * for this printing attribute value.
102      * <P>
103      * For class PrinterState, the category is class PrinterState itself.
104      *
105      * @return Printing attribute class (category), an instance of class
106      * {@link java.lang.Class java.lang.Class}.
107      */

108     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
109     return PrinterState JavaDoc.class;
110     }
111
112     /**
113      * Get the name of the category of which this attribute value is an
114      * instance.
115      * <P>
116      * For class PrinterState, the category name is <CODE>"printer-state"</CODE>.
117      *
118      * @return Attribute category name.
119      */

120     public final String JavaDoc getName() {
121     return "printer-state";
122     }
123
124 }
125
Popular Tags