1 /* 2 * Copyright (c) 2001, 2014, 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 package javax.print.attribute.standard; 26 27 import javax.print.attribute.Attribute; 28 import javax.print.attribute.EnumSyntax; 29 import javax.print.attribute.PrintJobAttribute; 30 import javax.print.attribute.PrintRequestAttribute; 31 32 /** 33 * Class PresentationDirection is a printing attribute class, an enumeration, 34 * that is used in conjunction with the {@link NumberUp NumberUp} attribute to 35 * indicate the layout of multiple print-stream pages to impose upon a 36 * single side of an instance of a selected medium. 37 * This is useful to mirror the text layout conventions of different scripts. 38 * For example, English is "toright-tobottom", Hebrew is "toleft-tobottom" 39 * and Japanese is usually "tobottom-toleft". 40 * <P> 41 * <B>IPP Compatibility:</B> This attribute is not an IPP 1.1 42 * attribute; it is an attribute in the Production Printing Extension 43 * (<a href="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>) 44 * of IPP 1.1. The category name returned by 45 * {@code getName()} is the IPP attribute name. The enumeration's 46 * integer value is the IPP enum value. The {@code toString()} method 47 * returns the IPP string representation of the attribute value. 48 * 49 * @author Phil Race. 50 */ 51 public final class PresentationDirection extends EnumSyntax 52 implements PrintJobAttribute, PrintRequestAttribute { 53 54 private static final long serialVersionUID = 8294728067230931780L; 55 56 /** 57 * Pages are laid out in columns starting at the top left, 58 * proceeding towards the bottom {@literal &} right. 59 */ 60 public static final PresentationDirection TOBOTTOM_TORIGHT = 61 new PresentationDirection(0); 62 63 /** 64 * Pages are laid out in columns starting at the top right, 65 * proceeding towards the bottom {@literal &} left. 66 */ 67 public static final PresentationDirection TOBOTTOM_TOLEFT = 68 new PresentationDirection(1); 69 70 /** 71 * Pages are laid out in columns starting at the bottom left, 72 * proceeding towards the top {@literal &} right. 73 */ 74 public static final PresentationDirection TOTOP_TORIGHT = 75 new PresentationDirection(2); 76 77 /** 78 * Pages are laid out in columns starting at the bottom right, 79 * proceeding towards the top {@literal &} left. 80 */ 81 public static final PresentationDirection TOTOP_TOLEFT = 82 new PresentationDirection(3); 83 84 /** 85 * Pages are laid out in rows starting at the top left, 86 * proceeding towards the right {@literal &} bottom. 87 */ 88 public static final PresentationDirection TORIGHT_TOBOTTOM = 89 new PresentationDirection(4); 90 91 /** 92 * Pages are laid out in rows starting at the bottom left, 93 * proceeding towards the right {@literal &} top. 94 */ 95 public static final PresentationDirection TORIGHT_TOTOP = 96 new PresentationDirection(5); 97 98 /** 99 * Pages are laid out in rows starting at the top right, 100 * proceeding towards the left {@literal &} bottom. 101 */ 102 public static final PresentationDirection TOLEFT_TOBOTTOM = 103 new PresentationDirection(6); 104 105 /** 106 * Pages are laid out in rows starting at the bottom right, 107 * proceeding towards the left {@literal &} top. 108 */ 109 public static final PresentationDirection TOLEFT_TOTOP = 110 new PresentationDirection(7); 111 112 /** 113 * Construct a new presentation direction enumeration value with the given 114 * integer value. 115 * 116 * @param value Integer value. 117 */ 118 private PresentationDirection(int value) { 119 super (value); 120 } 121 122 private 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 }; 132 133 private static final PresentationDirection[] myEnumValueTable = { 134 TOBOTTOM_TORIGHT, 135 TOBOTTOM_TOLEFT, 136 TOTOP_TORIGHT, 137 TOTOP_TOLEFT, 138 TORIGHT_TOBOTTOM, 139 TORIGHT_TOTOP, 140 TOLEFT_TOBOTTOM, 141 TOLEFT_TOTOP, 142 }; 143 144 /** 145 * Returns the string table for class PresentationDirection. 146 */ 147 protected String[] getStringTable() { 148 return myStringTable; 149 } 150 151 /** 152 * Returns the enumeration value table for class PresentationDirection. 153 */ 154 protected EnumSyntax[] getEnumValueTable() { 155 return myEnumValueTable; 156 } 157 158 /** 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 PresentationDirection 163 * the category is class PresentationDirection itself. 164 * 165 * @return Printing attribute class (category), an instance of class 166 * {@link java.lang.Class java.lang.Class}. 167 */ 168 public final Class<? extends Attribute> getCategory() { 169 return PresentationDirection.class; 170 } 171 172 /** 173 * Get the name of the category of which this attribute value is an 174 * instance. 175 * <P> 176 * For class PresentationDirection 177 * the category name is {@code "presentation-direction"}. 178 * 179 * @return Attribute category name. 180 */ 181 public final String getName() { 182 return "presentation-direction"; 183 } 184 185 }