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.PrintServiceAttribute;
  31 
  32 /**
  33  * Class {@code ColorSupported} is a printing attribute class, an enumeration,
  34  * that identifies whether the device is capable of any type of color printing
  35  * at all, including highlight color as well as full process color. All document
  36  * instructions having to do with color are embedded within the print data (none
  37  * are attributes attached to the job outside the print data).
  38  * <p>
  39  * Note: End users are able to determine the nature and details of the color
  40  * support by querying the
  41  * {@link PrinterMoreInfoManufacturer PrinterMoreInfoManufacturer} attribute.
  42  * <p>
  43  * Don't confuse the {@code ColorSupported} attribute with the
  44  * {@link Chromaticity Chromaticity} attribute.
  45  * {@link Chromaticity Chromaticity} is an attribute the client can specify for
  46  * a job to tell the printer whether to print a document in monochrome or color,
  47  * possibly causing the printer to print a color document in monochrome.
  48  * {@code ColorSupported} is a printer description attribute that tells whether
  49  * the printer can print in color regardless of how the client specifies to
  50  * print any particular document.
  51  * <p>
  52  * <b>IPP Compatibility:</b> The IPP boolean value is "true" for SUPPORTED and
  53  * "false" for NOT_SUPPORTED. The category name returned by {@code getName()} is
  54  * the IPP attribute name. The enumeration's integer value is the IPP enum
  55  * value. The {@code toString()} method returns the IPP string representation of
  56  * the attribute value.
  57  *
  58  * @author Alan Kaminsky
  59  */
  60 public final class ColorSupported extends EnumSyntax
  61     implements PrintServiceAttribute {
  62 
  63     /**
  64      * Use serialVersionUID from JDK 1.4 for interoperability.
  65      */
  66     private static final long serialVersionUID = -2700555589688535545L;
  67 
  68     /**
  69      * The printer is not capable of any type of color printing.
  70      */
  71     public static final ColorSupported NOT_SUPPORTED = new ColorSupported(0);
  72 
  73     /**
  74      * The printer is capable of some type of color printing, such as highlight
  75      * color or full process color.
  76      */
  77     public static final ColorSupported SUPPORTED = new ColorSupported(1);
  78 
  79     /**
  80      * Construct a new color supported enumeration value with the given integer
  81      * value.
  82      *
  83      * @param  value Integer value
  84      */
  85     protected ColorSupported(int value) {
  86         super (value);
  87     }
  88 
  89     /**
  90      * The string table for class {@code ColorSupported}.
  91      */
  92     private static final String[] myStringTable = {"not-supported",
  93                                                    "supported"};
  94 
  95     /**
  96      * The enumeration value table for class {@code ColorSupported}.
  97      */
  98     private static final ColorSupported[] myEnumValueTable = {NOT_SUPPORTED,
  99                                                               SUPPORTED};
 100 
 101     /**
 102      * Returns the string table for class {@code ColorSupported}.
 103      */
 104     protected String[] getStringTable() {
 105         return myStringTable;
 106     }
 107 
 108     /**
 109      * Returns the enumeration value table for class {@code ColorSupported}.
 110      */
 111     protected EnumSyntax[] getEnumValueTable() {
 112         return myEnumValueTable;
 113     }
 114 
 115     /**
 116      * Get the printing attribute class which is to be used as the "category"
 117      * for this printing attribute value.
 118      * <p>
 119      * For class {@code ColorSupported}, the category is class
 120      * {@code ColorSupported} itself.
 121      *
 122      * @return printing attribute class (category), an instance of class
 123      *         {@link Class java.lang.Class}
 124      */
 125     public final Class<? extends Attribute> getCategory() {
 126         return ColorSupported.class;
 127     }
 128 
 129     /**
 130      * Get the name of the category of which this attribute value is an
 131      * instance.
 132      * <p>
 133      * For class {@code ColorSupported}, the category name is
 134      * {@code "color-supported"}
 135      *
 136      * @return attribute category name
 137      */
 138     public final String getName() {
 139         return "color-supported";
 140     }
 141 }