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 package javax.print.attribute.standard;
  26 
  27 import javax.print.attribute.Attribute;
  28 import javax.print.attribute.EnumSyntax;
  29 import javax.print.attribute.DocAttribute;
  30 import javax.print.attribute.PrintRequestAttribute;
  31 import javax.print.attribute.PrintJobAttribute;
  32 
  33 /**
  34  * Class Chromaticity is a printing attribute class, an enumeration, that
  35  * specifies monochrome or color printing. This is used by a print client
  36  * to specify how the print data should be generated or processed. It is not
  37  * descriptive of the color capabilities of the device. Query the service's
  38  * {@link ColorSupported ColorSupported} attribute to determine if the device
  39  * can be verified to support color printing.
  40  * <P>
  41  * The table below shows the effects of specifying a Chromaticity attribute of
  42  * {@link #MONOCHROME MONOCHROME} or {@link #COLOR COLOR}
  43  * for a monochrome or color document.
  44  *
  45  * <table class="striped">
  46  * <caption>Shows effects of specifying MONOCHROME or COLOR Chromaticity
  47  * attributes</caption>
  48  * <thead>
  49  * <TR>
  50  * <TH>
  51  * Chromaticity<BR>Attribute
  52  * </TH>
  53  * <TH>
  54  * Effect on<BR>Monochrome Document
  55  * </TH>
  56  * <TH>
  57  * Effect on<BR>Color Document
  58  * </TH>
  59  * </TR>
  60  * </thead>
  61  * <tbody>
  62  * <TR>
  63  * <TD>
  64  * {@link #MONOCHROME MONOCHROME}
  65  * </TD>
  66  * <TD>
  67  * Printed as is, in monochrome
  68  * </TD>
  69  * <TD>
  70  * Printed in monochrome, with colors converted to shades of gray
  71  * </TD>
  72  * </TR>
  73  * <TR>
  74  * <TD>
  75  * {@link #COLOR COLOR}
  76  * </TD>
  77  * <TD>
  78  * Printed as is, in monochrome
  79  * </TD>
  80  * <TD>
  81  * Printed as is, in color
  82  * </TD>
  83  * </TR>
  84  * </tbody>
  85  * </TABLE>
  86  * <P>
  87  * <B>IPP Compatibility:</B> Chromaticity is not an IPP attribute at present.
  88  *
  89  * @author  Alan Kaminsky
  90  */
  91 public final class Chromaticity extends EnumSyntax
  92     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
  93 
  94     private static final long serialVersionUID = 4660543931355214012L;
  95 
  96     /**
  97      * Monochrome printing.
  98      */
  99     public static final Chromaticity MONOCHROME = new Chromaticity(0);
 100 
 101     /**
 102      * Color printing.
 103      */
 104     public static final Chromaticity COLOR = new Chromaticity(1);
 105 
 106 
 107     /**
 108      * Construct a new chromaticity enumeration value with the given integer
 109      * value.
 110      *
 111      * @param  value  Integer value.
 112      */
 113     protected Chromaticity(int value) {
 114         super(value);
 115     }
 116 
 117     private static final String[] myStringTable = {"monochrome",
 118                                                    "color"};
 119 
 120     private static final Chromaticity[] myEnumValueTable = {MONOCHROME,
 121                                                             COLOR};
 122 
 123     /**
 124      * Returns the string table for class Chromaticity.
 125      */
 126     protected String[] getStringTable() {
 127         return myStringTable;
 128     }
 129 
 130     /**
 131      * Returns the enumeration value table for class Chromaticity.
 132      */
 133     protected EnumSyntax[] getEnumValueTable() {
 134         return myEnumValueTable;
 135     }
 136 
 137     /**
 138      * Get the printing attribute class which is to be used as the "category"
 139      * for this printing attribute value.
 140      * <P>
 141      * For class Chromaticity, the category is the class Chromaticity itself.
 142      *
 143      * @return  Printing attribute class (category), an instance of class
 144      *          {@link java.lang.Class java.lang.Class}.
 145      */
 146     public final Class<? extends Attribute> getCategory() {
 147         return Chromaticity.class;
 148     }
 149 
 150     /**
 151      * Get the name of the category of which this attribute value is an
 152      * instance.
 153      * <P>
 154      * For class Chromaticity, the category name is {@code "chromaticity"}.
 155      *
 156      * @return  Attribute category name.
 157      */
 158         public final String getName() {
 159             return "chromaticity";
 160         }
 161 
 162         }