1 /*
   2  * Copyright (c) 2000, 2017, 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 
  26 package javax.print.attribute.standard;
  27 
  28 import javax.print.attribute.Attribute;
  29 import javax.print.attribute.EnumSyntax;
  30 import javax.print.attribute.PrintJobAttribute;
  31 import javax.print.attribute.PrintRequestAttribute;
  32 
  33 /**
  34  * Class {@code JobSheets} is a printing attribute class, an enumeration, that
  35  * determines which job start and end sheets, if any, must be printed with a
  36  * job. Class {@code JobSheets} declares keywords for standard job sheets
  37  * values. Implementation- or site-defined names for a job sheets attribute may
  38  * also be created by defining a subclass of class {@code JobSheets}.
  39  * <p>
  40  * The effect of a {@code JobSheets} attribute on multidoc print jobs (jobs with
  41  * multiple documents) may be affected by the
  42  * {@link MultipleDocumentHandling MultipleDocumentHandling} job attribute,
  43  * depending on the meaning of the particular {@code JobSheets} value.
  44  * <p>
  45  * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
  46  * the IPP attribute name. The enumeration's integer value is the IPP enum
  47  * value. The {@code toString()} method returns the IPP string representation of
  48  * the attribute value. For a subclass, the attribute value must be localized to
  49  * give the IPP name and natural language values.
  50  *
  51  * @author Alan Kaminsky
  52  */
  53 public class JobSheets extends EnumSyntax
  54         implements PrintRequestAttribute, PrintJobAttribute {
  55 
  56     /**
  57      * Use serialVersionUID from JDK 1.4 for interoperability.
  58      */
  59     private static final long serialVersionUID = -4735258056132519759L;
  60 
  61     /**
  62      * No job sheets are printed.
  63      */
  64     public static final JobSheets NONE = new JobSheets(0);
  65 
  66     /**
  67      * One or more site specific standard job sheets are printed. e.g. a single
  68      * start sheet is printed, or both start and end sheets are 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     /**
  83      * The string table for class {@code JobSheets}.
  84      */
  85     private static final String[] myStringTable = {
  86         "none",
  87         "standard"
  88     };
  89 
  90     /**
  91      * The enumeration value table for class {@code JobSheets}.
  92      */
  93     private static final JobSheets[] myEnumValueTable = {
  94         NONE,
  95         STANDARD
  96     };
  97 
  98     /**
  99      * Returns the string table for class {@code JobSheets}.
 100      */
 101     protected String[] getStringTable() {
 102         return myStringTable.clone();
 103     }
 104 
 105     /**
 106      * Returns the enumeration value table for class {@code JobSheets}.
 107      */
 108     protected EnumSyntax[] getEnumValueTable() {
 109         return (EnumSyntax[])myEnumValueTable.clone();
 110     }
 111 
 112     /**
 113      * Get the printing attribute class which is to be used as the "category"
 114      * for this printing attribute value.
 115      * <p>
 116      * For class {@code JobSheets} and any vendor-defined subclasses, the
 117      * category is class {@code JobSheets} itself.
 118      *
 119      * @return printing attribute class (category), an instance of class
 120      *         {@link Class java.lang.Class}
 121      */
 122     public final Class<? extends Attribute> getCategory() {
 123         return JobSheets.class;
 124     }
 125 
 126     /**
 127      * Get the name of the category of which this attribute value is an
 128      * instance.
 129      * <p>
 130      * For class {@code JobSheets} and any vendor-defined subclasses, the
 131      * category name is {@code "job-sheets"}.
 132      *
 133      * @return attribute category name
 134      */
 135     public final String getName() {
 136         return "job-sheets";
 137     }
 138 }