Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/OrientationRequested.java
38918 views
/*1* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.print.attribute.standard;2526import javax.print.attribute.Attribute;27import javax.print.attribute.EnumSyntax;28import javax.print.attribute.DocAttribute;29import javax.print.attribute.PrintRequestAttribute;30import javax.print.attribute.PrintJobAttribute;3132/**33* Class OrientationRequested is a printing attribute class, an enumeration,34* that indicates the desired orientation for printed print-stream pages; it35* does not describe the orientation of the client-supplied print-stream36* pages.37* <P>38* For some document formats (such as <CODE>"application/postscript"</CODE>),39* the desired orientation of the print-stream pages is specified within the40* document data. This information is generated by a device driver prior to41* the submission of the print job. Other document formats (such as42* <CODE>"text/plain"</CODE>) do not include the notion of desired orientation43* within the document data. In the latter case it is possible for the printer44* to bind the desired orientation to the document data after it has been45* submitted. It is expected that a printer would only support the46* OrientationRequested attribute for some document formats (e.g.,47* <CODE>"text/plain"</CODE> or <CODE>"text/html"</CODE>) but not others (e.g.48* <CODE>"application/postscript"</CODE>). This is no different from any other49* job template attribute, since a print job can always impose constraints50* among the values of different job template attributes.51* However, a special mention52* is made here since it is very likely that a printer will support the53* OrientationRequested attribute for only a subset of the supported document54* formats.55* <P>56* <B>IPP Compatibility:</B> The category name returned by57* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's58* integer value is the IPP enum value. The <code>toString()</code> method59* returns the IPP string representation of the attribute value.60* <P>61*62* @author Alan Kaminsky63*/64public final class OrientationRequested extends EnumSyntax65implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {6667private static final long serialVersionUID = -4447437289862822276L;6869/**70* The content will be imaged across the short edge of the medium.71*/72public static final OrientationRequested73PORTRAIT = new OrientationRequested(3);7475/**76* The content will be imaged across the long edge of the medium.77* Landscape is defined to be a rotation of the print-stream page to be78* imaged by +90 degrees with respect to the medium79* (i.e. anti-clockwise) from the80* portrait orientation. <I>Note:</I> The +90 direction was chosen because81* simple finishing on the long edge is the same edge whether portrait or82* landscape.83*/84public static final OrientationRequested85LANDSCAPE = new OrientationRequested(4);8687/**88* The content will be imaged across the long edge of the medium, but in89* the opposite manner from landscape. Reverse-landscape is defined to be90* a rotation of the print-stream page to be imaged by -90 degrees with91* respect to the medium (i.e. clockwise) from the portrait orientation.92* <I>Note:</I> The REVERSE_LANDSCAPE value was added because some93* applications rotate landscape -90 degrees from portrait, rather than94* +90 degrees.95*/96public static final OrientationRequested97REVERSE_LANDSCAPE = new OrientationRequested(5);9899/**100* The content will be imaged across the short edge of the medium, but in101* the opposite manner from portrait. Reverse-portrait is defined to be a102* rotation of the print-stream page to be imaged by 180 degrees with103* respect to the medium from the portrait orientation. <I>Note:</I> The104* REVERSE_PORTRAIT value was added for use with the {@link105* Finishings Finishings} attribute in cases where the106* opposite edge is desired for finishing a portrait document on simple107* finishing devices that have only one finishing position. Thus a108* <CODE>"text/plain"</CODE> portrait document can be stapled "on the109* right" by a simple finishing device as is common use with some110* Middle Eastern languages such as Hebrew.111*/112public static final OrientationRequested113REVERSE_PORTRAIT = new OrientationRequested(6);114115/**116* Construct a new orientation requested enumeration value with the given117* integer value.118*119* @param value Integer value.120*/121protected OrientationRequested(int value) {122super(value);123}124125private static final String[] myStringTable = {126"portrait",127"landscape",128"reverse-landscape",129"reverse-portrait"130};131132private static final OrientationRequested[] myEnumValueTable = {133PORTRAIT,134LANDSCAPE,135REVERSE_LANDSCAPE,136REVERSE_PORTRAIT137};138139/**140* Returns the string table for class OrientationRequested.141*/142protected String[] getStringTable() {143return myStringTable;144}145146/**147* Returns the enumeration value table for class OrientationRequested.148*/149protected EnumSyntax[] getEnumValueTable() {150return myEnumValueTable;151}152153/**154* Returns the lowest integer value used by class OrientationRequested.155*/156protected int getOffset() {157return 3;158}159160/**161* Get the printing attribute class which is to be used as the "category"162* for this printing attribute value.163* <P>164* For class OrientationRequested, the165* category is class OrientationRequested itself.166*167* @return Printing attribute class (category), an instance of class168* {@link java.lang.Class java.lang.Class}.169*/170public final Class<? extends Attribute> getCategory() {171return OrientationRequested.class;172}173174/**175* Get the name of the category of which this attribute value is an176* instance.177* <P>178* For class OrientationRequested, the179* category name is <CODE>"orientation-requested"</CODE>.180*181* @return Attribute category name.182*/183public final String getName() {184return "orientation-requested";185}186187}188189190