Source for javax.print.attribute.standard.PresentationDirection

   1: /* PresentationDirection.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: package javax.print.attribute.standard;
  39: 
  40: import javax.print.attribute.Attribute;
  41: import javax.print.attribute.EnumSyntax;
  42: import javax.print.attribute.PrintJobAttribute;
  43: import javax.print.attribute.PrintRequestAttribute;
  44: 
  45: 
  46: /**
  47:  * The <code>PresentationDirection</code> attribute specifies
  48:  * a value to be used together with the <code>NumberUp</code> attribute
  49:  * to indicate the layout of multiple pages on a single media sheet.
  50:  * <p>
  51:  * <b>IPP Compatibility:</b> PresentationDirection is not an IPP 1.1
  52:  * attribute.
  53:  * </p>
  54:  *
  55:  * @author Michael Koch (konqueror@gmx.de)
  56:  * @author Wolfgang Baer (WBaer@gmx.de)
  57:  */
  58: public final class PresentationDirection extends EnumSyntax
  59:   implements PrintRequestAttribute, PrintJobAttribute
  60: {
  61:   private static final long serialVersionUID = 8294728067230931780L;
  62: 
  63:   /**
  64:    * The single pages are arranged on the media in columns starting
  65:    * at the top left towards the bottom left.
  66:    */
  67:   public static final PresentationDirection TOBOTTOM_TORIGHT =
  68:     new PresentationDirection(0);
  69: 
  70:   /**
  71:    * The single pages are arranged on the media in columns starting
  72:    * at the top right towards the bottom left.
  73:    */
  74:   public static final PresentationDirection TOBOTTOM_TOLEFT =
  75:     new PresentationDirection(1);
  76: 
  77:   /**
  78:    * The single pages are arranged on the media in columns starting
  79:    * at the bottom left towards the top right.
  80:    */
  81:   public static final PresentationDirection TOTOP_TORIGHT =
  82:     new PresentationDirection(2);
  83: 
  84:   /**
  85:    * The single pages are arranged on the media in columns starting
  86:    * at the bottom right towards the top left.
  87:    */
  88:   public static final PresentationDirection TOTOP_TOLEFT =
  89:     new PresentationDirection(3);
  90: 
  91:   /**
  92:    * The single pages are arranged on the media in rows starting
  93:    * at the top left towards the right bottom.
  94:    */
  95:   public static final PresentationDirection TORIGHT_TOBOTTOM =
  96:     new PresentationDirection(4);
  97: 
  98:   /**
  99:    * The single pages are arranged on the media in rows starting
 100:    * at the bottom left towards the right top.
 101:    */
 102:   public static final PresentationDirection TORIGHT_TOTOP =
 103:     new PresentationDirection(5);
 104: 
 105:   /**
 106:    * The single pages are arranged on the media in rows starting
 107:    * at the top right towards the left bottom.
 108:    */
 109:   public static final PresentationDirection TOLEFT_TOBOTTOM =
 110:     new PresentationDirection(6);
 111: 
 112:   /**
 113:    * The single pages are arranged on the media in rows starting
 114:    * at the bottom right towards the left top.
 115:    */
 116:   public static final PresentationDirection TOLEFT_TOTOP =
 117:     new PresentationDirection(7);
 118: 
 119:   private static final String[] stringTable = { "tobottom-toright",
 120:     "tobottom-toleft", "totop-toright", "totop-toleft", "toright-tobottom",
 121:     "toright-totop", "toleft-tobottom", "toleft-totop" };
 122: 
 123:   private static final PresentationDirection[] enumValueTable =
 124:     { TOBOTTOM_TORIGHT, TOBOTTOM_TOLEFT, TOTOP_TORIGHT, TOTOP_TOLEFT,
 125:       TORIGHT_TOBOTTOM, TORIGHT_TOTOP, TOLEFT_TOBOTTOM, TOLEFT_TOTOP };
 126: 
 127:   /**
 128:    * Constructs a <code>PresentationDirection</code> object.
 129:    *
 130:    * @param value the enum value.
 131:    */
 132:   private PresentationDirection(int value)
 133:   {
 134:     super(value);
 135:   }
 136: 
 137:   /**
 138:    * Returns category of this class.
 139:    *
 140:    * @return The class <code>PresentationDirection</code> itself.
 141:    */
 142:   public Class< ? extends Attribute> getCategory()
 143:   {
 144:     return PresentationDirection.class;
 145:   }
 146: 
 147:   /**
 148:    * Returns the name of this attribute.
 149:    *
 150:    * @return The name "presentation-direction".
 151:    */
 152:   public String getName()
 153:   {
 154:     return "presentation-direction";
 155:   }
 156: 
 157:   /**
 158:    * Returns a table with the enumeration values represented as strings
 159:    * for this object.
 160:    *
 161:    * @return The enumeration values as strings.
 162:    */
 163:   protected String[] getStringTable()
 164:   {
 165:     return stringTable;
 166:   }
 167: 
 168:   /**
 169:    * Returns a table with the enumeration values for this object.
 170:    *
 171:    * @return The enumeration values.
 172:    */
 173:   protected EnumSyntax[] getEnumValueTable()
 174:   {
 175:     return enumValueTable;
 176:   }
 177: }