KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)PrinterMessageFromOperator.java 1.9 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 java.util.Locale JavaDoc;
10
11 import javax.print.attribute.Attribute JavaDoc;
12 import javax.print.attribute.TextSyntax JavaDoc;
13 import javax.print.attribute.PrintServiceAttribute JavaDoc;
14
15 /**
16  * Class PrinterMessageFromOperator is a printing attribute class, a text
17  * attribute, that provides a message from an operator, system administrator,
18  * or "intelligent" process to indicate to the end user information about or
19  * status of the printer, such as why it is unavailable or when it is
20  * expected to be available.
21  * <P>
22  * A Print Service's attribute set includes zero instances or one instance of
23  * a
24  * PrinterMessageFromOperator attribute, not more than one instance. A new
25  * PrinterMessageFromOperator attribute replaces an existing
26  * PrinterMessageFromOperator attribute, if any. In other words,
27  * PrinterMessageFromOperator is not intended to be a history log.
28  * If it wishes, the client can detect changes to a Print Service's
29  * PrinterMessageFromOperator
30  * attribute and maintain the client's own history log of the
31  * PrinterMessageFromOperator attribute values.
32  * <P>
33  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
34  * locale gives the IPP natural language. The category name returned by
35  * <CODE>getName()</CODE> gives the IPP attribute name.
36  * <P>
37  *
38  * @author Alan Kaminsky
39  */

40 public final class PrinterMessageFromOperator extends TextSyntax JavaDoc
41     implements PrintServiceAttribute JavaDoc {
42
43     static final long serialVersionUID = -4486871203218629318L;
44
45     /**
46      * Constructs a new printer message from operator attribute with the
47      * given message and locale.
48      *
49      * @param message Message.
50      * @param locale Natural language of the text string. null
51      * is interpreted to mean the default locale as returned
52      * by <code>Locale.getDefault()</code>
53      *
54      * @exception NullPointerException
55      * (unchecked exception) Thrown if <CODE>message</CODE> is null.
56      */

57     public PrinterMessageFromOperator(String JavaDoc message, Locale JavaDoc locale) {
58     super (message, locale);
59     }
60
61     /**
62      * Returns whether this printer message from operator attribute is
63      * equivalent to the passed in object. To be equivalent, all of the
64      * following conditions must be true:
65      * <OL TYPE=1>
66      * <LI>
67      * <CODE>object</CODE> is not null.
68      * <LI>
69      * <CODE>object</CODE> is an instance of class
70      * PrinterMessageFromOperator.
71      * <LI>
72      * This printer message from operator attribute's underlying string and
73      * <CODE>object</CODE>'s underlying string are equal.
74      * <LI>
75      * This printer message from operator attribute's locale and
76      * <CODE>object</CODE>'s locale are equal.
77      * </OL>
78      *
79      * @param object Object to compare to.
80      *
81      * @return True if <CODE>object</CODE> is equivalent to this printer
82      * message from operator attribute, false otherwise.
83      */

84     public boolean equals(Object JavaDoc object) {
85     return (super.equals(object) &&
86         object instanceof PrinterMessageFromOperator JavaDoc);
87     }
88
89     /**
90      * Get the printing attribute class which is to be used as the "category"
91      * for this printing attribute value.
92      * <P>
93      * For class PrinterMessageFromOperator,
94      * the category is class PrinterMessageFromOperator itself.
95      *
96      * @return Printing attribute class (category), an instance of class
97      * {@link java.lang.Class java.lang.Class}.
98      */

99     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
100     return PrinterMessageFromOperator JavaDoc.class;
101     }
102
103     /**
104      * Get the name of the category of which this attribute value is an
105      * instance.
106      * <P>
107      * For class PrinterMessageFromOperator,
108      * the category name is <CODE>"printer-message-from-operator"</CODE>.
109      *
110      * @return Attribute category name.
111      */

112     public final String JavaDoc getName() {
113     return "printer-message-from-operator";
114     }
115
116 }
117
Popular Tags