Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java
41171 views
/*1* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.print.attribute.standard;2627import java.io.Serial;2829import javax.print.attribute.Attribute;30import javax.print.attribute.DocAttribute;31import javax.print.attribute.EnumSyntax;32import javax.print.attribute.PrintJobAttribute;33import javax.print.attribute.PrintRequestAttribute;3435/**36* Class {@code Chromaticity} is a printing attribute class, an enumeration,37* that specifies monochrome or color printing. This is used by a print client38* to specify how the print data should be generated or processed. It is not39* descriptive of the color capabilities of the device. Query the service's40* {@link ColorSupported ColorSupported} attribute to determine if the device41* can be verified to support color printing.42* <p>43* The table below shows the effects of specifying a Chromaticity attribute of44* {@link #MONOCHROME MONOCHROME} or {@link #COLOR COLOR} for a monochrome or45* color document.46*47* <table class="striped">48* <caption>Shows effects of specifying {@code MONOCHROME} or {@code COLOR}49* Chromaticity attributes</caption>50* <thead>51* <tr>52* <th scope="col">Chromaticity<br>Attribute53* <th scope="col">Effect on<br>Monochrome Document54* <th scope="col">Effect on<br>Color Document55* </thead>56* <tbody>57* <tr>58* <th scope="row">{@link #MONOCHROME MONOCHROME}59* <td>Printed as is, in monochrome60* <td>Printed in monochrome, with colors converted to shades of gray61* <tr>62* <th scope="row">{@link #COLOR COLOR}63* <td>Printed as is, in monochrome64* <td>Printed as is, in color65* </tbody>66* </table>67* <p>68* <b>IPP Compatibility:</b> Chromaticity is not an IPP attribute at present.69*70* @author Alan Kaminsky71*/72public final class Chromaticity extends EnumSyntax73implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {7475/**76* Use serialVersionUID from JDK 1.4 for interoperability.77*/78@Serial79private static final long serialVersionUID = 4660543931355214012L;8081/**82* Monochrome printing.83*/84public static final Chromaticity MONOCHROME = new Chromaticity(0);8586/**87* Color printing.88*/89public static final Chromaticity COLOR = new Chromaticity(1);9091/**92* Construct a new chromaticity enumeration value with the given integer93* value.94*95* @param value Integer value96*/97protected Chromaticity(int value) {98super(value);99}100101/**102* The string table for class {@code Chromaticity}.103*/104private static final String[] myStringTable = {"monochrome",105"color"};106107/**108* The enumeration value table for class {@code Chromaticity}.109*/110private static final Chromaticity[] myEnumValueTable = {MONOCHROME,111COLOR};112113/**114* Returns the string table for class {@code Chromaticity}.115*/116protected String[] getStringTable() {117return myStringTable;118}119120/**121* Returns the enumeration value table for class {@code Chromaticity}.122*/123protected EnumSyntax[] getEnumValueTable() {124return myEnumValueTable;125}126127/**128* Get the printing attribute class which is to be used as the "category"129* for this printing attribute value.130* <p>131* For class {@code Chromaticity}, the category is the class132* {@code Chromaticity} itself.133*134* @return printing attribute class (category), an instance of class135* {@link Class java.lang.Class}136*/137public final Class<? extends Attribute> getCategory() {138return Chromaticity.class;139}140141/**142* Get the name of the category of which this attribute value is an143* instance.144* <p>145* For class {@code Chromaticity}, the category name is146* {@code "chromaticity"}.147*148* @return attribute category name149*/150public final String getName() {151return "chromaticity";152}153}154155156