KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)JobPriority.java 1.7 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.IntegerSyntax JavaDoc;
11 import javax.print.attribute.PrintRequestAttribute JavaDoc;
12 import javax.print.attribute.PrintJobAttribute JavaDoc;
13
14 /**
15  * Class JobPriority is an integer valued printing attribute class that
16  * specifies a print job's priority.
17  * <P>
18  * If a JobPriority attribute is specified for a Print Job, it specifies a
19  * priority for scheduling the job. A higher value specifies a higher priority.
20  * The value 1 indicates the lowest possible priority. The value 100 indicates
21  * the highest possible priority. Among those jobs that are ready to print, a
22  * printer must print all jobs with a priority value of <I>n</I> before printing
23  * those with a priority value of <I>n</I>-1 for all <I>n.</I>
24  * <P>
25  * If the client does not specify a JobPriority attribute for a Print Job and
26  * the printer does support the JobPriority attribute, the printer must use an
27  * implementation-defined default JobPriority value.
28  * <P>
29  * The client can always specify any job priority value from 1 to 100 for a job.
30  * However, a Print Service instance may support fewer than 100 different
31  * job priority levels. If this is the case, the Print Service instance
32  * automatically maps the client-specified job priority value to one of the
33  * supported job priority levels, dividing the 100 job priority values equally
34  * among the available job priority levels.
35  * <P>
36  * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
37  * category name returned by <CODE>getName()</CODE> gives the IPP attribute
38  * name.
39  * <P>
40  *
41  * @author Alan Kaminsky
42  */

43 public final class JobPriority extends IntegerSyntax JavaDoc
44     implements PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
45
46     private static final long serialVersionUID = -4599900369040602769L;
47
48     /**
49      * Construct a new job priority attribute with the given integer value.
50      *
51      * @param value Integer value.
52      *
53      * @exception IllegalArgumentException
54      * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1
55      * or greater than 100.
56      */

57     public JobPriority(int value) {
58     super (value, 1, 100);
59     }
60
61     /**
62      * Returns whether this job priority attribute is equivalent to the passed
63      * in object. To be equivalent, all of the following conditions must be
64      * 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 JobPriority.
70      * <LI>
71      * This job priority attribute's value and <CODE>object</CODE>'s value
72      * are equal.
73      * </OL>
74      *
75      * @param object Object to compare to.
76      *
77      * @return True if <CODE>object</CODE> is equivalent to this job
78      * priority attribute, false otherwise.
79      */

80     public boolean equals(Object JavaDoc object) {
81     return (super.equals (object) && object instanceof JobPriority JavaDoc);
82     }
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 JobPriority, the category is class JobPriority 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 JavaDoc<? extends Attribute JavaDoc> getCategory() {
94     return JobPriority JavaDoc.class;
95     }
96     
97     /**
98      * Get the name of the category of which this attribute value is an
99      * instance.
100      * <P>
101      * For class JobPriority, the category name is <CODE>"job-priority"</CODE>.
102      *
103      * @return Attribute category name.
104      */

105     public final String JavaDoc getName() {
106     return "job-priority";
107     }
108     
109 }
110
Popular Tags