Source for javax.print.attribute.standard.Finishings

   1: /* Finishings.java --
   2:    Copyright (C) 2004, 2005, 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 javax.print.attribute.standard;
  40: 
  41: import javax.print.attribute.Attribute;
  42: import javax.print.attribute.DocAttribute;
  43: import javax.print.attribute.EnumSyntax;
  44: import javax.print.attribute.PrintJobAttribute;
  45: import javax.print.attribute.PrintRequestAttribute;
  46: 
  47: 
  48: /**
  49:  * The <code>Finishings</code> attribute specifies the finishing operations
  50:  * that the Printer applies to every copy of each printed document in the Job.
  51:  * <p>
  52:  * Standard enum values are: <code>NONE</code>, <code>STAPLE</code>,
  53:  * <code>COVER</code>, <code>BIND</code>, <code>SADDLE_STITCH</code>,
  54:  * <code>EDGE_STITCH</code>.
  55:  * <br><br>
  56:  * The following values are more specific:
  57:  * <code>STAPLE_TOP_LEFT</code>, <code>STAPLE_BOTTOM_LEFT</code>,
  58:  * <code>STAPLE_TOP_RIGHT</code>, <code>STAPLE_BOTTOM_RIGHT</code>,
  59:  * <code>EDGE_STITCH_LEFT</code>, <code>EDGE_STITCH_TOP</code>,
  60:  * <code>EDGE_STITCH_RIGHT</code>, <code>EDGE_STITCH_BOTTOM</code>,
  61:  * <code>STAPLE_DUAL_LEFT</code>, <code>STAPLE_DUAL_TOP</code>,
  62:  * <code>STAPLE_DUAL_RIGHT</code>, <code>STAPLE_DUAL_BOTTOM</code>.
  63:  * </p>
  64:  * <p>
  65:  * <b>Note:</b> The effect of this attribute on jobs with multiple documents
  66:  * is controlled by the job attribute
  67:  * {@link javax.print.attribute.standard.MultipleDocumentHandling}.
  68:  * </p>
  69:  * <p>
  70:  * <b>IPP Compatibility:</b> Finishings is an IPP 1.1 attribute. Differences
  71:  * to the IPP specification are that in the Java Print Service API only one
  72:  * enum value is supported (in IPP a set of enums). Further the enum
  73:  * <code>punch</code> is not supported.
  74:  * </p>
  75:  *
  76:  * @author Michael Koch (konqueror@gmx.de)
  77:  * @author Wolfgang Baer (WBaer@gmx.de)
  78:  */
  79: public class Finishings extends EnumSyntax
  80:   implements DocAttribute, PrintJobAttribute, PrintRequestAttribute
  81: {
  82:   private static final long serialVersionUID = -627840419548391754L;
  83: 
  84:   /**
  85:    * Perform no finishings of the documents.
  86:    */
  87:   public static final Finishings NONE = new Finishings(3);
  88: 
  89:   /**
  90:    * Selects binding of the documents with one or more staples.
  91:    */
  92:   public static final Finishings STAPLE = new Finishings(4);
  93: 
  94:   /**
  95:    * Selects the use of a non-printed (or pre-printed) cover for
  96:    * the document.
  97:    */
  98:   public static final Finishings COVER = new Finishings(6);
  99: 
 100:   /**
 101:    * Selects that a binding is to be applied to the document.
 102:    * The type and placement of the binding is site-defined.
 103:    */
 104:   public static final Finishings BIND = new Finishings(7);
 105: 
 106:   /**
 107:    * Selects binding of the documents with one or more staples
 108:    * along the middle fold.
 109:    */
 110:   public static final Finishings SADDLE_STITCH = new Finishings(8);
 111: 
 112:   /**
 113:    * Selects binding of the documents with one or more staples
 114:    * along one edge.
 115:    */
 116:   public static final Finishings EDGE_STITCH = new Finishings(9);
 117: 
 118:   /**
 119:    * Selects binding of the documents with one or more staples
 120:    * in the top left corner.
 121:    */
 122:   public static final Finishings STAPLE_TOP_LEFT = new Finishings(20);
 123: 
 124:   /**
 125:    * Selects binding of the documents with one or more staples in the bottom
 126:    * left corner.
 127:    */
 128:   public static final Finishings STAPLE_BOTTOM_LEFT = new Finishings(21);
 129: 
 130:   /**
 131:    * Selects binding of the documents with one or more staples in
 132:    * the top right corner.
 133:    */
 134:   public static final Finishings STAPLE_TOP_RIGHT = new Finishings(22);
 135: 
 136:   /**
 137:    * Selects binding of the documents with one or more staples in
 138:    * the bottom right corner.
 139:    */
 140:   public static final Finishings STAPLE_BOTTOM_RIGHT = new Finishings(23);
 141: 
 142:   /**
 143:    * Selects binding of the documents with one or more staples
 144:    * along the left edge.
 145:    */
 146:   public static final Finishings EDGE_STITCH_LEFT = new Finishings(24);
 147: 
 148:   /**
 149:    * Selects binding of the documents with one or more staples along
 150:    * the top edge.
 151:    */
 152:   public static final Finishings EDGE_STITCH_TOP = new Finishings(25);
 153: 
 154:   /**
 155:    * Selects binding of the documents with one or more staples along
 156:    * the right edge.
 157:    */
 158:   public static final Finishings EDGE_STITCH_RIGHT = new Finishings(26);
 159: 
 160:   /**
 161:    * Selects binding of the documents with one or more staples along
 162:    * the bottom edge.
 163:    */
 164:   public static final Finishings EDGE_STITCH_BOTTOM = new Finishings(27);
 165: 
 166:   /**
 167:    * Selects binding of the documents with two staples along the
 168:    * left edge assuming a portrait document.
 169:    */
 170:   public static final Finishings STAPLE_DUAL_LEFT = new Finishings(28);
 171: 
 172:   /**
 173:    * Selects binding of the documents with two staples along the
 174:    * top edge assuming a portrait document.
 175:    */
 176:   public static final Finishings STAPLE_DUAL_TOP = new Finishings(29);
 177: 
 178:   /**
 179:    * Selects binding of the documents with two staples along the
 180:    * right edge assuming a portrait document.
 181:    */
 182:   public static final Finishings STAPLE_DUAL_RIGHT = new Finishings(30);
 183: 
 184:   /**
 185:    * Selects binding of the documents with two staples along the
 186:    * bottom edge assuming a portrait document.
 187:    */
 188:   public static final Finishings STAPLE_DUAL_BOTTOM = new Finishings(31);
 189: 
 190:   private static final String[] stringTable = { "none", "staple", null,
 191:                                                 "cover", "bind", "saddle-stitch",
 192:                                                 "edge-stitch", null, null, null,
 193:                                                 null, null, null, null, null,
 194:                                                 null, null, "staple-top-left",
 195:                                                 "staple-bottom-left",
 196:                                                 "staple-top-right",
 197:                                                 "staple-bottom-right",
 198:                                                 "edge-stitch-left",
 199:                                                 "edge-stitch-top",
 200:                                                 "edge-stitch-right",
 201:                                                 "edge-stitch-bottom",
 202:                                                 "staple-dual-left",
 203:                                                 "staple-dual-top",
 204:                                                 "staple-dual-right",
 205:                                                 "staple-dual-bottom" };
 206: 
 207:   private static final Finishings[] enumValueTable = { NONE, STAPLE, null,
 208:                                                        COVER, BIND,
 209:                                                        SADDLE_STITCH,
 210:                                                        EDGE_STITCH, null,
 211:                                                        null, null, null,
 212:                                                        null, null, null,
 213:                                                        null, null, null,
 214:                                                        STAPLE_TOP_LEFT,
 215:                                                        STAPLE_BOTTOM_LEFT,
 216:                                                        STAPLE_TOP_RIGHT,
 217:                                                        STAPLE_BOTTOM_RIGHT,
 218:                                                        EDGE_STITCH_LEFT,
 219:                                                        EDGE_STITCH_TOP,
 220:                                                        EDGE_STITCH_RIGHT,
 221:                                                        EDGE_STITCH_BOTTOM,
 222:                                                        STAPLE_DUAL_LEFT,
 223:                                                        STAPLE_DUAL_TOP,
 224:                                                        STAPLE_DUAL_RIGHT,
 225:                                                        STAPLE_DUAL_BOTTOM };
 226: 
 227:   /**
 228:    * Constructs a <code>Finishings</code> object.
 229:    *
 230:    * @param value the value
 231:    */
 232:   protected Finishings(int value)
 233:   {
 234:     super(value);
 235:   }
 236: 
 237:   /**
 238:    * Returns category of this class.
 239:    *
 240:    * @return the class <code>Finishings</code> itself
 241:    */
 242:   public Class< ? extends Attribute> getCategory()
 243:   {
 244:     return Finishings.class;
 245:   }
 246: 
 247:   /**
 248:    * Returns the name of this attribute.
 249:    *
 250:    * @return The name "finishings".
 251:    */
 252:   public final String getName()
 253:   {
 254:     return "finishings";
 255:   }
 256: 
 257:   /**
 258:    * Returns a table with the enumeration values represented as strings
 259:    * for this object.
 260:    *
 261:    * @return The enumeration values as strings.
 262:    */
 263:   protected String[] getStringTable()
 264:   {
 265:     return stringTable;
 266:   }
 267: 
 268:   /**
 269:    * Returns a table with the enumeration values for this object.
 270:    *
 271:    * @return The enumeration values.
 272:    */
 273:   protected EnumSyntax[] getEnumValueTable()
 274:   {
 275:     return enumValueTable;
 276:   }
 277: 
 278:   /**
 279:    * Returns the lowest used value by the enumerations of this class.
 280:    * .
 281:    * @return The lowest value used.
 282:    */
 283:   protected int getOffset()
 284:   {
 285:     return 3;
 286:   }
 287: }