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 } | 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 } |