< prev index next >

src/java.desktop/share/classes/javax/print/event/PrintJobEvent.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.print.event;
  27 
  28 import javax.print.DocPrintJob;
  29 
  30 /**
  31  *
  32  * Class {@code PrintJobEvent} encapsulates common events a print job
  33  * reports to let a listener know of progress in the processing of the
  34  * {@link DocPrintJob}.
  35  *
  36  */
  37 
  38 public class PrintJobEvent extends PrintEvent {
  39 



  40    private static final long serialVersionUID = -1711656903622072997L;
  41 



  42    private int reason;
  43 
  44    /**
  45     * The job was canceled by the {@link javax.print.PrintService PrintService}.

  46     */
  47    public static final int JOB_CANCELED   = 101;
  48 
  49    /**
  50     * The document cis completely printed.
  51     */
  52    public static final int JOB_COMPLETE       = 102;
  53 
  54    /**
  55     * The print service reports that the job cannot be completed.
  56     * The application must resubmit the job.
  57     */
  58 
  59    public static final int JOB_FAILED         = 103;
  60 
  61    /**
  62     * The print service indicates that a - possibly transient - problem
  63     * may require external intervention before the print service can
  64     * continue.  One example of an event that can
  65     * generate this message is when the printer runs out of paper.
  66     */
  67    public static final int REQUIRES_ATTENTION = 104;
  68 
  69    /**
  70     * Not all print services may be capable of delivering interesting
  71     * events, or even telling when a job is complete. This message indicates
  72     * the print job has no further information or communication
  73     * with the print service. This message should always be delivered
  74     * if a terminal event (completed/failed/canceled) is not delivered.
  75     * For example, if messages such as JOB_COMPLETE have NOT been received
  76     * before receiving this message, the only inference that should be drawn
  77     * is that the print service does not support delivering such an event.
  78     */
  79    public static final int NO_MORE_EVENTS    = 105;
  80 
  81    /**
  82     * The job is not necessarily printed yet, but the data has been transferred
  83     * successfully from the client to the print service. The client may
  84     * free data resources.
  85     */
  86    public static final int DATA_TRANSFER_COMPLETE    = 106;
  87 
  88    /**
  89      * Constructs a {@code PrintJobEvent} object.
  90      *
  91      * @param source  a {@code DocPrintJob} object
  92      * @param reason  an int specifying the reason.
  93      * @throws IllegalArgumentException if {@code source} is
  94      *         {@code null}.
  95      */
  96 
  97     public PrintJobEvent( DocPrintJob source, int reason) {
  98 
  99         super(source);
 100         this.reason = reason;
 101    }
 102 
 103     /**
 104      * Gets the reason for this event.
 105      * @return  reason int.

 106      */
 107     public int getPrintEventType() {
 108         return reason;
 109     }
 110 
 111     /**
 112      * Determines the {@code DocPrintJob} to which this print job
 113      * event pertains.
 114      *
 115      * @return  the {@code DocPrintJob} object that represents the
 116      *          print job that reports the events encapsulated by this
 117      *          {@code PrintJobEvent}.
 118      *


 119      */
 120     public DocPrintJob getPrintJob() {
 121         return (DocPrintJob) getSource();
 122     }
 123 
 124 
 125 }
   1 /*
   2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.print.event;
  27 
  28 import javax.print.DocPrintJob;
  29 
  30 /**
  31  * Class {@code PrintJobEvent} encapsulates common events a print job reports to
  32  * let a listener know of progress in the processing of the {@link DocPrintJob}.



  33  */

  34 public class PrintJobEvent extends PrintEvent {
  35 
  36     /**
  37      * Use serialVersionUID from JDK 1.4 for interoperability.
  38      */
  39     private static final long serialVersionUID = -1711656903622072997L;
  40 
  41     /**
  42      * The reason of this event.
  43      */
  44     private int reason;
  45 
  46     /**
  47      * The job was canceled by the
  48      * {@link javax.print.PrintService PrintService}.
  49      */
  50     public static final int JOB_CANCELED = 101;
  51 
  52     /**
  53      * The document is completely printed.
  54      */
  55     public static final int JOB_COMPLETE = 102;
  56 
  57     /**
  58      * The print service reports that the job cannot be completed. The
  59      * application must resubmit the job.
  60      */

  61     public static final int JOB_FAILED = 103;
  62 
  63     /**
  64      * The print service indicates that a - possibly transient - problem may
  65      * require external intervention before the print service can continue. One
  66      * example of an event that can generate this message is when the printer
  67      * runs out of paper.
  68      */
  69     public static final int REQUIRES_ATTENTION = 104;
  70 
  71     /**
  72      * Not all print services may be capable of delivering interesting events,
  73      * or even telling when a job is complete. This message indicates the print
  74      * job has no further information or communication with the print service.
  75      * This message should always be delivered if a terminal event
  76      * (completed/failed/canceled) is not delivered. For example, if messages
  77      * such as {@code JOB_COMPLETE} have NOT been received before receiving this
  78      * message, the only inference that should be drawn is that the print
  79      * service does not support delivering such an event.
  80      */
  81     public static final int NO_MORE_EVENTS = 105;
  82 
  83     /**
  84      * The job is not necessarily printed yet, but the data has been transferred
  85      * successfully from the client to the print service. The client may free
  86      * data resources.
  87      */
  88     public static final int DATA_TRANSFER_COMPLETE = 106;
  89 
  90     /**
  91      * Constructs a {@code PrintJobEvent} object.
  92      *
  93      * @param  source a {@code DocPrintJob} object
  94      * @param  reason an int specifying the reason
  95      * @throws IllegalArgumentException if {@code source} is {@code null}

  96      */

  97     public PrintJobEvent( DocPrintJob source, int reason) {
  98 
  99         super(source);
 100         this.reason = reason;
 101     }
 102 
 103     /**
 104      * Gets the reason for this event.
 105      *
 106      * @return reason int
 107      */
 108     public int getPrintEventType() {
 109         return reason;
 110     }
 111 
 112     /**
 113      * Determines the {@code DocPrintJob} to which this print job event
 114      * pertains.




 115      *
 116      * @return the {@code DocPrintJob} object that represents the print job that
 117      *         reports the events encapsulated by this {@code PrintJobEvent}
 118      */
 119     public DocPrintJob getPrintJob() {
 120         return (DocPrintJob) getSource();
 121     }


 122 }
< prev index next >