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