001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import javax.print.attribute.Attribute;
028 import javax.print.attribute.IntegerSyntax;
029 import javax.print.attribute.DocAttribute;
030 import javax.print.attribute.PrintRequestAttribute;
031 import javax.print.attribute.PrintJobAttribute;
032
033 /**
034 * Class NumberUp is an integer valued printing attribute class that specifies
035 * the number of print-stream pages to impose upon a single side of an
036 * instance of a selected medium. That is, if the NumberUp value is <I>n,</I>
037 * the printer must place <I>n</I> print-stream pages on a single side of
038 * an instance of the
039 * selected medium. To accomplish this, the printer may add some sort of
040 * translation, scaling, or rotation. This attribute primarily controls the
041 * translation, scaling and rotation of print-stream pages.
042 * <P>
043 * The effect of a NumberUp attribute on a multidoc print job (a job with
044 * multiple documents) depends on whether all the docs have the same number up
045 * values specified or whether different docs have different number up values
046 * specified, and on the (perhaps defaulted) value of the {@link
047 * MultipleDocumentHandling MultipleDocumentHandling} attribute.
048 * <UL>
049 * <LI>
050 * If all the docs have the same number up value <I>n</I> specified, then any
051 * value of {@link MultipleDocumentHandling MultipleDocumentHandling} makes
052 * sense, and the printer's processing depends on the {@link
053 * MultipleDocumentHandling MultipleDocumentHandling} value:
054 * <UL>
055 * <LI>
056 * SINGLE_DOCUMENT -- All the input docs will be combined together into one
057 * output document. Each media impression will consist of <I>n</I>m
058 * print-stream pages from the output document.
059 * <P>
060 * <LI>
061 * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
062 * into one output document. Each media impression will consist of <I>n</I>
063 * print-stream pages from the output document. However, the first impression of
064 * each input doc will always start on a new media sheet; this means the last
065 * impression of an input doc may have fewer than <I>n</I> print-stream pages
066 * on it.
067 * <P>
068 * <LI>
069 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
070 * Each media impression will consist of <I>n</I> print-stream pages from the
071 * input doc. Since the input docs are separate, the first impression of each
072 * input doc will always start on a new media sheet; this means the last
073 * impression of an input doc may have fewer than <I>n</I> print-stream pages on
074 * it.
075 * <P>
076 * <LI>
077 * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
078 * Each media impression will consist of <I>n</I> print-stream pages from the
079 * input doc. Since the input docs are separate, the first impression of each
080 * input doc will always start on a new media sheet; this means the last
081 * impression of an input doc may have fewer than <I>n</I> print-stream pages
082 * on it.
083 * </UL>
084 * <UL>
085 * <LI>
086 * SINGLE_DOCUMENT -- All the input docs will be combined together into one
087 * output document. Each media impression will consist of <I>n<SUB>i</SUB></I>
088 * print-stream pages from the output document, where <I>i</I> is the number of
089 * the input doc corresponding to that point in the output document. When the
090 * next input doc has a different number up value from the previous input doc,
091 * the first print-stream page of the next input doc goes at the start of the
092 * next media impression, possibly leaving fewer than the full number of
093 * print-stream pages on the previous media impression.
094 * <P>
095 * <LI>
096 * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
097 * into one output document. Each media impression will consist of <I>n</I>
098 * print-stream pages from the output document. However, the first impression of
099 * 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 */
127 public final class NumberUp extends IntegerSyntax implements
128 DocAttribute, PrintRequestAttribute, PrintJobAttribute {
129
130 private static final long serialVersionUID = -3040436486786527811L;
131
132 /**
133 * Construct a new number up attribute with the given integer value.
134 *
135 * @param value Integer value.
136 *
137 * @exception IllegalArgumentException
138 * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1.
139 */
140 public NumberUp(int value) {
141 super (value, 1, Integer.MAX_VALUE);
142 }
143
144 /**
145 * Returns whether this number up attribute is equivalent to the passed in
146 * object. To be equivalent, all of the following conditions must be true:
147 * <OL TYPE=1>
148 * <LI>
149 * <CODE>object</CODE> is not null.
150 * <LI>
151 * <CODE>object</CODE> is an instance of class NumberUp.
152 * <LI>
153 * This number up attribute's value and <CODE>object</CODE>'s value are
154 * equal.
155 * </OL>
156 *
157 * @param object Object to compare to.
158 *
159 * @return True if <CODE>object</CODE> is equivalent to this number up
160 * attribute, false otherwise.
161 */
162 public boolean equals(Object object) {
163 return (super .equals(object) && object instanceof NumberUp);
164 }
165
166 /**
167 * Get the printing attribute class which is to be used as the "category"
168 * for this printing attribute value.
169 * <P>
170 * For class NumberUp, the category is class NumberUp itself.
171 *
172 * @return Printing attribute class (category), an instance of class
173 * {@link java.lang.Class java.lang.Class}.
174 */
175 public final Class<? extends Attribute> getCategory() {
176 return NumberUp.class;
177 }
178
179 /**
180 * Get the name of the category of which this attribute value is an
181 * instance.
182 * <P>
183 * For class NumberUp, the category name is <CODE>"number-up"</CODE>.
184 *
185 * @return Attribute category name.
186 */
187 public final String getName() {
188 return "number-up";
189 }
190
191 }
|