blob: c47fe47e7f4e0dd909659ae011491245834c82c1 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2001-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.EnumSyntax;
29import javax.print.attribute.PrintJobAttribute;
30import javax.print.attribute.PrintRequestAttribute;
31
32/**
33 * Class PresentationDirection is a printing attribute class, an enumeration,
34 * that is used in conjunction with the {@link NumberUp NumberUp} attribute to
35 * indicate the layout of multiple print-stream pages to impose upon a
36 * single side of an instance of a selected medium.
37 * This is useful to mirror the text layout conventions of different scripts.
38 * For example, English is "toright-tobottom", Hebrew is "toleft-tobottom"
39 * and Japanese is usually "tobottom-toleft".
40 * <P>
41 * <B>IPP Compatibility:</B> This attribute is not an IPP 1.1
42 * attribute; it is an attribute in the Production Printing Extension
43 * (<a href="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>)
44 * of IPP 1.1. The category name returned by
45 * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
46 * integer value is the IPP enum value. The <code>toString()</code> method
47 * returns the IPP string representation of the attribute value.
48 * <P>
49 *
50 * @author Phil Race.
51 */
52public final class PresentationDirection extends EnumSyntax
53 implements PrintJobAttribute, PrintRequestAttribute {
54
55 private static final long serialVersionUID = 8294728067230931780L;
56
57 /**
58 * Pages are laid out in columns starting at the top left,
59 * proceeeding towards the bottom & right.
60 */
61 public static final PresentationDirection TOBOTTOM_TORIGHT =
62 new PresentationDirection(0);
63
64 /**
65 * Pages are laid out in columns starting at the top right,
66 * proceeeding towards the bottom & left.
67 */
68 public static final PresentationDirection TOBOTTOM_TOLEFT =
69 new PresentationDirection(1);
70
71 /**
72 * Pages are laid out in columns starting at the bottom left,
73 * proceeeding towards the top & right.
74 */
75 public static final PresentationDirection TOTOP_TORIGHT =
76 new PresentationDirection(2);
77
78 /**
79 * Pages are laid out in columns starting at the bottom right,
80 * proceeeding towards the top & left.
81 */
82 public static final PresentationDirection TOTOP_TOLEFT =
83 new PresentationDirection(3);
84
85 /**
86 * Pages are laid out in rows starting at the top left,
87 * proceeeding towards the right & bottom.
88 */
89 public static final PresentationDirection TORIGHT_TOBOTTOM =
90 new PresentationDirection(4);
91
92 /**
93 * Pages are laid out in rows starting at the bottom left,
94 * proceeeding towards the right & top.
95 */
96 public static final PresentationDirection TORIGHT_TOTOP =
97 new PresentationDirection(5);
98
99 /**
100 * Pages are laid out in rows starting at the top right,
101 * proceeeding towards the left & bottom.
102 */
103 public static final PresentationDirection TOLEFT_TOBOTTOM =
104 new PresentationDirection(6);
105
106 /**
107 * Pages are laid out in rows starting at the bottom right,
108 * proceeeding towards the left & top.
109 */
110 public static final PresentationDirection TOLEFT_TOTOP =
111 new PresentationDirection(7);
112
113 /**
114 * Construct a new presentation direction enumeration value with the given
115 * integer value.
116 *
117 * @param value Integer value.
118 */
119 private PresentationDirection(int value) {
120 super (value);
121 }
122
123 private static final String[] myStringTable = {
124 "tobottom-toright",
125 "tobottom-toleft",
126 "totop-toright",
127 "totop-toleft",
128 "toright-tobottom",
129 "toright-totop",
130 "toleft-tobottom",
131 "toleft-totop",
132 };
133
134 private static final PresentationDirection[] myEnumValueTable = {
135 TOBOTTOM_TORIGHT,
136 TOBOTTOM_TOLEFT,
137 TOTOP_TORIGHT,
138 TOTOP_TOLEFT,
139 TORIGHT_TOBOTTOM,
140 TORIGHT_TOTOP,
141 TOLEFT_TOBOTTOM,
142 TOLEFT_TOTOP,
143 };
144
145 /**
146 * Returns the string table for class PresentationDirection.
147 */
148 protected String[] getStringTable() {
149 return myStringTable;
150 }
151
152 /**
153 * Returns the enumeration value table for class PresentationDirection.
154 */
155 protected EnumSyntax[] getEnumValueTable() {
156 return myEnumValueTable;
157 }
158
159 /**
160 * Get the printing attribute class which is to be used as the "category"
161 * for this printing attribute value.
162 * <P>
163 * For class PresentationDirection
164 * the category is class PresentationDirection itself.
165 *
166 * @return Printing attribute class (category), an instance of class
167 * {@link java.lang.Class java.lang.Class}.
168 */
169 public final Class<? extends Attribute> getCategory() {
170 return PresentationDirection.class;
171 }
172
173 /**
174 * Get the name of the category of which this attribute value is an
175 * instance.
176 * <P>
177 * For class PresentationDirection
178 * the category name is <CODE>"presentation-direction"</CODE>.
179 *
180 * @return Attribute category name.
181 */
182 public final String getName() {
183 return "presentation-direction";
184 }
185
186}