1. /*
  2. * @(#)PrintJobAttributeSet.java 1.4 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.print.attribute;
  8. /**
  9. * Interface PrintJobAttributeSet specifies the interface for a set of print
  10. * job attributes, i.e. printing attributes that implement interface {@link
  11. * PrintJobAttribute PrintJobAttribute}. In the Print Service API, a
  12. * service uses a PrintJobAttributeSet to report the status of a print job.
  13. * <P>
  14. * A PrintJobAttributeSet is just an {@link AttributeSet AttributeSet} whose
  15. * constructors and mutating operations guarantee an additional invariant,
  16. * namely that all attribute values in the PrintJobAttributeSet must be
  17. * instances of interface {@link PrintJobAttribute PrintJobAttribute}.
  18. * The {@link #add(Attribute) <CODE>add(Attribute)</CODE>}, and
  19. * {@link #addAll(AttributeSet) <CODE>addAll(AttributeSet)</CODE>} operations
  20. * are respecified below to guarantee this additional invariant.
  21. * <P>
  22. *
  23. * @author Alan Kaminsky
  24. */
  25. public interface PrintJobAttributeSet extends AttributeSet {
  26. /**
  27. * Adds the specified attribute value to this attribute set if it is not
  28. * already present, first removing any existing value in the same
  29. * attribute category as the specified attribute value (optional
  30. * operation).
  31. *
  32. * @param attribute Attribute value to be added to this attribute set.
  33. *
  34. * @return <tt>true</tt> if this attribute set changed as a result of
  35. * the call, i.e., the given attribute value was not already a
  36. * member of this attribute set.
  37. *
  38. * @throws UnmodifiableSetException
  39. * (unchecked exception) Thrown if this attribute set does not
  40. * support the <CODE>add()</CODE> operation.
  41. * @throws ClassCastException
  42. * (unchecked exception) Thrown if the <CODE>attribute</CODE> is
  43. * not an instance of interface
  44. * {@link PrintJobAttribute PrintJobAttribute}.
  45. * @throws NullPointerException
  46. * (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
  47. */
  48. public boolean add(Attribute attribute);
  49. /**
  50. * Adds all of the elements in the specified set to this attribute.
  51. * The outcome is the same as if the
  52. * {@link #add(Attribute) <CODE>add(Attribute)</CODE>}
  53. * operation had been applied to this attribute set successively with
  54. * each element from the specified set. If none of the categories in the
  55. * specified set are the same as any categories in this attribute set,
  56. * the <tt>addAll()</tt> operation effectively modifies this attribute
  57. * set so that its value is the <i>union</i> of the two sets.
  58. * <P>
  59. * The behavior of the <CODE>addAll()</CODE> operation is unspecified if
  60. * the specified set is modified while the operation is in progress.
  61. * <P>
  62. * If the <CODE>addAll()</CODE> operation throws an exception, the effect
  63. * on this attribute set's state is implementation dependent; elements
  64. * from the specified set before the point of the exception may or
  65. * may not have been added to this attribute set.
  66. *
  67. * @param attributes whose elements are to be added to this attribute
  68. * set.
  69. *
  70. * @return <tt>true</tt> if this attribute set changed as a result of
  71. * the call.
  72. *
  73. * @throws UnmodifiableSetException
  74. * (Unchecked exception) Thrown if this attribute set does not
  75. * support the <tt>addAll()</tt> method.
  76. * @throws ClassCastException
  77. * (Unchecked exception) Thrown if some element in the specified
  78. * set is not an instance of interface {@link PrintJobAttribute
  79. * PrintJobAttribute}.
  80. * @throws NullPointerException
  81. * (Unchecked exception) Thrown if the specified set is null.
  82. *
  83. * @see #add(Attribute)
  84. */
  85. public boolean addAll(AttributeSet attributes);
  86. }