KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)PrintServiceAttributeSet.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 PrintServiceAttributeSet specifies the interface for a set of
13  * print job attributes, i.e. printing attributes that implement interface
14  * {@link
15  * PrintServiceAttribute PrintServiceAttribute}. In the Print Service API,
16  * the Print Service instance uses a PrintServiceAttributeSet to report the
17  * status of the print service.
18  * <P>
19  * A PrintServiceAttributeSet is just an {@link AttributeSet AttributeSet}
20  * whose constructors and mutating operations guarantee an additional
21  * invariant,
22  * namely that all attribute values in the PrintServiceAttributeSet must be
23  * instances of interface {@link PrintServiceAttribute PrintServiceAttribute}.
24  * The {@link #add(Attribute) <CODE>add(Attribute)</CODE>}, and
25  * {@link #addAll(AttributeSet) <CODE>addAll(AttributeSet)</CODE>} operations
26  * are respecified below to guarantee this additional invariant.
27  * <P>
28  *
29  * @author Alan Kaminsky
30  */

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

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

95     public boolean addAll(AttributeSet JavaDoc attributes);
96 }
97
Popular Tags