1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
/* * @(#)Sides.java 1.9 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintJobAttribute; /** * Class Sides is a printing attribute class, an enumeration, that specifies * how print-stream pages are to be imposed upon the sides of an instance of a * selected medium, i.e., an impression. * <P> * The effect of a Sides attribute on a multidoc print job (a job with multiple * documents) depends on whether all the docs have the same sides values * specified or whether different docs have different sides values specified, * and on the (perhaps defaulted) value of the {@link MultipleDocumentHandling * MultipleDocumentHandling} attribute. * <UL> * <LI> * If all the docs have the same sides value <I>n</I> specified, then any value * of {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense, * and the printer's processing depends on the {@link MultipleDocumentHandling * MultipleDocumentHandling} value: * <UL> * <LI> * SINGLE_DOCUMENT -- All the input docs will be combined together into one * output document. Each media sheet will consist of <I>n</I> impressions from * the output document. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together * into one output document. Each media sheet will consist of <I>n</I> * impressions from the output document. However, the first impression of each * input doc will always start on a new media sheet; this means the last media * sheet of an input doc may have only one impression on it. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. * Each media sheet will consist of <I>n</I> impressions from the input doc. * Since the input docs are separate, the first impression of each input doc * will always start on a new media sheet; this means the last media sheet of * an input doc may have only one impression on it. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. * Each media sheet will consist of <I>n</I> impressions from the input doc. * Since the input docs are separate, the first impression of each input doc * will always start on a new media sheet; this means the last media sheet of * an input doc may have only one impression on it. * </UL> * <P> * <UL> * <LI> * SINGLE_DOCUMENT -- All the input docs will be combined together into one * output document. Each media sheet will consist of <I>n<SUB>i</SUB></I> * impressions from the output document, where <I>i</I> is the number of the * input doc corresponding to that point in the output document. When the next * input doc has a different sides value from the previous input doc, the first * print-stream page of the next input doc goes at the start of the next media * sheet, possibly leaving only one impression on the previous media sheet. * <P> * <LI> * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together * into one output document. Each media sheet will consist of <I>n</I> * impressions from the output document. However, the first impression of each * input doc will always start on a new media sheet; this means the last * impression of an input doc may have only one impression on it. * <P> * <LI> * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. * For input doc <I>i,</I> each media sheet will consist of <I>n<SUB>i</SUB></I> * impressions from the input doc. Since the input docs are separate, the first * impression of each input doc will always start on a new media sheet; this * means the last media sheet of an input doc may have only one impression on * it. * <P> * <LI> * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. * For input doc <I>i,</I> each media sheet will consist of <I>n<SUB>i</SUB></I> * impressions from the input doc. Since the input docs are separate, the first * impression of each input doc will always start on a new media sheet; this * means the last media sheet of an input doc may have only one impression on * it. * </UL> * </UL> * <P> * <B>IPP Compatibility:</B> The category name returned by * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's * integer value is the IPP enum value. The <code>toString()</code> method * returns the IPP string representation of the attribute value. * <P> * * @author Alan Kaminsky */ public final class Sides extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { private static final long serialVersionUID = -6890309414893262822L; /** * Imposes each consecutive print-stream page upon the same side of * consecutive media sheets. */ public static final Sides ONE_SIDED = new Sides(0); /** * Imposes each consecutive pair of print-stream pages upon front and back * sides of consecutive media sheets, such that the orientation of each * pair of print-stream pages on the medium would be correct for the * reader as if for binding on the long edge. This imposition is also * known as "duplex" (see {@link #DUPLEX <CODE>DUPLEX</CODE>}). */ public static final Sides TWO_SIDED_LONG_EDGE = new Sides(1); /** * Imposes each consecutive pair of print-stream pages upon front and back * sides of consecutive media sheets, such that the orientation of each * pair of print-stream pages on the medium would be correct for the * reader as if for binding on the short edge. This imposition is also * known as "tumble" (see {@link #TUMBLE <CODE>TUMBLE</CODE>}). */ public static final Sides TWO_SIDED_SHORT_EDGE = new Sides(2); /** * An alias for "two sided long edge" (see {@link #TWO_SIDED_LONG_EDGE * <CODE>TWO_SIDED_LONG_EDGE</CODE>}). */ public static final Sides DUPLEX = TWO_SIDED_LONG_EDGE; /** * An alias for "two sided short edge" (see {@link #TWO_SIDED_SHORT_EDGE * <CODE>TWO_SIDED_SHORT_EDGE</CODE>}). */ public static final Sides TUMBLE = TWO_SIDED_SHORT_EDGE; /** * Construct a new sides enumeration value with the given integer value. * * @param value Integer value. */ protected Sides(int value) { super (value); } private static final String[] myStringTable = { "one-sided", "two-sided-long-edge", "two-sided-short-edge" }; private static final Sides[] myEnumValueTable = { ONE_SIDED, TWO_SIDED_LONG_EDGE, TWO_SIDED_SHORT_EDGE }; /** * Returns the string table for class Sides. */ protected String[] getStringTable() { return myStringTable; } /** * Returns the enumeration value table for class Sides. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Sides, the category is class Sides itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Sides.class; } /** * Get the name of the category of which this attribute value is an * instance. * <P> * For class Sides, the category name is <CODE>"sides"</CODE>. * * @return Attribute category name. */ public final String getName() { return "sides"; } }