Save This Page
Home » openjdk-7 » javax » print » attribute » standard » [javadoc | source]
    1   /*
    2    * Copyright 2000-2004 Sun Microsystems, Inc.  All Rights Reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Sun in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22    * CA 95054 USA or visit www.sun.com if you need additional information or
   23    * have any questions.
   24    */
   25   package javax.print.attribute.standard;
   26   
   27   import javax.print.attribute.Attribute;
   28   import javax.print.attribute.EnumSyntax;
   29   import javax.print.attribute.DocAttribute;
   30   import javax.print.attribute.PrintRequestAttribute;
   31   import javax.print.attribute.PrintJobAttribute;
   32   
   33   /**
   34    * Class OrientationRequested is a printing attribute class, an enumeration,
   35    * that indicates the desired orientation for printed print-stream pages; it
   36    * does not describe the orientation of the client-supplied print-stream
   37    * pages.
   38    * <P>
   39    * For some document formats (such as <CODE>"application/postscript"</CODE>),
   40    * the desired orientation of the print-stream pages is specified within the
   41    * document data. This information is generated by a device driver prior to
   42    * the submission of the print job. Other document formats (such as
   43    * <CODE>"text/plain"</CODE>) do not include the notion of desired orientation
   44    * within the document data. In the latter case it is possible for the printer
   45    * to bind the desired orientation to the document data after it has been
   46    * submitted. It is expected that a printer would only support the
   47    * OrientationRequested attribute for some document formats (e.g.,
   48    * <CODE>"text/plain"</CODE> or <CODE>"text/html"</CODE>) but not others (e.g.
   49    * <CODE>"application/postscript"</CODE>). This is no different from any other
   50    * job template attribute, since a print job can always impose constraints
   51    * among the values of different job template attributes.
   52    *  However, a special mention
   53    * is made here since it is very likely that a printer will support the
   54    * OrientationRequested attribute for only a subset of the supported document
   55    * formats.
   56    * <P>
   57    * <B>IPP Compatibility:</B> The category name returned by
   58    * <CODE>getName()</CODE> is the IPP attribute name.  The enumeration's
   59    * integer value is the IPP enum value.  The <code>toString()</code> method
   60    * returns the IPP string representation of the attribute value.
   61    * <P>
   62    *
   63    * @author  Alan Kaminsky
   64    */
   65   public final class OrientationRequested extends EnumSyntax
   66       implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
   67   
   68       private static final long serialVersionUID = -4447437289862822276L;
   69   
   70       /**
   71        * The content will be imaged across the short edge of the medium.
   72        */
   73       public static final OrientationRequested
   74           PORTRAIT = new OrientationRequested(3);
   75   
   76       /**
   77        * The content will be imaged across the long edge of the medium.
   78        * Landscape is defined to be a rotation of the print-stream page to be
   79        * imaged by +90 degrees with respect to the medium
   80        * (i.e. anti-clockwise) from the
   81        * portrait orientation. <I>Note:</I> The +90 direction was chosen because
   82        * simple finishing on the long edge is the same edge whether portrait or
   83        * landscape.
   84        */
   85       public static final OrientationRequested
   86           LANDSCAPE = new OrientationRequested(4);
   87   
   88       /**
   89        * The content will be imaged across the long edge of the medium, but in
   90        * the opposite manner from landscape. Reverse-landscape is defined to be
   91        * a rotation of the print-stream page to be imaged by -90 degrees with
   92        * respect to the medium (i.e. clockwise) from the portrait orientation.
   93        * <I>Note:</I> The REVERSE_LANDSCAPE value was added because some
   94        * applications rotate landscape -90 degrees from portrait, rather than
   95        * +90 degrees.
   96        */
   97       public static final OrientationRequested
   98           REVERSE_LANDSCAPE = new OrientationRequested(5);
   99   
  100       /**
  101        * The content will be imaged across the short edge of the medium, but in
  102        * the opposite manner from portrait. Reverse-portrait is defined to be a
  103        * rotation of the print-stream page to be imaged by 180 degrees with
  104        * respect to the medium from the portrait orientation. <I>Note:</I> The
  105        * REVERSE_PORTRAIT value was added for use with the {@link
  106        * Finishings Finishings} attribute in cases where the
  107        * opposite edge is desired for finishing a portrait document on simple
  108        * finishing devices that have only one finishing position. Thus a
  109        * <CODE>"text/plain"</CODE> portrait document can be stapled "on the
  110        * right" by a simple finishing device as is common use with some
  111        * Middle Eastern languages such as Hebrew.
  112        */
  113       public static final OrientationRequested
  114           REVERSE_PORTRAIT = new OrientationRequested(6);
  115   
  116       /**
  117        * Construct a new orientation requested enumeration value with the given
  118        * integer value.
  119        *
  120        * @param  value  Integer value.
  121        */
  122       protected OrientationRequested(int value) {
  123           super(value);
  124       }
  125   
  126       private static final String[] myStringTable = {
  127           "portrait",
  128           "landscape",
  129           "reverse-landscape",
  130           "reverse-portrait"
  131       };
  132   
  133       private static final OrientationRequested[] myEnumValueTable = {
  134           PORTRAIT,
  135           LANDSCAPE,
  136           REVERSE_LANDSCAPE,
  137           REVERSE_PORTRAIT
  138       };
  139   
  140       /**
  141        * Returns the string table for class OrientationRequested.
  142        */
  143       protected String[] getStringTable() {
  144           return myStringTable;
  145       }
  146   
  147       /**
  148        * Returns the enumeration value table for class OrientationRequested.
  149        */
  150       protected EnumSyntax[] getEnumValueTable() {
  151           return myEnumValueTable;
  152       }
  153   
  154       /**
  155        * Returns the lowest integer value used by class OrientationRequested.
  156        */
  157       protected int getOffset() {
  158           return 3;
  159       }
  160   
  161       /**
  162        * Get the printing attribute class which is to be used as the "category"
  163        * for this printing attribute value.
  164        * <P>
  165        * For class OrientationRequested, the
  166        * category is class OrientationRequested itself.
  167        *
  168        * @return  Printing attribute class (category), an instance of class
  169        *          {@link java.lang.Class java.lang.Class}.
  170        */
  171       public final Class<? extends Attribute> getCategory() {
  172           return OrientationRequested.class;
  173       }
  174   
  175       /**
  176        * Get the name of the category of which this attribute value is an
  177        * instance.
  178        * <P>
  179        * For class OrientationRequested, the
  180        * category name is <CODE>"orientation-requested"</CODE>.
  181        *
  182        * @return  Attribute category name.
  183        */
  184       public final String getName() {
  185           return "orientation-requested";
  186       }
  187   
  188   }

Save This Page
Home » openjdk-7 » javax » print » attribute » standard » [javadoc | source]