KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)Copies.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 Copies is an integer valued printing attribute class that specifies the
16  * number of copies to be printed.
17  * <P>
18  * On many devices the supported number of collated copies will be limited by
19  * the number of physical output bins on the device, and may be different from
20  * the number of uncollated copies which can be supported.
21  * <P>
22  * The effect of a Copies attribute with a value of <I>n</I> on a multidoc print
23  * job (a job with multiple documents) depends on the (perhaps defaulted) value
24  * of the {@link MultipleDocumentHandling MultipleDocumentHandling} attribute:
25  * <UL>
26  * <LI>
27  * SINGLE_DOCUMENT -- The result will be <I>n</I> copies of a single output
28  * document comprising all the input docs.
29  * <P>
30  * <LI>
31  * SINGLE_DOCUMENT_NEW_SHEET -- The result will be <I>n</I> copies of a single
32  * output document comprising all the input docs, and the first impression of
33  * each input doc will always start on a new media sheet.
34  * <P>
35  * <LI>
36  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The result will be <I>n</I> copies of
37  * the first input document, followed by <I>n</I> copies of the second input
38  * document, . . . followed by <I>n</I> copies of the last input document.
39  * <P>
40  * <LI>
41  * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The result will be the first input
42  * document, the second input document, . . . the last input document, the group
43  * of documents being repeated <I>n</I> times.
44  * </UL>
45  * <P>
46  * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
47  * category name returned by <CODE>getName()</CODE> gives the IPP attribute
48  * name.
49  * <P>
50  *
51  * @author David Mendenhall
52  * @author Alan Kamihensky
53  */

54 public final class Copies extends IntegerSyntax JavaDoc
55     implements PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
56
57     private static final long serialVersionUID = -6426631521680023833L;
58
59     /**
60      * Construct a new copies attribute with the given integer value.
61      *
62      * @param value Integer value.
63      *
64      * @exception IllegalArgumentException
65      * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1.
66      */

67     public Copies(int value) {
68     super (value, 1, Integer.MAX_VALUE);
69     }
70
71     /**
72      * Returns whether this copies attribute is equivalent to the passed in
73      * object. To be equivalent, all of the following conditions must be true:
74      * <OL TYPE=1>
75      * <LI>
76      * <CODE>object</CODE> is not null.
77      * <LI>
78      * <CODE>object</CODE> is an instance of class Copies.
79      * <LI>
80      * This copies attribute's value and <CODE>object</CODE>'s value are
81      * equal.
82      * </OL>
83      *
84      * @param object Object to compare to.
85      *
86      * @return True if <CODE>object</CODE> is equivalent to this copies
87      * attribute, false otherwise.
88      */

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

102     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
103     return Copies JavaDoc.class;
104     }
105
106     /**
107      * Get the name of the category of which this attribute value is an
108      * instance.
109      * <P>
110      * For class Copies, the category name is <CODE>"copies"</CODE>.
111      *
112      * @return Attribute category name.
113      */

114     public final String JavaDoc getName() {
115     return "copies";
116     }
117     
118 }
119
Popular Tags