1 /*
   2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javax.print.attribute.standard;
  26 
  27 import java.util.Locale;
  28 
  29 import javax.print.attribute.Attribute;
  30 import javax.print.attribute.EnumSyntax;
  31 import javax.print.attribute.PrintRequestAttribute;
  32 import javax.print.attribute.PrintJobAttribute;
  33 
  34 /**
  35  * Class JobSheets is a printing attribute class, an enumeration, that
  36  * determines which job start and end sheets, if any, must be printed with a
  37  * job. Class JobSheets declares keywords for standard job sheets values.
  38  * Implementation- or site-defined names for a job sheets attribute may also be
  39  * created by defining a subclass of class JobSheets.
  40  * <P>
  41  * The effect of a JobSheets attribute on multidoc print jobs (jobs with
  42  * multiple documents) may be affected by the {@link MultipleDocumentHandling
  43  * MultipleDocumentHandling} job attribute, depending on the meaning of the
  44  * particular JobSheets value.
  45  * <P>
  46  * <B>IPP Compatibility:</B>  The category name returned by
  47  * <CODE>getName()</CODE> is the IPP attribute name.  The
  48  * enumeration's integer value is the IPP enum value.  The
  49  * <code>toString()</code> method returns the IPP string representation of
  50  * the attribute value. For a subclass, the attribute value must be
  51  * localized to give the IPP name and natural language values.
  52  *
  53  * @author  Alan Kaminsky
  54  */
  55 public class JobSheets extends EnumSyntax
  56         implements PrintRequestAttribute, PrintJobAttribute {
  57 
  58     private static final long serialVersionUID = -4735258056132519759L;
  59 
  60     /**
  61      * No job sheets are printed.
  62      */
  63     public static final JobSheets NONE = new JobSheets(0);
  64 
  65     /**
  66      * One or more site specific standard job sheets are printed. e.g. a
  67      * single start sheet is printed, or both start and end sheets are
  68      * printed.
  69      */
  70     public static final JobSheets STANDARD = new JobSheets(1);
  71 
  72     /**
  73      * Construct a new job sheets enumeration value with the given integer
  74      * value.
  75      *
  76      * @param  value  Integer value.
  77      */
  78     protected JobSheets(int value) {
  79         super (value);
  80     }
  81 
  82     private static final String[] myStringTable = {
  83         "none",
  84         "standard"
  85     };
  86 
  87     private static final JobSheets[] myEnumValueTable = {
  88         NONE,
  89         STANDARD
  90     };
  91 
  92     /**
  93      * Returns the string table for class JobSheets.
  94      */
  95     protected String[] getStringTable() {
  96         return myStringTable.clone();
  97     }
  98 
  99     /**
 100      * Returns the enumeration value table for class JobSheets.
 101      */
 102     protected EnumSyntax[] getEnumValueTable() {
 103         return (EnumSyntax[])myEnumValueTable.clone();
 104     }
 105 
 106     /**
 107      * Get the printing attribute class which is to be used as the "category"
 108      * for this printing attribute value.
 109      * <P>
 110      * For class JobSheets and any vendor-defined subclasses, the category is
 111      * class JobSheets itself.
 112      *
 113      * @return  Printing attribute class (category), an instance of class
 114      *          {@link java.lang.Class java.lang.Class}.
 115      */
 116     public final Class<? extends Attribute> getCategory() {
 117         return JobSheets.class;
 118     }
 119 
 120     /**
 121      * Get the name of the category of which this attribute value is an
 122      * instance.
 123      * <P>
 124      * For class JobSheets and any vendor-defined subclasses, the category
 125      * name is <CODE>"job-sheets"</CODE>.
 126      *
 127      * @return  Attribute category name.
 128      */
 129     public final String getName() {
 130         return "job-sheets";
 131     }
 132 
 133 }