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