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