J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 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.TextSyntax; |
| 31 | import javax.print.attribute.PrintJobAttribute; |
| 32 | |
| 33 | /** |
| 34 | * Class JobMessageFromOperator is a printing attribute class, a text attribute, |
| 35 | * that provides a message from an operator, system administrator, or |
| 36 | * "intelligent" process to indicate to the end user the reasons for |
| 37 | * modification or other management action taken on a job. |
| 38 | * <P> |
| 39 | * A Print Job's attribute set includes zero instances or one instance of a |
| 40 | * JobMessageFromOperator attribute, not more than one instance. A new |
| 41 | * JobMessageFromOperator attribute replaces an existing JobMessageFromOperator |
| 42 | * attribute, if any. In other words, JobMessageFromOperator is not intended to |
| 43 | * be a history log. If it wishes, the client can detect changes to a Print |
| 44 | * Job's JobMessageFromOperator attribute and maintain the client's own history |
| 45 | * log of the JobMessageFromOperator attribute values. |
| 46 | * <P> |
| 47 | * <B>IPP Compatibility:</B> The string value gives the IPP name value. The |
| 48 | * locale gives the IPP natural language. The category name returned by |
| 49 | * <CODE>getName()</CODE> gives the IPP attribute name. |
| 50 | * <P> |
| 51 | * |
| 52 | * @author Alan Kaminsky |
| 53 | */ |
| 54 | public final class JobMessageFromOperator extends TextSyntax |
| 55 | implements PrintJobAttribute { |
| 56 | |
| 57 | private static final long serialVersionUID = -4620751846003142047L; |
| 58 | |
| 59 | /** |
| 60 | * Constructs a new job message from operator attribute with the given |
| 61 | * message and locale. |
| 62 | * |
| 63 | * @param message Message. |
| 64 | * @param locale Natural language of the text string. null |
| 65 | * is interpreted to mean the default locale as returned |
| 66 | * by <code>Locale.getDefault()</code> |
| 67 | * |
| 68 | * @exception NullPointerException |
| 69 | * (unchecked exception) Thrown if <CODE>message</CODE> is null. |
| 70 | */ |
| 71 | public JobMessageFromOperator(String message, Locale locale) { |
| 72 | super (message, locale); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Returns whether this job message from operator attribute is equivalent to |
| 77 | * the passed in object. To be equivalent, all of the following conditions |
| 78 | * must be true: |
| 79 | * <OL TYPE=1> |
| 80 | * <LI> |
| 81 | * <CODE>object</CODE> is not null. |
| 82 | * <LI> |
| 83 | * <CODE>object</CODE> is an instance of class JobMessageFromOperator. |
| 84 | * <LI> |
| 85 | * This job message from operator attribute's underlying string and |
| 86 | * <CODE>object</CODE>'s underlying string are equal. |
| 87 | * <LI> |
| 88 | * This job message from operator attribute's locale and |
| 89 | * <CODE>object</CODE>'s locale are equal. |
| 90 | * </OL> |
| 91 | * |
| 92 | * @param object Object to compare to. |
| 93 | * |
| 94 | * @return True if <CODE>object</CODE> is equivalent to this job |
| 95 | * message from operator attribute, false otherwise. |
| 96 | */ |
| 97 | public boolean equals(Object object) { |
| 98 | return (super.equals (object) && |
| 99 | object instanceof JobMessageFromOperator); |
| 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 JobMessageFromOperator, the |
| 107 | * category is class JobMessageFromOperator 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 JobMessageFromOperator.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 JobMessageFromOperator, the |
| 121 | * category name is <CODE>"job-message-from-operator"</CODE>. |
| 122 | * |
| 123 | * @return Attribute category name. |
| 124 | */ |
| 125 | public final String getName() { |
| 126 | return "job-message-from-operator"; |
| 127 | } |
| 128 | |
| 129 | } |