blob: 711cf6cb216c95b15e48aaaf03b10ff5620153e5 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25package javax.print.attribute.standard;
26
27import javax.print.attribute.Attribute;
28import javax.print.attribute.IntegerSyntax;
29import javax.print.attribute.DocAttribute;
30import javax.print.attribute.PrintRequestAttribute;
31import javax.print.attribute.PrintJobAttribute;
32
33/**
34 * Class NumberUp is an integer valued printing attribute class that specifies
35 * the number of print-stream pages to impose upon a single side of an
36 * instance of a selected medium. That is, if the NumberUp value is <I>n,</I>
37 * the printer must place <I>n</I> print-stream pages on a single side of
38 * an instance of the
39 * selected medium. To accomplish this, the printer may add some sort of
40 * translation, scaling, or rotation. This attribute primarily controls the
41 * translation, scaling and rotation of print-stream pages.
42 * <P>
43 * The effect of a NumberUp attribute on a multidoc print job (a job with
44 * multiple documents) depends on whether all the docs have the same number up
45 * values specified or whether different docs have different number up values
46 * specified, and on the (perhaps defaulted) value of the {@link
47 * MultipleDocumentHandling MultipleDocumentHandling} attribute.
48 * <UL>
49 * <LI>
50 * If all the docs have the same number up value <I>n</I> specified, then any
51 * value of {@link MultipleDocumentHandling MultipleDocumentHandling} makes
52 * sense, and the printer's processing depends on the {@link
53 * MultipleDocumentHandling MultipleDocumentHandling} value:
54 * <UL>
55 * <LI>
56 * SINGLE_DOCUMENT -- All the input docs will be combined together into one
57 * output document. Each media impression will consist of <I>n</I>m
58 * print-stream pages from the output document.
59 * <P>
60 * <LI>
61 * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
62 * into one output document. Each media impression will consist of <I>n</I>
63 * print-stream pages from the output document. However, the first impression of
64 * each input doc will always start on a new media sheet; this means the last
65 * impression of an input doc may have fewer than <I>n</I> print-stream pages
66 * on it.
67 * <P>
68 * <LI>
69 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
70 * Each media impression will consist of <I>n</I> print-stream pages from the
71 * input doc. Since the input docs are separate, the first impression of each
72 * input doc will always start on a new media sheet; this means the last
73 * impression of an input doc may have fewer than <I>n</I> print-stream pages on
74 * it.
75 * <P>
76 * <LI>
77 * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
78 * Each media impression will consist of <I>n</I> print-stream pages from the
79 * input doc. Since the input docs are separate, the first impression of each
80 * input doc will always start on a new media sheet; this means the last
81 * impression of an input doc may have fewer than <I>n</I> print-stream pages
82 * on it.
83 * </UL>
84 * <UL>
85 * <LI>
86 * SINGLE_DOCUMENT -- All the input docs will be combined together into one
87 * output document. Each media impression will consist of <I>n<SUB>i</SUB></I>
88 * print-stream pages from the output document, where <I>i</I> is the number of
89 * the input doc corresponding to that point in the output document. When the
90 * next input doc has a different number up value from the previous input doc,
91 * the first print-stream page of the next input doc goes at the start of the
92 * next media impression, possibly leaving fewer than the full number of
93 * print-stream pages on the previous media impression.
94 * <P>
95 * <LI>
96 * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
97 * into one output document. Each media impression will consist of <I>n</I>
98 * print-stream pages from the output document. However, the first impression of
99 * each input doc will always start on a new media sheet; this means the last
100 * impression of an input doc may have fewer than <I>n</I> print-stream pages
101 * on it.
102 * <P>
103 * <LI>
104 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
105 * For input doc <I>i,</I> each media impression will consist of
106 * <I>n<SUB>i</SUB></I> print-stream pages from the input doc. Since the input
107 * docs are separate, the first impression of each input doc will always start
108 * on a new media sheet; this means the last impression of an input doc may have
109 * fewer than <I>n<SUB>i</SUB></I> print-stream pages on it.
110 * <P>
111 * <LI>
112 * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
113 * For input doc <I>i,</I> each media impression will consist of
114 * <I>n<SUB>i</SUB></I> print-stream pages from the input doc. Since the input
115 * docs are separate, the first impression of each input doc will always start
116 * on a new media sheet; this means the last impression of an input doc may
117 * have fewer than <I>n<SUB>i</SUB></I> print-stream pages on it.
118 * </UL>
119 * </UL>
120 * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
121 * The category name returned by <CODE>getName()</CODE> gives the IPP
122 * attribute name.
123 * <P>
124 *
125 * @author Alan Kaminsky
126 */
127public final class NumberUp extends IntegerSyntax
128 implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
129
130 private static final long serialVersionUID = -3040436486786527811L;
131
132
133 /**
134 * Construct a new number up attribute with the given integer value.
135 *
136 * @param value Integer value.
137 *
138 * @exception IllegalArgumentException
139 * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1.
140 */
141 public NumberUp(int value) {
142 super (value, 1, Integer.MAX_VALUE);
143 }
144
145 /**
146 * Returns whether this number up attribute is equivalent to the passed in
147 * object. To be equivalent, all of the following conditions must be true:
148 * <OL TYPE=1>
149 * <LI>
150 * <CODE>object</CODE> is not null.
151 * <LI>
152 * <CODE>object</CODE> is an instance of class NumberUp.
153 * <LI>
154 * This number up attribute's value and <CODE>object</CODE>'s value are
155 * equal.
156 * </OL>
157 *
158 * @param object Object to compare to.
159 *
160 * @return True if <CODE>object</CODE> is equivalent to this number up
161 * attribute, false otherwise.
162 */
163 public boolean equals(Object object) {
164 return (super.equals(object) && object instanceof NumberUp);
165 }
166
167 /**
168 * Get the printing attribute class which is to be used as the "category"
169 * for this printing attribute value.
170 * <P>
171 * For class NumberUp, the category is class NumberUp itself.
172 *
173 * @return Printing attribute class (category), an instance of class
174 * {@link java.lang.Class java.lang.Class}.
175 */
176 public final Class<? extends Attribute> getCategory() {
177 return NumberUp.class;
178 }
179
180 /**
181 * Get the name of the category of which this attribute value is an
182 * instance.
183 * <P>
184 * For class NumberUp, the category name is <CODE>"number-up"</CODE>.
185 *
186 * @return Attribute category name.
187 */
188 public final String getName() {
189 return "number-up";
190 }
191
192}