Frames | No Frames |
1: /* FinishingsSupported.java -- 2: Copyright (C) 2006 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package gnu.javax.print.ipp.attribute.supported; 40: 41: import gnu.javax.print.ipp.IppUtilities; 42: 43: import java.util.Iterator; 44: import java.util.Set; 45: 46: import javax.print.attribute.EnumSyntax; 47: import javax.print.attribute.SupportedValuesAttribute; 48: import javax.print.attribute.standard.Finishings; 49: 50: 51: /** 52: * The <code>FinishingsSupported</code> attribute provides the supported 53: * values for finishings of a job. 54: * 55: * @author Wolfgang Baer (WBaer@gmx.de) 56: */ 57: public final class FinishingsSupported extends EnumSyntax 58: implements SupportedValuesAttribute 59: { 60: 61: /** No finishing. */ 62: public static final FinishingsSupported NONE = new FinishingsSupported(3); 63: 64: /** Staple the document(s) */ 65: public static final FinishingsSupported STAPLE = new FinishingsSupported(4); 66: 67: /** Cover a document */ 68: public static final FinishingsSupported COVER = new FinishingsSupported(6); 69: 70: /** 71: * This value indicates that a binding is to be applied to the document. 72: * The type and placement of the binding is site-defined. 73: */ 74: public static final FinishingsSupported BIND = new FinishingsSupported(7); 75: 76: /** 77: * Bind the document(s) with one or more staples (wire stitches) 78: * along the middle fold. 79: */ 80: public static final FinishingsSupported SADDLE_STITCH = 81: new FinishingsSupported(8); 82: 83: /** 84: * Bind the document(s) with one or more staples (wire stitches) 85: * along one edge. 86: */ 87: public static final FinishingsSupported EDGE_STITCH = 88: new FinishingsSupported(9); 89: 90: /** 91: * Bind the document(s) with one or more staples in the top left 92: * corner. 93: */ 94: public static final FinishingsSupported STAPLE_TOP_LEFT = 95: new FinishingsSupported(20); 96: 97: /** 98: * Bind the document(s) with one or more staples in the bottom 99: * left corner. 100: */ 101: public static final FinishingsSupported STAPLE_BOTTOM_LEFT = 102: new FinishingsSupported(21); 103: 104: /** 105: * Bind the document(s) with one or more staples in the top right corner. 106: */ 107: public static final FinishingsSupported STAPLE_TOP_RIGHT = 108: new FinishingsSupported(22); 109: 110: /** 111: * Bind the document(s) with one or more staples in the bottom right corner. 112: */ 113: public static final FinishingsSupported STAPLE_BOTTOM_RIGHT = 114: new FinishingsSupported(23); 115: 116: /** 117: * Bind the document(s) with one or more staples (wire stitches) 118: * along the left edge. 119: */ 120: public static final FinishingsSupported EDGE_STITCH_LEFT = 121: new FinishingsSupported(24); 122: 123: /** 124: * Bind the document(s) with one or more staples (wire stitches) along 125: * the top edge. 126: */ 127: public static final FinishingsSupported EDGE_STITCH_TOP = 128: new FinishingsSupported(25); 129: 130: /** 131: * Bind the document(s) with one or more staples (wire stitches) along 132: * the right edge. 133: */ 134: public static final FinishingsSupported EDGE_STITCH_RIGHT = 135: new FinishingsSupported(26); 136: 137: /** 138: * Bind the document(s) with one or more staples (wire stitches) along 139: * the bottom edge. 140: */ 141: public static final FinishingsSupported EDGE_STITCH_BOTTOM = 142: new FinishingsSupported(27); 143: 144: /** 145: * Bind the document(s) with two staples (wire stitches) along the 146: * left edge assuming a portrait document. 147: */ 148: public static final FinishingsSupported STAPLE_DUAL_LEFT = 149: new FinishingsSupported(28); 150: 151: /** 152: * Bind the document(s) with two staples (wire stitches) along the 153: * top edge assuming a portrait document. 154: */ 155: public static final FinishingsSupported STAPLE_DUAL_TOP = 156: new FinishingsSupported(29); 157: 158: /** 159: * Bind the document(s) with two staples (wire stitches) along the 160: * right edge assuming a portrait document. 161: */ 162: public static final FinishingsSupported STAPLE_DUAL_RIGHT = 163: new FinishingsSupported(30); 164: 165: /** 166: * Bind the document(s) with two staples (wire stitches) along the 167: * bottom edge assuming a portrait document. 168: */ 169: public static final FinishingsSupported STAPLE_DUAL_BOTTOM = 170: new FinishingsSupported(31); 171: 172: private static final String[] stringTable = { "none", "staple", null, 173: "cover", "bind", "saddle-stitch", 174: "edge-stitch", null, null, null, 175: null, null, null, null, null, 176: null, null, "staple-top-left", 177: "staple-bottom-left", 178: "staple-top-right", 179: "staple-bottom-right", 180: "edge-stitch-left", 181: "edge-stitch-top", 182: "edge-stitch-right", 183: "edge-stitch-bottom", 184: "staple-dual-left", 185: "staple-dual-top", 186: "staple-dual-right", 187: "staple-dual-bottom" }; 188: 189: private static final FinishingsSupported[] enumValueTable = { NONE, STAPLE, 190: null, COVER, BIND, 191: SADDLE_STITCH, 192: EDGE_STITCH, null, 193: null, null, null, 194: null, null, null, 195: null, null, null, 196: STAPLE_TOP_LEFT, 197: STAPLE_BOTTOM_LEFT, 198: STAPLE_TOP_RIGHT, 199: STAPLE_BOTTOM_RIGHT, 200: EDGE_STITCH_LEFT, 201: EDGE_STITCH_TOP, 202: EDGE_STITCH_RIGHT, 203: EDGE_STITCH_BOTTOM, 204: STAPLE_DUAL_LEFT, 205: STAPLE_DUAL_TOP, 206: STAPLE_DUAL_RIGHT, 207: STAPLE_DUAL_BOTTOM }; 208: 209: /** 210: * Constructs a <code>FinishingsSupported</code> object. 211: * 212: * @param value the value 213: */ 214: protected FinishingsSupported(int value) 215: { 216: super(value); 217: } 218: 219: /** 220: * Returns category of this class. 221: * 222: * @return the class <code>FinishingsSupported</code> itself 223: */ 224: public Class getCategory() 225: { 226: return FinishingsSupported.class; 227: } 228: 229: /** 230: * Returns the name of this attribute. 231: * 232: * @return The name "finishings-supported". 233: */ 234: public String getName() 235: { 236: return "finishings-supported"; 237: } 238: 239: /** 240: * Returns a table with the enumeration values represented as strings 241: * for this object. 242: * 243: * @return The enumeration values as strings. 244: */ 245: protected String[] getStringTable() 246: { 247: return stringTable; 248: } 249: 250: /** 251: * Returns a table with the enumeration values for this object. 252: * 253: * @return The enumeration values. 254: */ 255: protected EnumSyntax[] getEnumValueTable() 256: { 257: return enumValueTable; 258: } 259: 260: /** 261: * Returns the lowest used value by the enumerations of this class. 262: * . 263: * @return The lowest value used. 264: */ 265: protected int getOffset() 266: { 267: return 3; 268: } 269: 270: /** 271: * Returns the equally enum of the standard attribute class 272: * of this SupportedValuesAttribute enum. 273: * 274: * @return The enum of the standard attribute class. 275: */ 276: public Finishings getAssociatedAttribute() 277: { 278: return (Finishings) IppUtilities.getEnumAttribute( 279: "finishings", new Integer(getValue())); 280: } 281: 282: /** 283: * Constructs an array from a set of -supported attributes. 284: * @param set set to process 285: * @return The constructed array. 286: * 287: * @see #getAssociatedAttribute() 288: */ 289: public static Finishings[] getAssociatedAttributeArray(Set set) 290: { 291: FinishingsSupported tmp; 292: Finishings[] result = new Finishings[set.size()]; 293: Iterator it = set.iterator(); 294: int j = 0; 295: while (it.hasNext()) 296: { 297: tmp = (FinishingsSupported) it.next(); 298: result[j] = tmp.getAssociatedAttribute(); 299: j++; 300: } 301: return result; 302: } 303: }