Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/event/PrintJobEvent.java
38830 views
/*1* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.print.event;2627import javax.print.DocPrintJob;2829/**30*31* Class <code>PrintJobEvent</code> encapsulates common events a print job32* reports to let a listener know of progress in the processing of the33* {@link DocPrintJob}.34*35*/3637public class PrintJobEvent extends PrintEvent {3839private static final long serialVersionUID = -1711656903622072997L;4041private int reason;4243/**44* The job was canceled by the {@link javax.print.PrintService PrintService}.45*/46public static final int JOB_CANCELED = 101;4748/**49* The document cis completely printed.50*/51public static final int JOB_COMPLETE = 102;5253/**54* The print service reports that the job cannot be completed.55* The application must resubmit the job.56*/5758public static final int JOB_FAILED = 103;5960/**61* The print service indicates that a - possibly transient - problem62* may require external intervention before the print service can63* continue. One example of an event that can64* generate this message is when the printer runs out of paper.65*/66public static final int REQUIRES_ATTENTION = 104;6768/**69* Not all print services may be capable of delivering interesting70* events, or even telling when a job is complete. This message indicates71* the print job has no further information or communication72* with the print service. This message should always be delivered73* if a terminal event (completed/failed/canceled) is not delivered.74* For example, if messages such as JOB_COMPLETE have NOT been received75* before receiving this message, the only inference that should be drawn76* is that the print service does not support delivering such an event.77*/78public static final int NO_MORE_EVENTS = 105;7980/**81* The job is not necessarily printed yet, but the data has been transferred82* successfully from the client to the print service. The client may83* free data resources.84*/85public static final int DATA_TRANSFER_COMPLETE = 106;8687/**88* Constructs a <code>PrintJobEvent</code> object.89*90* @param source a <code>DocPrintJob</code> object91* @param reason an int specifying the reason.92* @throws IllegalArgumentException if <code>source</code> is93* <code>null</code>.94*/9596public PrintJobEvent( DocPrintJob source, int reason) {9798super(source);99this.reason = reason;100}101102/**103* Gets the reason for this event.104* @return reason int.105*/106public int getPrintEventType() {107return reason;108}109110/**111* Determines the <code>DocPrintJob</code> to which this print job112* event pertains.113*114* @return the <code>DocPrintJob</code> object that represents the115* print job that reports the events encapsulated by this116* <code>PrintJobEvent</code>.117*118*/119public DocPrintJob getPrintJob() {120return (DocPrintJob) getSource();121}122123124}125126127