1 /* 2 * Copyright (c) 2000, 2014, 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 PrinterState is a printing attribute class, an enumeration, that 33 * identifies the current state of a printer. Class PrinterState defines 34 * standard printer state values. A Print Service implementation only needs 35 * to report those printer states which are appropriate for the particular 36 * implementation; it does not have to report every defined printer state. The 37 * {@link PrinterStateReasons PrinterStateReasons} attribute augments the 38 * PrinterState attribute to give more detailed information about the printer 39 * in given printer state. 40 * <P> 41 * <B>IPP Compatibility:</B> The category name returned by 42 * {@code getName()} is the IPP attribute name. The enumeration's 43 * integer value is the IPP enum value. The {@code toString()} method 44 * returns the IPP string representation of the attribute value. 45 * 46 * @author Alan Kaminsky 47 */ 48 public final class PrinterState extends EnumSyntax 49 implements PrintServiceAttribute { 50 51 private static final long serialVersionUID = -649578618346507718L; 52 53 /** 54 * The printer state is unknown. 55 */ 56 public static final PrinterState UNKNOWN = new PrinterState(0); 57 58 /** 59 * Indicates that new jobs can start processing without waiting. 60 */ 61 public static final PrinterState IDLE = new PrinterState(3); 62 63 /** 64 * Indicates that jobs are processing; 65 * new jobs will wait before processing. 66 */ 67 public static final PrinterState PROCESSING = new PrinterState(4); 68 69 /** 70 * Indicates that no jobs can be processed and intervention is required. 71 */ 72 public static final PrinterState STOPPED = new PrinterState(5); 73 74 /** 75 * Construct a new printer state enumeration value with the given integer 76 * value. 77 * 78 * @param value Integer value. 79 */ 80 protected PrinterState(int value) { 81 super (value); 82 } 83 84 private static final String[] myStringTable = { 85 "unknown", 86 null, 87 null, 88 "idle", 89 "processing", 90 "stopped" 91 }; 92 93 private static final PrinterState[] myEnumValueTable = { 94 UNKNOWN, 95 null, 96 null, 97 IDLE, 98 PROCESSING, 99 STOPPED 100 }; 101 102 /** 103 * Returns the string table for class PrinterState. 104 */ 105 protected String[] getStringTable() { 106 return myStringTable; 107 } 108 109 /** 110 * Returns the enumeration value table for class PrinterState. 111 */ 112 protected EnumSyntax[] getEnumValueTable() { 113 return myEnumValueTable; 114 } 115 116 /** 117 * Get the printing attribute class which is to be used as the "category" 118 * for this printing attribute value. 119 * <P> 120 * For class PrinterState, the category is class PrinterState itself. 121 * 122 * @return Printing attribute class (category), an instance of class 123 * {@link java.lang.Class java.lang.Class}. 124 */ 125 public final Class<? extends Attribute> getCategory() { 126 return PrinterState.class; 127 } 128 129 /** 130 * Get the name of the category of which this attribute value is an 131 * instance. 132 * <P> 133 * For class PrinterState, the category name is {@code "printer-state"}. 134 * 135 * @return Attribute category name. 136 */ 137 public final String getName() { 138 return "printer-state"; 139 } 140 141 } | 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.EnumSyntax; 30 import javax.print.attribute.PrintServiceAttribute; 31 32 /** 33 * Class {@code PrinterState} is a printing attribute class, an enumeration, 34 * that identifies the current state of a printer. Class {@code PrinterState} 35 * defines standard printer state values. A Print Service implementation only 36 * needs to report those printer states which are appropriate for the particular 37 * implementation; it does not have to report every defined printer state. The 38 * {@link PrinterStateReasons PrinterStateReasons} attribute augments the 39 * {@code PrinterState} attribute to give more detailed information about the 40 * printer in given printer state. 41 * <p> 42 * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is 43 * the IPP attribute name. The enumeration's integer value is the IPP enum 44 * value. The {@code toString()} method returns the IPP string representation of 45 * the attribute value. 46 * 47 * @author Alan Kaminsky 48 */ 49 public final class PrinterState extends EnumSyntax 50 implements PrintServiceAttribute { 51 52 /** 53 * Use serialVersionUID from JDK 1.4 for interoperability. 54 */ 55 private static final long serialVersionUID = -649578618346507718L; 56 57 /** 58 * The printer state is unknown. 59 */ 60 public static final PrinterState UNKNOWN = new PrinterState(0); 61 62 /** 63 * Indicates that new jobs can start processing without waiting. 64 */ 65 public static final PrinterState IDLE = new PrinterState(3); 66 67 /** 68 * Indicates that jobs are processing; new jobs will wait before processing. 69 */ 70 public static final PrinterState PROCESSING = new PrinterState(4); 71 72 /** 73 * Indicates that no jobs can be processed and intervention is required. 74 */ 75 public static final PrinterState STOPPED = new PrinterState(5); 76 77 /** 78 * Construct a new printer state enumeration value with the given integer 79 * value. 80 * 81 * @param value Integer value 82 */ 83 protected PrinterState(int value) { 84 super (value); 85 } 86 87 /** 88 * The string table for class {@code PrinterState}. 89 */ 90 private static final String[] myStringTable = { 91 "unknown", 92 null, 93 null, 94 "idle", 95 "processing", 96 "stopped" 97 }; 98 99 /** 100 * The enumeration value table for class {@code PrinterState}. 101 */ 102 private static final PrinterState[] myEnumValueTable = { 103 UNKNOWN, 104 null, 105 null, 106 IDLE, 107 PROCESSING, 108 STOPPED 109 }; 110 111 /** 112 * Returns the string table for class {@code PrinterState}. 113 */ 114 protected String[] getStringTable() { 115 return myStringTable; 116 } 117 118 /** 119 * Returns the enumeration value table for class {@code PrinterState}. 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 PrinterState}, the category is class 130 * {@code PrinterState} 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 PrinterState.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 PrinterState}, the category name is 144 * {@code "printer-state"}. 145 * 146 * @return attribute category name 147 */ 148 public final String getName() { 149 return "printer-state"; 150 } 151 } |