KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > PresentationDirection


1 /*
2  * @(#)PresentationDirection.java 1.7 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.print.attribute.standard;
8
9 import javax.print.attribute.Attribute JavaDoc;
10 import javax.print.attribute.EnumSyntax JavaDoc;
11 import javax.print.attribute.PrintJobAttribute JavaDoc;
12 import javax.print.attribute.PrintRequestAttribute JavaDoc;
13
14 /**
15  * Class PresentationDirection is a printing attribute class, an enumeration,
16  * that is used in conjunction with the {@link NumberUp NumberUp} attribute to
17  * indicate the layout of multiple print-stream pages to impose upon a
18  * single side of an instance of a selected medium.
19  * This is useful to mirror the text layout conventions of different scripts.
20  * For example, English is "toright-tobottom", Hebrew is "toleft-tobottom"
21  * and Japanese is usually "tobottom-toleft".
22  * <P>
23  * <B>IPP Compatibility:</B> This attribute is not an IPP 1.1
24  * attribute; it is an attribute in the Production Printing Extension
25  * (<a HREF="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>)
26  * of IPP 1.1. The category name returned by
27  * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
28  * integer value is the IPP enum value. The <code>toString()</code> method
29  * returns the IPP string representation of the attribute value.
30  * <P>
31  *
32  * @author Phil Race.
33  */

34 public final class PresentationDirection extends EnumSyntax JavaDoc
35        implements PrintJobAttribute JavaDoc, PrintRequestAttribute JavaDoc {
36
37     private static final long serialVersionUID = 8294728067230931780L;
38
39     /**
40      * Pages are laid out in columns starting at the top left,
41      * proceeeding towards the bottom & right.
42      */

43     public static final PresentationDirection JavaDoc TOBOTTOM_TORIGHT =
44         new PresentationDirection JavaDoc(0);
45
46     /**
47      * Pages are laid out in columns starting at the top right,
48      * proceeeding towards the bottom & left.
49      */

50     public static final PresentationDirection JavaDoc TOBOTTOM_TOLEFT =
51         new PresentationDirection JavaDoc(1);
52
53     /**
54      * Pages are laid out in columns starting at the bottom left,
55      * proceeeding towards the top & right.
56      */

57     public static final PresentationDirection JavaDoc TOTOP_TORIGHT =
58         new PresentationDirection JavaDoc(2);
59
60     /**
61      * Pages are laid out in columns starting at the bottom right,
62      * proceeeding towards the top & left.
63      */

64     public static final PresentationDirection JavaDoc TOTOP_TOLEFT =
65         new PresentationDirection JavaDoc(3);
66
67     /**
68      * Pages are laid out in rows starting at the top left,
69      * proceeeding towards the right & bottom.
70      */

71     public static final PresentationDirection JavaDoc TORIGHT_TOBOTTOM =
72         new PresentationDirection JavaDoc(4);
73
74     /**
75      * Pages are laid out in rows starting at the bottom left,
76      * proceeeding towards the right & top.
77      */

78     public static final PresentationDirection JavaDoc TORIGHT_TOTOP =
79         new PresentationDirection JavaDoc(5);
80
81     /**
82      * Pages are laid out in rows starting at the top right,
83      * proceeeding towards the left & bottom.
84      */

85     public static final PresentationDirection JavaDoc TOLEFT_TOBOTTOM =
86         new PresentationDirection JavaDoc(6);
87
88     /**
89      * Pages are laid out in rows starting at the bottom right,
90      * proceeeding towards the left & top.
91      */

92     public static final PresentationDirection JavaDoc TOLEFT_TOTOP =
93         new PresentationDirection JavaDoc(7);
94
95     /**
96      * Construct a new presentation direction enumeration value with the given
97      * integer value.
98      *
99      * @param value Integer value.
100      */

101     private PresentationDirection(int value) {
102     super (value);
103     }
104
105     private static final String JavaDoc[] myStringTable = {
106     "tobottom-toright",
107     "tobottom-toleft",
108     "totop-toright",
109     "totop-toleft",
110     "toright-tobottom",
111     "toright-totop",
112     "toleft-tobottom",
113     "toleft-totop",
114     };
115
116     private static final PresentationDirection JavaDoc[] myEnumValueTable = {
117     TOBOTTOM_TORIGHT,
118     TOBOTTOM_TOLEFT,
119     TOTOP_TORIGHT,
120     TOTOP_TOLEFT,
121     TORIGHT_TOBOTTOM,
122     TORIGHT_TOTOP,
123     TOLEFT_TOBOTTOM,
124     TOLEFT_TOTOP,
125     };
126
127     /**
128      * Returns the string table for class PresentationDirection.
129      */

130     protected String JavaDoc[] getStringTable() {
131     return myStringTable;
132     }
133
134     /**
135      * Returns the enumeration value table for class PresentationDirection.
136      */

137     protected EnumSyntax JavaDoc[] getEnumValueTable() {
138     return myEnumValueTable;
139     }
140
141     /**
142      * Get the printing attribute class which is to be used as the "category"
143      * for this printing attribute value.
144      * <P>
145      * For class PresentationDirection
146      * the category is class PresentationDirection itself.
147      *
148      * @return Printing attribute class (category), an instance of class
149      * {@link java.lang.Class java.lang.Class}.
150      */

151     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
152     return PresentationDirection JavaDoc.class;
153     }
154
155     /**
156      * Get the name of the category of which this attribute value is an
157      * instance.
158      * <P>
159      * For class PresentationDirection
160      * the category name is <CODE>"presentation-direction"</CODE>.
161      *
162      * @return Attribute category name.
163      */

164     public final String JavaDoc getName() {
165     return "presentation-direction";
166     }
167
168 }
169
Popular Tags