1. /*
  2. * @(#)PrintServiceAttributeEvent.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 java.util.List;
  9. import javax.print.PrintService;
  10. import javax.print.attribute.AttributeSetUtilities;
  11. import javax.print.attribute.PrintServiceAttributeSet;
  12. /**
  13. *
  14. * Class PrintServiceAttributeEvent encapsulates an event a
  15. * Print Service instance reports to let the client know of
  16. * changes in the print service state.
  17. */
  18. public class PrintServiceAttributeEvent extends PrintEvent {
  19. private static final long serialVersionUID = -7565987018140326600L;
  20. private PrintServiceAttributeSet attributes;
  21. /**
  22. * Constructs a PrintServiceAttributeEvent object.
  23. *
  24. * @param source the print job generating this event
  25. * @param attributes the attribute changes being reported
  26. * @throws IllegalArgumentException if <code>source</code> is
  27. * <code>null</code>.
  28. */
  29. public PrintServiceAttributeEvent(PrintService source,
  30. PrintServiceAttributeSet attributes) {
  31. super(source);
  32. this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
  33. }
  34. /**
  35. * Returns the print service.
  36. * @return Print Service object.
  37. */
  38. public PrintService getPrintService() {
  39. return (PrintService) getSource();
  40. }
  41. /**
  42. * Determine the printing service attributes that changed and their new
  43. * values.
  44. *
  45. * @return Attributes containing the new values for the service
  46. * attributes that changed. The returned set may be unmodifiable.
  47. */
  48. public PrintServiceAttributeSet getAttributes() {
  49. return attributes;
  50. }
  51. }