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