1. /*
  2. * @(#)PrintJobAttributeEvent.java 1.6 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.event;
  8. import javax.print.DocPrintJob;
  9. import javax.print.attribute.AttributeSetUtilities;
  10. import javax.print.attribute.PrintJobAttributeSet;
  11. /**
  12. * Class PrintJobAttributeEvent encapsulates an event a PrintService
  13. * reports to let the client know that one or more printing attributes for a
  14. * PrintJob have changed.
  15. */
  16. public class PrintJobAttributeEvent extends PrintEvent {
  17. private static final long serialVersionUID = -6534469883874742101L;
  18. private PrintJobAttributeSet attributes;
  19. /**
  20. * Constructs a PrintJobAttributeEvent object.
  21. * @param source the print job generating this event
  22. * @param attributes the attribute changes being reported
  23. * @throws IllegalArgumentException if <code>source</code> is
  24. * <code>null</code>.
  25. */
  26. public PrintJobAttributeEvent (DocPrintJob source,
  27. PrintJobAttributeSet attributes) {
  28. super(source);
  29. this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
  30. }
  31. /**
  32. * Determine the Print Job to which this print job event pertains.
  33. *
  34. * @return Print Job object.
  35. */
  36. public DocPrintJob getPrintJob() {
  37. return (DocPrintJob) getSource();
  38. }
  39. /**
  40. * Determine the printing attributes that changed and their new values.
  41. *
  42. * @return Attributes containing the new values for the print job
  43. * attributes that changed. The returned set may not be modifiable.
  44. */
  45. public PrintJobAttributeSet getAttributes() {
  46. return attributes;
  47. }
  48. }