Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/event/PrintJobEvent.java
38830 views
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</code> 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</code> object.
90
*
91
* @param source a <code>DocPrintJob</code> object
92
* @param reason an int specifying the reason.
93
* @throws IllegalArgumentException if <code>source</code> is
94
* <code>null</code>.
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</code> to which this print job
113
* event pertains.
114
*
115
* @return the <code>DocPrintJob</code> object that represents the
116
* print job that reports the events encapsulated by this
117
* <code>PrintJobEvent</code>.
118
*
119
*/
120
public DocPrintJob getPrintJob() {
121
return (DocPrintJob) getSource();
122
}
123
124
125
}
126
127