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