KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > PrintJobAttributeSet


1 /*
2  * @(#)PrintJobAttributeSet.java 1.5 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8
9 package javax.print.attribute;
10
11 /**
12  * Interface PrintJobAttributeSet specifies the interface for a set of print
13  * job attributes, i.e. printing attributes that implement interface {@link
14  * PrintJobAttribute PrintJobAttribute}. In the Print Service API, a
15  * service uses a PrintJobAttributeSet to report the status of a print job.
16  * <P>
17  * A PrintJobAttributeSet is just an {@link AttributeSet AttributeSet} whose
18  * constructors and mutating operations guarantee an additional invariant,
19  * namely that all attribute values in the PrintJobAttributeSet must be
20  * instances of interface {@link PrintJobAttribute PrintJobAttribute}.
21  * The {@link #add(Attribute) <CODE>add(Attribute)</CODE>}, and
22  * {@link #addAll(AttributeSet) <CODE>addAll(AttributeSet)</CODE>} operations
23  * are respecified below to guarantee this additional invariant.
24  * <P>
25  *
26  * @author Alan Kaminsky
27  */

28 public interface PrintJobAttributeSet extends AttributeSet JavaDoc {
29
30     /**
31      * Adds the specified attribute value to this attribute set if it is not
32      * already present, first removing any existing value in the same
33      * attribute category as the specified attribute value (optional
34      * operation).
35      *
36      * @param attribute Attribute value to be added to this attribute set.
37      *
38      * @return <tt>true</tt> if this attribute set changed as a result of
39      * the call, i.e., the given attribute value was not already a
40      * member of this attribute set.
41      *
42      * @throws UnmodifiableSetException
43      * (unchecked exception) Thrown if this attribute set does not
44      * support the <CODE>add()</CODE> operation.
45      * @throws ClassCastException
46      * (unchecked exception) Thrown if the <CODE>attribute</CODE> is
47      * not an instance of interface
48      * {@link PrintJobAttribute PrintJobAttribute}.
49      * @throws NullPointerException
50      * (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
51      */

52     public boolean add(Attribute JavaDoc attribute);
53
54     /**
55      * Adds all of the elements in the specified set to this attribute.
56      * The outcome is the same as if the
57      * {@link #add(Attribute) <CODE>add(Attribute)</CODE>}
58      * operation had been applied to this attribute set successively with
59      * each element from the specified set. If none of the categories in the
60      * specified set are the same as any categories in this attribute set,
61      * the <tt>addAll()</tt> operation effectively modifies this attribute
62      * set so that its value is the <i>union</i> of the two sets.
63      * <P>
64      * The behavior of the <CODE>addAll()</CODE> operation is unspecified if
65      * the specified set is modified while the operation is in progress.
66      * <P>
67      * If the <CODE>addAll()</CODE> operation throws an exception, the effect
68      * on this attribute set's state is implementation dependent; elements
69      * from the specified set before the point of the exception may or
70      * may not have been added to this attribute set.
71      *
72      * @param attributes whose elements are to be added to this attribute
73      * set.
74      *
75      * @return <tt>true</tt> if this attribute set changed as a result of
76      * the call.
77      *
78      * @throws UnmodifiableSetException
79      * (Unchecked exception) Thrown if this attribute set does not
80      * support the <tt>addAll()</tt> method.
81      * @throws ClassCastException
82      * (Unchecked exception) Thrown if some element in the specified
83      * set is not an instance of interface {@link PrintJobAttribute
84      * PrintJobAttribute}.
85      * @throws NullPointerException
86      * (Unchecked exception) Thrown if the specified set is null.
87      *
88      * @see #add(Attribute)
89      */

90     public boolean addAll(AttributeSet JavaDoc attributes);
91 }
92
Popular Tags