Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java
38918 views
/*1* Copyright (c) 2001, 2013, 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.PrintJobAttribute;29import javax.print.attribute.PrintRequestAttribute;3031/**32* Class PresentationDirection is a printing attribute class, an enumeration,33* that is used in conjunction with the {@link NumberUp NumberUp} attribute to34* indicate the layout of multiple print-stream pages to impose upon a35* single side of an instance of a selected medium.36* This is useful to mirror the text layout conventions of different scripts.37* For example, English is "toright-tobottom", Hebrew is "toleft-tobottom"38* and Japanese is usually "tobottom-toleft".39* <P>40* <B>IPP Compatibility:</B> This attribute is not an IPP 1.141* attribute; it is an attribute in the Production Printing Extension42* (<a href="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>)43* of IPP 1.1. The category name returned by44* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's45* integer value is the IPP enum value. The <code>toString()</code> method46* returns the IPP string representation of the attribute value.47* <P>48*49* @author Phil Race.50*/51public final class PresentationDirection extends EnumSyntax52implements PrintJobAttribute, PrintRequestAttribute {5354private static final long serialVersionUID = 8294728067230931780L;5556/**57* Pages are laid out in columns starting at the top left,58* proceeding towards the bottom {@literal &} right.59*/60public static final PresentationDirection TOBOTTOM_TORIGHT =61new PresentationDirection(0);6263/**64* Pages are laid out in columns starting at the top right,65* proceeding towards the bottom {@literal &} left.66*/67public static final PresentationDirection TOBOTTOM_TOLEFT =68new PresentationDirection(1);6970/**71* Pages are laid out in columns starting at the bottom left,72* proceeding towards the top {@literal &} right.73*/74public static final PresentationDirection TOTOP_TORIGHT =75new PresentationDirection(2);7677/**78* Pages are laid out in columns starting at the bottom right,79* proceeding towards the top {@literal &} left.80*/81public static final PresentationDirection TOTOP_TOLEFT =82new PresentationDirection(3);8384/**85* Pages are laid out in rows starting at the top left,86* proceeding towards the right {@literal &} bottom.87*/88public static final PresentationDirection TORIGHT_TOBOTTOM =89new PresentationDirection(4);9091/**92* Pages are laid out in rows starting at the bottom left,93* proceeding towards the right {@literal &} top.94*/95public static final PresentationDirection TORIGHT_TOTOP =96new PresentationDirection(5);9798/**99* Pages are laid out in rows starting at the top right,100* proceeding towards the left {@literal &} bottom.101*/102public static final PresentationDirection TOLEFT_TOBOTTOM =103new PresentationDirection(6);104105/**106* Pages are laid out in rows starting at the bottom right,107* proceeding towards the left {@literal &} top.108*/109public static final PresentationDirection TOLEFT_TOTOP =110new PresentationDirection(7);111112/**113* Construct a new presentation direction enumeration value with the given114* integer value.115*116* @param value Integer value.117*/118private PresentationDirection(int value) {119super (value);120}121122private static final String[] myStringTable = {123"tobottom-toright",124"tobottom-toleft",125"totop-toright",126"totop-toleft",127"toright-tobottom",128"toright-totop",129"toleft-tobottom",130"toleft-totop",131};132133private static final PresentationDirection[] myEnumValueTable = {134TOBOTTOM_TORIGHT,135TOBOTTOM_TOLEFT,136TOTOP_TORIGHT,137TOTOP_TOLEFT,138TORIGHT_TOBOTTOM,139TORIGHT_TOTOP,140TOLEFT_TOBOTTOM,141TOLEFT_TOTOP,142};143144/**145* Returns the string table for class PresentationDirection.146*/147protected String[] getStringTable() {148return myStringTable;149}150151/**152* Returns the enumeration value table for class PresentationDirection.153*/154protected EnumSyntax[] getEnumValueTable() {155return myEnumValueTable;156}157158/**159* Get the printing attribute class which is to be used as the "category"160* for this printing attribute value.161* <P>162* For class PresentationDirection163* the category is class PresentationDirection itself.164*165* @return Printing attribute class (category), an instance of class166* {@link java.lang.Class java.lang.Class}.167*/168public final Class<? extends Attribute> getCategory() {169return PresentationDirection.class;170}171172/**173* Get the name of the category of which this attribute value is an174* instance.175* <P>176* For class PresentationDirection177* the category name is <CODE>"presentation-direction"</CODE>.178*179* @return Attribute category name.180*/181public final String getName() {182return "presentation-direction";183}184185}186187188