KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)PrintRequestAttributeSet.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 PrintRequestAttributeSet specifies the interface for a set of
13  * print request attributes, i.e. printing attributes that implement interface
14  * {@link PrintRequestAttribute PrintRequestAttribute}.
15  * The client uses a PrintRequestAttributeSet to specify the settings to be
16  * applied to a whole print job and to all the docs in the print job.
17  * <P>
18  * PrintRequestAttributeSet is just an {@link AttributeSet AttributeSet} whose
19  * constructors and mutating operations guarantee an additional invariant,
20  * namely that all attribute values in the PrintRequestAttributeSet must be
21  * instances of interface {@link PrintRequestAttribute PrintRequestAttribute}.
22  * The {@link #add(Attribute) <CODE>add(Attribute)</CODE>}, and
23  * {@link #addAll(AttributeSet) <CODE>addAll(AttributeSet)</CODE>} operations
24  * are respecified below to guarantee this additional invariant.
25  * <P>
26  *
27  * @author Alan Kaminsky
28  */

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

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

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