1 /*
2 * Copyright 2000-2004 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25 package javax.print.attribute.standard;
26
27 import java.util.Locale;
28
29 import javax.print.attribute.Attribute;
30 import javax.print.attribute.EnumSyntax;
31 import javax.print.attribute.PrintRequestAttribute;
32 import javax.print.attribute.PrintJobAttribute;
33
34 /**
35 * Class JobSheets is a printing attribute class, an enumeration, that
36 * determines which job start and end sheets, if any, must be printed with a
37 * job. Class JobSheets declares keywords for standard job sheets values.
38 * Implementation- or site-defined names for a job sheets attribute may also be
39 * created by defining a subclass of class JobSheets.
40 * <P>
41 * The effect of a JobSheets attribute on multidoc print jobs (jobs with
42 * multiple documents) may be affected by the {@link MultipleDocumentHandling
43 * MultipleDocumentHandling} job attribute, depending on the meaning of the
44 * particular JobSheets value.
45 * <P>
46 * <B>IPP Compatibility:</B> The category name returned by
47 * <CODE>getName()</CODE> is the IPP attribute name. The
48 * enumeration's integer value is the IPP enum value. The
49 * <code>toString()</code> method returns the IPP string representation of
50 * the attribute value. For a subclass, the attribute value must be
51 * localized to give the IPP name and natural language values.
52 * <P>
53 *
54 * @author Alan Kaminsky
55 */
56 public class JobSheets extends EnumSyntax
57 implements PrintRequestAttribute, PrintJobAttribute {
58
59 private static final long serialVersionUID = -4735258056132519759L;
60
61 /**
62 * No job sheets are printed.
63 */
64 public static final JobSheets NONE = new JobSheets(0);
65
66 /**
67 * One or more site specific standard job sheets are printed. e.g. a
68 * single start sheet is printed, or both start and end sheets are
69 * printed.
70 */
71 public static final JobSheets STANDARD = new JobSheets(1);
72
73 /**
74 * Construct a new job sheets enumeration value with the given integer
75 * value.
76 *
77 * @param value Integer value.
78 */
79 protected JobSheets(int value) {
80 super (value);
81 }
82
83 private static final String[] myStringTable = {
84 "none",
85 "standard"
86 };
87
88 private static final JobSheets[] myEnumValueTable = {
89 NONE,
90 STANDARD
91 };
92
93 /**
94 * Returns the string table for class JobSheets.
95 */
96 protected String[] getStringTable() {
97 return (String[])myStringTable.clone();
98 }
99
100 /**
101 * Returns the enumeration value table for class JobSheets.
102 */
103 protected EnumSyntax[] getEnumValueTable() {
104 return (EnumSyntax[])myEnumValueTable.clone();
105 }
106
107 /**
108 * Get the printing attribute class which is to be used as the "category"
109 * for this printing attribute value.
110 * <P>
111 * For class JobSheets and any vendor-defined subclasses, the category is
112 * class JobSheets itself.
113 *
114 * @return Printing attribute class (category), an instance of class
115 * {@link java.lang.Class java.lang.Class}.
116 */
117 public final Class<? extends Attribute> getCategory() {
118 return JobSheets.class;
119 }
120
121 /**
122 * Get the name of the category of which this attribute value is an
123 * instance.
124 * <P>
125 * For class JobSheets and any vendor-defined subclasses, the category
126 * name is <CODE>"job-sheets"</CODE>.
127 *
128 * @return Attribute category name.
129 */
130 public final String getName() {
131 return "job-sheets";
132 }
133
134 }