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  *
  56  * @author  Alan Kaminsky
  57  */
  58 public final class ColorSupported extends EnumSyntax
  59     implements PrintServiceAttribute {
  60 
  61     private static final long serialVersionUID = -2700555589688535545L;
  62 
  63     /**
  64      * The printer is not capable of any type of color printing.
  65      */
  66     public static final ColorSupported NOT_SUPPORTED = new ColorSupported(0);
  67 
  68     /**
  69      * The printer is capable of some type of color printing, such as
  70      * highlight color or full process color.
  71      */
  72     public static final ColorSupported SUPPORTED = new ColorSupported(1);
  73 
  74     /**
  75      * Construct a new color supported enumeration value with the given
  76      * integer value.
  77      *
  78      * @param  value  Integer value.
  79      */
  80     protected ColorSupported(int value) {
  81         super (value);
  82     }
  83 
  84     private static final String[] myStringTable = {"not-supported",
  85                                                    "supported"};
  86 
  87     private static final ColorSupported[] myEnumValueTable = {NOT_SUPPORTED,
  88                                                               SUPPORTED};
  89 
  90     /**
  91      * Returns the string table for class ColorSupported.
  92      */
  93     protected String[] getStringTable() {
  94         return myStringTable;
  95     }
  96 
  97     /**
  98      * Returns the enumeration value table for class ColorSupported.
  99      */
 100     protected EnumSyntax[] getEnumValueTable() {
 101         return myEnumValueTable;
 102     }
 103 
 104     /**
 105      * Get the printing attribute class which is to be used as the "category"
 106      * for this printing attribute value.
 107      * <P>
 108      * For class ColorSupported, the category is class ColorSupported itself.
 109      *
 110      * @return  Printing attribute class (category), an instance of class
 111      *          {@link java.lang.Class java.lang.Class}.
 112      */
 113     public final Class<? extends Attribute> getCategory() {
 114         return ColorSupported.class;
 115     }
 116 
 117     /**
 118      * Get the name of the category of which this attribute value is an
 119      * instance.
 120      * <P>
 121      * For class ColorSupported, the category name is <CODE>"color-supported"</CODE>.
 122      *
 123      * @return  Attribute category name.
 124      */
 125     public final String getName() {
 126         return "color-supported";
 127     }
 128 
 129 }