1. /*
  2. * @(#)PrintJobAttributeEvent.java 1.3 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.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 PrintJobAttributeSet attributes;
  18. /**
  19. * Constructs a PrintJobAttributeEvent object.
  20. * @param source the print job generating this event
  21. * @param attributes the attribute changes being reported
  22. */
  23. public PrintJobAttributeEvent (DocPrintJob source,
  24. PrintJobAttributeSet attributes) {
  25. super(source);
  26. this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
  27. }
  28. /**
  29. * Determine the Print Job to which this print job event pertains.
  30. *
  31. * @return Print Job object.
  32. */
  33. public DocPrintJob getPrintJob() {
  34. return (DocPrintJob) getSource();
  35. }
  36. /**
  37. * Determine the printing attributes that changed and their new values.
  38. *
  39. * @return Attributes containing the new values for the print job
  40. * attributes that changed. The returned set may not be modifiable.
  41. */
  42. public PrintJobAttributeSet getAttributes() {
  43. return attributes;
  44. }
  45. }