001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import javax.print.attribute.Attribute;
028 import javax.print.attribute.EnumSyntax;
029 import javax.print.attribute.DocAttribute;
030 import javax.print.attribute.PrintRequestAttribute;
031 import javax.print.attribute.PrintJobAttribute;
032
033 /**
034 * Class PrintQuality is a printing attribute class, an enumeration,
035 * that specifies the print quality that the printer uses for the job.
036 * <P>
037 * <B>IPP Compatibility:</B> The category name returned by
038 * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
039 * integer value is the IPP enum value. The <code>toString()</code> method
040 * returns the IPP string representation of the attribute value.
041 * <P>
042 *
043 * @author David Mendenhall
044 * @author Alan Kaminsky
045 */
046 public class PrintQuality extends EnumSyntax implements DocAttribute,
047 PrintRequestAttribute, PrintJobAttribute {
048
049 private static final long serialVersionUID = -3072341285225858365L;
050 /**
051 * Lowest quality available on the printer.
052 */
053 public static final PrintQuality DRAFT = new PrintQuality(3);
054
055 /**
056 * Normal or intermediate quality on the printer.
057 */
058 public static final PrintQuality NORMAL = new PrintQuality(4);
059
060 /**
061 * Highest quality available on the printer.
062 */
063 public static final PrintQuality HIGH = new PrintQuality(5);
064
065 /**
066 * Construct a new print quality enumeration value with the given integer
067 * value.
068 *
069 * @param value Integer value.
070 */
071 protected PrintQuality(int value) {
072 super (value);
073 }
074
075 private static final String[] myStringTable = { "draft", "normal",
076 "high" };
077
078 private static final PrintQuality[] myEnumValueTable = { DRAFT,
079 NORMAL, HIGH };
080
081 /**
082 * Returns the string table for class PrintQuality.
083 */
084 protected String[] getStringTable() {
085 return (String[]) myStringTable.clone();
086 }
087
088 /**
089 * Returns the enumeration value table for class PrintQuality.
090 */
091 protected EnumSyntax[] getEnumValueTable() {
092 return (EnumSyntax[]) myEnumValueTable.clone();
093 }
094
095 /**
096 * Returns the lowest integer value used by class PrintQuality.
097 */
098 protected int getOffset() {
099 return 3;
100 }
101
102 /**
103 * Get the printing attribute class which is to be used as the "category"
104 * for this printing attribute value.
105 * <P>
106 * For class PrintQuality and any vendor-defined subclasses, the category is
107 * class PrintQuality itself.
108 *
109 * @return Printing attribute class (category), an instance of class
110 * {@link java.lang.Class java.lang.Class}.
111 */
112 public final Class<? extends Attribute> getCategory() {
113 return PrintQuality.class;
114 }
115
116 /**
117 * Get the name of the category of which this attribute value is an
118 * instance.
119 * <P>
120 * For class PrintQuality and any vendor-defined subclasses, the category
121 * name is <CODE>"print-quality"</CODE>.
122 *
123 * @return Attribute category name.
124 */
125 public final String getName() {
126 return "print-quality";
127 }
128
129 }
|