KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)NumberUp.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.DocAttribute JavaDoc;
12 import javax.print.attribute.PrintRequestAttribute JavaDoc;
13 import javax.print.attribute.PrintJobAttribute JavaDoc;
14
15 /**
16  * Class NumberUp is an integer valued printing attribute class that specifies
17  * the number of print-stream pages to impose upon a single side of an
18  * instance of a selected medium. That is, if the NumberUp value is <I>n,</I>
19  * the printer must place <I>n</I> print-stream pages on a single side of
20  * an instance of the
21  * selected medium. To accomplish this, the printer may add some sort of
22  * translation, scaling, or rotation. This attribute primarily controls the
23  * translation, scaling and rotation of print-stream pages.
24  * <P>
25  * The effect of a NumberUp attribute on a multidoc print job (a job with
26  * multiple documents) depends on whether all the docs have the same number up
27  * values specified or whether different docs have different number up values
28  * specified, and on the (perhaps defaulted) value of the {@link
29  * MultipleDocumentHandling MultipleDocumentHandling} attribute.
30  * <UL>
31  * <LI>
32  * If all the docs have the same number up value <I>n</I> specified, then any
33  * value of {@link MultipleDocumentHandling MultipleDocumentHandling} makes
34  * sense, and the printer's processing depends on the {@link
35  * MultipleDocumentHandling MultipleDocumentHandling} value:
36  * <UL>
37  * <LI>
38  * SINGLE_DOCUMENT -- All the input docs will be combined together into one
39  * output document. Each media impression will consist of <I>n</I>m
40  * print-stream pages from the output document.
41  * <P>
42  * <LI>
43  * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
44  * into one output document. Each media impression will consist of <I>n</I>
45  * print-stream pages from the output document. However, the first impression of
46  * each input doc will always start on a new media sheet; this means the last
47  * impression of an input doc may have fewer than <I>n</I> print-stream pages
48  * on it.
49  * <P>
50  * <LI>
51  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
52  * Each media impression will consist of <I>n</I> print-stream pages from the
53  * input doc. Since the input docs are separate, the first impression of each
54  * input doc will always start on a new media sheet; this means the last
55  * impression of an input doc may have fewer than <I>n</I> print-stream pages on
56  * it.
57  * <P>
58  * <LI>
59  * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
60  * Each media impression will consist of <I>n</I> print-stream pages from the
61  * input doc. Since the input docs are separate, the first impression of each
62  * input doc will always start on a new media sheet; this means the last
63  * impression of an input doc may have fewer than <I>n</I> print-stream pages
64  * on it.
65  * </UL>
66  * <UL>
67  * <LI>
68  * SINGLE_DOCUMENT -- All the input docs will be combined together into one
69  * output document. Each media impression will consist of <I>n<SUB>i</SUB></I>
70  * print-stream pages from the output document, where <I>i</I> is the number of
71  * the input doc corresponding to that point in the output document. When the
72  * next input doc has a different number up value from the previous input doc,
73  * the first print-stream page of the next input doc goes at the start of the
74  * next media impression, possibly leaving fewer than the full number of
75  * print-stream pages on the previous media impression.
76  * <P>
77  * <LI>
78  * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
79  * into one output document. Each media impression will consist of <I>n</I>
80  * print-stream pages from the output document. However, the first impression of
81  * each input doc will always start on a new media sheet; this means the last
82  * impression of an input doc may have fewer than <I>n</I> print-stream pages
83  * on it.
84  * <P>
85  * <LI>
86  * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
87  * For input doc <I>i,</I> each media impression will consist of
88  * <I>n<SUB>i</SUB></I> print-stream pages from the input doc. Since the input
89  * docs are separate, the first impression of each input doc will always start
90  * on a new media sheet; this means the last impression of an input doc may have
91  * fewer than <I>n<SUB>i</SUB></I> print-stream pages on it.
92  * <P>
93  * <LI>
94  * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
95  * For input doc <I>i,</I> each media impression will consist of
96  * <I>n<SUB>i</SUB></I> print-stream pages from the input doc. Since the input
97  * docs are separate, the first impression of each input doc will always start
98  * on a new media sheet; this means the last impression of an input doc may
99  * have fewer than <I>n<SUB>i</SUB></I> print-stream pages on it.
100  * </UL>
101  * </UL>
102  * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
103  * The category name returned by <CODE>getName()</CODE> gives the IPP
104  * attribute name.
105  * <P>
106  *
107  * @author Alan Kaminsky
108  */

109 public final class NumberUp extends IntegerSyntax JavaDoc
110     implements DocAttribute JavaDoc, PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
111
112     private static final long serialVersionUID = -3040436486786527811L;
113
114
115     /**
116      * Construct a new number up attribute with the given integer value.
117      *
118      * @param value Integer value.
119      *
120      * @exception IllegalArgumentException
121      * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1.
122      */

123     public NumberUp(int value) {
124     super (value, 1, Integer.MAX_VALUE);
125     }
126
127     /**
128      * Returns whether this number up attribute is equivalent to the passed in
129      * object. To be equivalent, all of the following conditions must be true:
130      * <OL TYPE=1>
131      * <LI>
132      * <CODE>object</CODE> is not null.
133      * <LI>
134      * <CODE>object</CODE> is an instance of class NumberUp.
135      * <LI>
136      * This number up attribute's value and <CODE>object</CODE>'s value are
137      * equal.
138      * </OL>
139      *
140      * @param object Object to compare to.
141      *
142      * @return True if <CODE>object</CODE> is equivalent to this number up
143      * attribute, false otherwise.
144      */

145     public boolean equals(Object JavaDoc object) {
146     return (super.equals(object) && object instanceof NumberUp JavaDoc);
147     }
148
149     /**
150      * Get the printing attribute class which is to be used as the "category"
151      * for this printing attribute value.
152      * <P>
153      * For class NumberUp, the category is class NumberUp itself.
154      *
155      * @return Printing attribute class (category), an instance of class
156      * {@link java.lang.Class java.lang.Class}.
157      */

158     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
159     return NumberUp JavaDoc.class;
160     }
161
162     /**
163      * Get the name of the category of which this attribute value is an
164      * instance.
165      * <P>
166      * For class NumberUp, the category name is <CODE>"number-up"</CODE>.
167      *
168      * @return Attribute category name.
169      */

170     public final String JavaDoc getName() {
171     return "number-up";
172     }
173
174 }
175
Popular Tags