KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)DocumentName.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 java.util.Locale JavaDoc;
10
11 import javax.print.attribute.Attribute JavaDoc;
12 import javax.print.attribute.TextSyntax JavaDoc;
13 import javax.print.attribute.DocAttribute JavaDoc;
14
15 /**
16  * Class DocumentName is a printing attribute class, a text attribute, that
17  * specifies the name of a document. DocumentName is an attribute of the print
18  * data (the doc), not of the Print Job. A document's name is an arbitrary
19  * string defined by the client.
20  * However if a JobName is not specified, the DocumentName should be used
21  * instead, which implies that supporting specification of DocumentName
22  * requires reporting of JobName and vice versa.
23  * See {@link JobName JobName} for more information.
24  * <P>
25  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
26  * locale gives the IPP natural language. The category name returned by
27  * <CODE>getName()</CODE> gives the IPP attribute name.
28  * <P>
29  *
30  * @author Alan Kaminsky
31  */

32 public final class DocumentName extends TextSyntax JavaDoc implements DocAttribute JavaDoc {
33
34     private static final long serialVersionUID = 7883105848533280430L;
35
36     /**
37      * Constructs a new document name attribute with the given document name
38      * and locale.
39      *
40      * @param documentName Document name.
41      * @param locale Natural language of the text string. null
42      * is interpreted to mean the default locale as returned
43      * by <code>Locale.getDefault()</code>
44      *
45      * @exception NullPointerException
46      * (unchecked exception) Thrown if <CODE>documentName</CODE> is null.
47      */

48     public DocumentName(String JavaDoc documentName, Locale JavaDoc locale) {
49     super (documentName, locale);
50     }
51
52     /**
53      * Returns whether this document name attribute is equivalent to the
54      * passed in object.
55      * To be equivalent, all of the following conditions must be true:
56      * <OL TYPE=1>
57      * <LI>
58      * <CODE>object</CODE> is not null.
59      * <LI>
60      * <CODE>object</CODE> is an instance of class DocumentName.
61      * <LI>
62      * This document name attribute's underlying string and
63      * <CODE>object</CODE>'s underlying string are equal.
64      * <LI>
65      * This document name attribute's locale and <CODE>object</CODE>'s locale
66      * are equal.
67      * </OL>
68      *
69      * @param object Object to compare to.
70      *
71      * @return True if <CODE>object</CODE> is equivalent to this document
72      * name attribute, false otherwise.
73      */

74     public boolean equals(Object JavaDoc object) {
75     return (super.equals (object) && object instanceof DocumentName JavaDoc);
76     }
77
78     /**
79      * Get the printing attribute class which is to be used as the "category"
80      * for this printing attribute value.
81      * <P>
82      * For class DocumentName, the category is class DocumentName itself.
83      *
84      * @return Printing attribute class (category), an instance of class
85      * {@link java.lang.Class java.lang.Class}.
86      */

87     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
88     return DocumentName JavaDoc.class;
89     }
90
91     /**
92      * Get the name of the category of which this attribute value is an
93      * instance.
94      * <P>
95      * For class DocumentName, the category name is <CODE>"document-name"</CODE>.
96      *
97      * @return Attribute category name.
98      */

99     public final String JavaDoc getName() {
100     return "document-name";
101     }
102
103 }
104
Popular Tags