KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)OrientationRequested.java 1.9 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.DocAttribute JavaDoc;
12 import javax.print.attribute.PrintRequestAttribute JavaDoc;
13 import javax.print.attribute.PrintJobAttribute JavaDoc;
14
15 /**
16  * Class OrientationRequested is a printing attribute class, an enumeration,
17  * that indicates the desired orientation for printed print-stream pages; it
18  * does not describe the orientation of the client-supplied print-stream
19  * pages.
20  * <P>
21  * For some document formats (such as <CODE>"application/postscript"</CODE>),
22  * the desired orientation of the print-stream pages is specified within the
23  * document data. This information is generated by a device driver prior to
24  * the submission of the print job. Other document formats (such as
25  * <CODE>"text/plain"</CODE>) do not include the notion of desired orientation
26  * within the document data. In the latter case it is possible for the printer
27  * to bind the desired orientation to the document data after it has been
28  * submitted. It is expected that a printer would only support the
29  * OrientationRequested attribute for some document formats (e.g.,
30  * <CODE>"text/plain"</CODE> or <CODE>"text/html"</CODE>) but not others (e.g.
31  * <CODE>"application/postscript"</CODE>). This is no different from any other
32  * job template attribute, since a print job can always impose constraints
33  * among the values of different job template attributes.
34  * However, a special mention
35  * is made here since it is very likely that a printer will support the
36  * OrientationRequested attribute for only a subset of the supported document
37  * formats.
38  * <P>
39  * <B>IPP Compatibility:</B> The category name returned by
40  * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
41  * integer value is the IPP enum value. The <code>toString()</code> method
42  * returns the IPP string representation of the attribute value.
43  * <P>
44  *
45  * @author Alan Kaminsky
46  */

47 public final class OrientationRequested extends EnumSyntax JavaDoc
48     implements DocAttribute JavaDoc, PrintRequestAttribute JavaDoc, PrintJobAttribute JavaDoc {
49
50     private static final long serialVersionUID = -4447437289862822276L;
51
52     /**
53      * The content will be imaged across the short edge of the medium.
54      */

55     public static final OrientationRequested JavaDoc
56     PORTRAIT = new OrientationRequested JavaDoc(3);
57
58     /**
59      * The content will be imaged across the long edge of the medium.
60      * Landscape is defined to be a rotation of the print-stream page to be
61      * imaged by +90 degrees with respect to the medium
62      * (i.e. anti-clockwise) from the
63      * portrait orientation. <I>Note:</I> The +90 direction was chosen because
64      * simple finishing on the long edge is the same edge whether portrait or
65      * landscape.
66      */

67     public static final OrientationRequested JavaDoc
68     LANDSCAPE = new OrientationRequested JavaDoc(4);
69
70     /**
71      * The content will be imaged across the long edge of the medium, but in
72      * the opposite manner from landscape. Reverse-landscape is defined to be
73      * a rotation of the print-stream page to be imaged by -90 degrees with
74      * respect to the medium (i.e. clockwise) from the portrait orientation.
75      * <I>Note:</I> The REVERSE_LANDSCAPE value was added because some
76      * applications rotate landscape -90 degrees from portrait, rather than
77      * +90 degrees.
78      */

79     public static final OrientationRequested JavaDoc
80     REVERSE_LANDSCAPE = new OrientationRequested JavaDoc(5);
81
82     /**
83      * The content will be imaged across the short edge of the medium, but in
84      * the opposite manner from portrait. Reverse-portrait is defined to be a
85      * rotation of the print-stream page to be imaged by 180 degrees with
86      * respect to the medium from the portrait orientation. <I>Note:</I> The
87      * REVERSE_PORTRAIT value was added for use with the {@link
88      * Finishings Finishings} attribute in cases where the
89      * opposite edge is desired for finishing a portrait document on simple
90      * finishing devices that have only one finishing position. Thus a
91      * <CODE>"text/plain"</CODE> portrait document can be stapled "on the
92      * right" by a simple finishing device as is common use with some
93      * Middle Eastern languages such as Hebrew.
94      */

95     public static final OrientationRequested JavaDoc
96     REVERSE_PORTRAIT = new OrientationRequested JavaDoc(6);
97
98     /**
99      * Construct a new orientation requested enumeration value with the given
100      * integer value.
101      *
102      * @param value Integer value.
103      */

104     protected OrientationRequested(int value) {
105     super(value);
106     }
107
108     private static final String JavaDoc[] myStringTable = {
109     "portrait",
110     "landscape",
111     "reverse-landscape",
112     "reverse-portrait"
113     };
114
115     private static final OrientationRequested JavaDoc[] myEnumValueTable = {
116     PORTRAIT,
117     LANDSCAPE,
118     REVERSE_LANDSCAPE,
119     REVERSE_PORTRAIT
120     };
121
122     /**
123      * Returns the string table for class OrientationRequested.
124      */

125     protected String JavaDoc[] getStringTable() {
126     return myStringTable;
127     }
128
129     /**
130      * Returns the enumeration value table for class OrientationRequested.
131      */

132     protected EnumSyntax JavaDoc[] getEnumValueTable() {
133     return myEnumValueTable;
134     }
135
136     /**
137      * Returns the lowest integer value used by class OrientationRequested.
138      */

139     protected int getOffset() {
140     return 3;
141     }
142
143     /**
144      * Get the printing attribute class which is to be used as the "category"
145      * for this printing attribute value.
146      * <P>
147      * For class OrientationRequested, the
148      * category is class OrientationRequested itself.
149      *
150      * @return Printing attribute class (category), an instance of class
151      * {@link java.lang.Class java.lang.Class}.
152      */

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

166     public final String JavaDoc getName() {
167     return "orientation-requested";
168     }
169
170 }
171
Popular Tags