Source for javax.print.attribute.standard.Finishings

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