Source for javax.print.attribute.standard.OrientationRequested

   1: /* OrientationRequested.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.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>OrientationRequested</code> printing attribute specifies
  49:  * the desired orientation of the print data on the media sheet.
  50:  * <p>
  51:  * The effect of this attribute may depend on the document format as
  52:  * some document formats (e.g. postscript) contains the orientation
  53:  * inside the print data. However for other formats like e.g. plain
  54:  * text this attribute will have an effect on the orientation.
  55:  * </p>
  56:  * <p>
  57:  * <b>IPP Compatibility:</b> OrientationRequested is an IPP 1.1 attribute.
  58:  * </p>
  59:  * 
  60:  * @author Michael Koch (konqueror@gmx.de)
  61:  * @author Wolfgang Baer (WBaer@gmx.de)
  62:  */
  63: public final class OrientationRequested extends EnumSyntax
  64:   implements DocAttribute, PrintRequestAttribute, PrintJobAttribute
  65: {
  66:   private static final long serialVersionUID = -4447437289862822276L;
  67: 
  68:   /** 
  69:    * Orientation as portrait. 
  70:    */
  71:   public static final OrientationRequested PORTRAIT =
  72:     new OrientationRequested(3);
  73:   
  74:   /** 
  75:    * Orientation as landscape. 
  76:    */
  77:   public static final OrientationRequested LANDSCAPE =
  78:     new OrientationRequested(4);
  79:   
  80:   /** 
  81:    * Orientation as reversed landscape. 
  82:    */
  83:   public static final OrientationRequested REVERSE_LANDSCAPE =
  84:     new OrientationRequested(5);
  85:   
  86:   /** 
  87:    * Orientation as reversed portrait. 
  88:    */
  89:   public static final OrientationRequested REVERSE_PORTRAIT =
  90:     new OrientationRequested(6);
  91:   
  92: 
  93:   private static final String[] stringTable = { "portrait", "landscape",
  94:                                                 "reverse-landscape",
  95:                                                 "reverse-portrait" };
  96:   
  97:   private static final OrientationRequested[] 
  98:       enumValueTable = { PORTRAIT, LANDSCAPE, 
  99:                          REVERSE_LANDSCAPE, REVERSE_PORTRAIT };
 100: 
 101:   /**
 102:    * Constructs a <code>OrientationRequested</code> object.
 103:    * 
 104:    * @param value the value
 105:    */
 106:   protected OrientationRequested(int value)
 107:   {
 108:     super(value);
 109:   }
 110: 
 111:   /**
 112:    * Returns category of this class.
 113:    *
 114:    * @return The class <code>OrientationRequested</code> itself.
 115:    */
 116:   public Class< ? extends Attribute> getCategory()
 117:   {
 118:     return OrientationRequested.class;
 119:   }
 120: 
 121:   /**
 122:    * Returns the name of this attribute.
 123:    *
 124:    * @return The name "orientation-requested".
 125:    */
 126:   public String getName()
 127:   {
 128:     return "orientation-requested";
 129:   }
 130:   
 131:   /**
 132:    * Returns a table with the enumeration values represented as strings
 133:    * for this object.
 134:    *
 135:    * @return The enumeration values as strings.
 136:    */
 137:   protected String[] getStringTable()
 138:   {
 139:     return stringTable;
 140:   }
 141: 
 142:   /**
 143:    * Returns a table with the enumeration values for this object.
 144:    *
 145:    * @return The enumeration values.
 146:    */
 147:   protected EnumSyntax[] getEnumValueTable()
 148:   {
 149:     return enumValueTable;
 150:   }
 151:   
 152:   /**
 153:    * Returns the lowest used value by the enumerations of this class.
 154:    * .
 155:    * @return The lowest value used.
 156:    */
 157:   protected int getOffset()
 158:   {
 159:     return 3;
 160:   }  
 161: }