Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/OrientationRequested.java
41171 views
1
/*
2
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. 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. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.print.attribute.standard;
27
28
import java.io.Serial;
29
30
import javax.print.attribute.Attribute;
31
import javax.print.attribute.DocAttribute;
32
import javax.print.attribute.EnumSyntax;
33
import javax.print.attribute.PrintJobAttribute;
34
import javax.print.attribute.PrintRequestAttribute;
35
36
/**
37
* Class {@code OrientationRequested} is a printing attribute class, an
38
* enumeration, that indicates the desired orientation for printed print-stream
39
* pages; it does not describe the orientation of the client-supplied
40
* print-stream pages.
41
* <p>
42
* For some document formats (such as {@code "application/postscript"}), the
43
* desired orientation of the print-stream pages is specified within the
44
* document data. This information is generated by a device driver prior to the
45
* submission of the print job. Other document formats (such as
46
* {@code "text/plain"}) do not include the notion of desired orientation within
47
* the document data. In the latter case it is possible for the printer to bind
48
* the desired orientation to the document data after it has been submitted. It
49
* is expected that a printer would only support the
50
* {@code OrientationRequested} attribute for some document formats (e.g.,
51
* {@code "text/plain"} or {@code "text/html"}) but not others (e.g.
52
* {@code "application/postscript"}). This is no different from any other job
53
* template attribute, since a print job can always impose constraints among the
54
* values of different job template attributes. However, a special mention is
55
* made here since it is very likely that a printer will support the
56
* {@code OrientationRequested} attribute for only a subset of the supported
57
* document formats.
58
* <p>
59
* <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
60
* the IPP attribute name. The enumeration's integer value is the IPP enum
61
* value. The {@code toString()} method returns the IPP string representation of
62
* the attribute value.
63
*
64
* @author Alan Kaminsky
65
*/
66
public final class OrientationRequested extends EnumSyntax
67
implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
68
69
/**
70
* Use serialVersionUID from JDK 1.4 for interoperability.
71
*/
72
@Serial
73
private static final long serialVersionUID = -4447437289862822276L;
74
75
/**
76
* The content will be imaged across the short edge of the medium.
77
*/
78
public static final OrientationRequested
79
PORTRAIT = new OrientationRequested(3);
80
81
/**
82
* The content will be imaged across the long edge of the medium. Landscape
83
* is defined to be a rotation of the print-stream page to be imaged by +90
84
* degrees with respect to the medium (i.e. anti-clockwise) from the
85
* portrait orientation. <i>Note:</i> The +90 direction was chosen because
86
* simple finishing on the long edge is the same edge whether portrait or
87
* landscape.
88
*/
89
public static final OrientationRequested
90
LANDSCAPE = new OrientationRequested(4);
91
92
/**
93
* The content will be imaged across the long edge of the medium, but in the
94
* opposite manner from landscape. Reverse-landscape is defined to be a
95
* rotation of the print-stream page to be imaged by -90 degrees with
96
* respect to the medium (i.e. clockwise) from the portrait orientation.
97
* <i>Note:</i> The REVERSE_LANDSCAPE value was added because some
98
* applications rotate landscape -90 degrees from portrait, rather than +90
99
* degrees.
100
*/
101
public static final OrientationRequested
102
REVERSE_LANDSCAPE = new OrientationRequested(5);
103
104
/**
105
* The content will be imaged across the short edge of the medium, but in
106
* the opposite manner from portrait. Reverse-portrait is defined to be a
107
* rotation of the print-stream page to be imaged by 180 degrees with
108
* respect to the medium from the portrait orientation. <i>Note:</i> The
109
* REVERSE_PORTRAIT value was added for use with the
110
* {@link Finishings Finishings} attribute in cases where the opposite edge
111
* is desired for finishing a portrait document on simple finishing devices
112
* that have only one finishing position. Thus a {@code "text/plain"}
113
* portrait document can be stapled "on the right" by a simple finishing
114
* device as is common use with some Middle Eastern languages such as
115
* Hebrew.
116
*/
117
public static final OrientationRequested
118
REVERSE_PORTRAIT = new OrientationRequested(6);
119
120
/**
121
* Construct a new orientation requested enumeration value with the given
122
* integer value.
123
*
124
* @param value Integer value
125
*/
126
protected OrientationRequested(int value) {
127
super(value);
128
}
129
130
/**
131
* The string table for class {@code OrientationRequested}.
132
*/
133
private static final String[] myStringTable = {
134
"portrait",
135
"landscape",
136
"reverse-landscape",
137
"reverse-portrait"
138
};
139
140
/**
141
* The enumeration value table for class {@code OrientationRequested}.
142
*/
143
private static final OrientationRequested[] myEnumValueTable = {
144
PORTRAIT,
145
LANDSCAPE,
146
REVERSE_LANDSCAPE,
147
REVERSE_PORTRAIT
148
};
149
150
/**
151
* Returns the string table for class {@code OrientationRequested}.
152
*/
153
protected String[] getStringTable() {
154
return myStringTable;
155
}
156
157
/**
158
* Returns the enumeration value table for class
159
* {@code OrientationRequested}.
160
*/
161
protected EnumSyntax[] getEnumValueTable() {
162
return myEnumValueTable;
163
}
164
165
/**
166
* Returns the lowest integer value used by class
167
* {@code OrientationRequested}.
168
*/
169
protected int getOffset() {
170
return 3;
171
}
172
173
/**
174
* Get the printing attribute class which is to be used as the "category"
175
* for this printing attribute value.
176
* <p>
177
* For class {@code OrientationRequested}, the category is class
178
* {@code OrientationRequested} itself.
179
*
180
* @return printing attribute class (category), an instance of class
181
* {@link Class java.lang.Class}
182
*/
183
public final Class<? extends Attribute> getCategory() {
184
return OrientationRequested.class;
185
}
186
187
/**
188
* Get the name of the category of which this attribute value is an
189
* instance.
190
* <p>
191
* For class {@code OrientationRequested}, the category name is
192
* {@code "orientation-requested"}.
193
*
194
* @return attribute category name
195
*/
196
public final String getName() {
197
return "orientation-requested";
198
}
199
}
200
201