1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
/* * @(#)PrintJobEvent.java 1.10 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.print.event; import javax.print.DocPrintJob; /** * * Class <code>PrintJobEvent</code> encapsulates common events a print job * reports to let a listener know of progress in the processing of the * {@link DocPrintJob}. * */ public class PrintJobEvent extends PrintEvent { private static final long serialVersionUID = -1711656903622072997L; private int reason; /** * The job was canceled by the {@link javax.print.PrintService PrintService}. */ public static final int JOB_CANCELED = 101; /** * The document cis completely printed. */ public static final int JOB_COMPLETE = 102; /** * The print service reports that the job cannot be completed. * The application must resubmit the job. */ public static final int JOB_FAILED = 103; /** * The print service indicates that a - possibly transient - problem * may require external intervention before the print service can * continue. One example of an event that can * generate this message is when the printer runs out of paper. */ public static final int REQUIRES_ATTENTION = 104; /** * Not all print services may be capable of delivering interesting * events, or even telling when a job is complete. This message indicates * the print job has no further information or communication * with the print service. This message should always be delivered * if a terminal event (completed/failed/canceled) is not delivered. * For example, if messages such as JOB_COMPLETE have NOT been received * before receiving this message, the only inference that should be drawn * is that the print service does not support delivering such an event. */ public static final int NO_MORE_EVENTS = 105; /** * The job is not necessarily printed yet, but the data has been transferred * successfully from the client to the print service. The client may * free data resources. */ public static final int DATA_TRANSFER_COMPLETE = 106; /** * Constructs a <code>PrintJobEvent</code> object. * * @param source a <code>DocPrintJob</code> object * @param reason an int specifying the reason. * @throws IllegalArgumentException if <code>source</code> is * <code>null</code>. */ public PrintJobEvent( DocPrintJob source, int reason) { super(source); this.reason = reason; } /** * Gets the reason for this event. * @return reason int. */ public int getPrintEventType() { return reason; } /** * Determines the <code>DocPrintJob</code> to which this print job * event pertains. * * @return the <code>DocPrintJob</code> object that represents the * print job that reports the events encapsulated by this * <code>PrintJobEvent</code>. * */ public DocPrintJob getPrintJob() { return (DocPrintJob) getSource(); } }