KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)Severity.java 1.10 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.EnumSyntax JavaDoc;
10 import javax.print.attribute.Attribute JavaDoc;
11
12 /**
13  * Class Severity is a printing attribute class, an enumeration, that denotes
14  * the severity of a {@link PrinterStateReason PrinterStateReason} attribute.
15  * <P>
16  * Instances of Severity do not appear in a Print Service's attribute set
17  * directly. Rather, a {@link PrinterStateReasons PrinterStateReasons}
18  * attribute appears in the Print Service's attribute set.
19  * The {@link PrinterStateReasons
20  * PrinterStateReasons} attribute contains zero, one, or more than one {@link
21  * PrinterStateReason PrinterStateReason} objects which pertain to the Print
22  * Service's status, and each {@link PrinterStateReason PrinterStateReason}
23  * object is associated with a Severity level of REPORT (least severe),
24  * WARNING, or ERROR (most severe).
25  * The printer adds a {@link PrinterStateReason
26  * PrinterStateReason} object to the Print Service's
27  * {@link PrinterStateReasons PrinterStateReasons} attribute when the
28  * corresponding condition becomes true
29  * of the printer, and the printer removes the {@link PrinterStateReason
30  * PrinterStateReason} object again when the corresponding condition becomes
31  * false, regardless of whether the Print Service's overall
32  * {@link PrinterState PrinterState} also changed.
33  * <P>
34  * <B>IPP Compatibility:</B>
35  * <code>Severity.toString()</code> returns either "error", "warning", or
36  * "report". The string values returned by
37  * each individual {@link PrinterStateReason} and
38  * associated {@link Severity} object's <CODE>toString()</CODE>
39  * methods, concatenated together with a hyphen (<CODE>"-"</CODE>) in
40  * between, gives the IPP keyword value for a {@link PrinterStateReasons}.
41  * The category name returned by <CODE>getName()</CODE> gives the IPP
42  * attribute name.
43  * <P>
44  *
45  * @author Alan Kaminsky
46  */

47 public final class Severity extends EnumSyntax JavaDoc implements Attribute JavaDoc {
48
49     private static final long serialVersionUID = 8781881462717925380L;
50
51     /**
52      * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
53      * "report" (least severe). An implementation may choose to omit some or
54      * all reports.
55      * Some reports specify finer granularity about the printer state;
56      * others serve as a precursor to a warning. A report must contain nothing
57      * that could affect the printed output.
58      */

59     public static final Severity JavaDoc REPORT = new Severity JavaDoc (0);
60     
61     /**
62      * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
63      * "warning." An implementation may choose to omit some or all warnings.
64      * Warnings serve as a precursor to an error. A warning must contain
65      * nothing that prevents a job from completing, though in some cases the
66      * output may be of lower quality.
67      */

68     public static final Severity JavaDoc WARNING = new Severity JavaDoc (1);
69     
70     /**
71      * Indicates that the {@link PrinterStateReason PrinterStateReason} is an
72      * "error" (most severe). An implementation must include all errors.
73      * If this attribute contains one or more errors, the printer's
74      * {@link PrinterState PrinterState} must be STOPPED.
75      */

76     public static final Severity JavaDoc ERROR = new Severity JavaDoc (2);
77     
78     /**
79      * Construct a new severity enumeration value with the given integer
80      * value.
81      *
82      * @param value Integer value.
83      */

84     protected Severity(int value) {
85     super (value);
86     }
87
88     private static final String JavaDoc[] myStringTable = {
89     "report",
90     "warning",
91     "error"
92     };
93
94     private static final Severity JavaDoc[] myEnumValueTable = {
95     REPORT,
96     WARNING,
97     ERROR
98     };
99
100     /**
101      * Returns the string table for class Severity.
102      */

103     protected String JavaDoc[] getStringTable() {
104     return myStringTable;
105     }
106
107     /**
108      * Returns the enumeration value table for class Severity.
109      */

110     protected EnumSyntax JavaDoc[] getEnumValueTable() {
111     return myEnumValueTable;
112     }
113     
114
115     /**
116      * Get the printing attribute class which is to be used as the "category"
117      * for this printing attribute value.
118      * <P>
119      * For class Severity, the category is class Severity itself.
120      *
121      * @return Printing attribute class (category), an instance of class
122      * {@link java.lang.Class java.lang.Class}.
123      */

124     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
125     return Severity JavaDoc.class;
126     }
127
128     /**
129      * Get the name of the category of which this attribute value is an
130      * instance.
131      * <P>
132      * For class Severit, the category name is <CODE>"severity"</CODE>.
133      *
134      * @return Attribute category name.
135      */

136     public final String JavaDoc getName() {
137     return "severity";
138     }
139
140 }
141
Popular Tags