001 /*
002 * Copyright 2001-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.EnumSyntax;
029 import javax.print.attribute.PrintJobAttribute;
030 import javax.print.attribute.PrintRequestAttribute;
031
032 /**
033 * Class PresentationDirection is a printing attribute class, an enumeration,
034 * that is used in conjunction with the {@link NumberUp NumberUp} attribute to
035 * indicate the layout of multiple print-stream pages to impose upon a
036 * single side of an instance of a selected medium.
037 * This is useful to mirror the text layout conventions of different scripts.
038 * For example, English is "toright-tobottom", Hebrew is "toleft-tobottom"
039 * and Japanese is usually "tobottom-toleft".
040 * <P>
041 * <B>IPP Compatibility:</B> This attribute is not an IPP 1.1
042 * attribute; it is an attribute in the Production Printing Extension
043 * (<a href="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>)
044 * of IPP 1.1. The category name returned by
045 * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
046 * integer value is the IPP enum value. The <code>toString()</code> method
047 * returns the IPP string representation of the attribute value.
048 * <P>
049 *
050 * @author Phil Race.
051 */
052 public final class PresentationDirection extends EnumSyntax implements
053 PrintJobAttribute, PrintRequestAttribute {
054
055 private static final long serialVersionUID = 8294728067230931780L;
056
057 /**
058 * Pages are laid out in columns starting at the top left,
059 * proceeeding towards the bottom & right.
060 */
061 public static final PresentationDirection TOBOTTOM_TORIGHT = new PresentationDirection(
062 0);
063
064 /**
065 * Pages are laid out in columns starting at the top right,
066 * proceeeding towards the bottom & left.
067 */
068 public static final PresentationDirection TOBOTTOM_TOLEFT = new PresentationDirection(
069 1);
070
071 /**
072 * Pages are laid out in columns starting at the bottom left,
073 * proceeeding towards the top & right.
074 */
075 public static final PresentationDirection TOTOP_TORIGHT = new PresentationDirection(
076 2);
077
078 /**
079 * Pages are laid out in columns starting at the bottom right,
080 * proceeeding towards the top & left.
081 */
082 public static final PresentationDirection TOTOP_TOLEFT = new PresentationDirection(
083 3);
084
085 /**
086 * Pages are laid out in rows starting at the top left,
087 * proceeeding towards the right & bottom.
088 */
089 public static final PresentationDirection TORIGHT_TOBOTTOM = new PresentationDirection(
090 4);
091
092 /**
093 * Pages are laid out in rows starting at the bottom left,
094 * proceeeding towards the right & top.
095 */
096 public static final PresentationDirection TORIGHT_TOTOP = new PresentationDirection(
097 5);
098
099 /**
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 = new PresentationDirection(
104 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 = new PresentationDirection(
111 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 = { "tobottom-toright",
124 "tobottom-toleft", "totop-toright", "totop-toleft",
125 "toright-tobottom", "toright-totop", "toleft-tobottom",
126 "toleft-totop", };
127
128 private static final PresentationDirection[] myEnumValueTable = {
129 TOBOTTOM_TORIGHT, TOBOTTOM_TOLEFT, TOTOP_TORIGHT,
130 TOTOP_TOLEFT, TORIGHT_TOBOTTOM, TORIGHT_TOTOP,
131 TOLEFT_TOBOTTOM, TOLEFT_TOTOP, };
132
133 /**
134 * Returns the string table for class PresentationDirection.
135 */
136 protected String[] getStringTable() {
137 return myStringTable;
138 }
139
140 /**
141 * Returns the enumeration value table for class PresentationDirection.
142 */
143 protected EnumSyntax[] getEnumValueTable() {
144 return myEnumValueTable;
145 }
146
147 /**
148 * Get the printing attribute class which is to be used as the "category"
149 * for this printing attribute value.
150 * <P>
151 * For class PresentationDirection
152 * the category is class PresentationDirection itself.
153 *
154 * @return Printing attribute class (category), an instance of class
155 * {@link java.lang.Class java.lang.Class}.
156 */
157 public final Class<? extends Attribute> getCategory() {
158 return PresentationDirection.class;
159 }
160
161 /**
162 * Get the name of the category of which this attribute value is an
163 * instance.
164 * <P>
165 * For class PresentationDirection
166 * the category name is <CODE>"presentation-direction"</CODE>.
167 *
168 * @return Attribute category name.
169 */
170 public final String getName() {
171 return "presentation-direction";
172 }
173
174 }
|