Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/event/PrintJobEvent.java
41159 views
1
/*
2
* Copyright (c) 2000, 2021, 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 java.io.Serial;
29
30
import javax.print.DocPrintJob;
31
32
/**
33
* Class {@code PrintJobEvent} encapsulates common events a print job reports to
34
* let a listener know of progress in the processing of the {@link DocPrintJob}.
35
*/
36
public class PrintJobEvent extends PrintEvent {
37
38
/**
39
* Use serialVersionUID from JDK 1.4 for interoperability.
40
*/
41
@Serial
42
private static final long serialVersionUID = -1711656903622072997L;
43
44
/**
45
* The reason of this event.
46
*/
47
private int reason;
48
49
/**
50
* The job was canceled by the
51
* {@link javax.print.PrintService PrintService}.
52
*/
53
public static final int JOB_CANCELED = 101;
54
55
/**
56
* The document is completely printed.
57
*/
58
public static final int JOB_COMPLETE = 102;
59
60
/**
61
* The print service reports that the job cannot be completed. The
62
* application must resubmit the job.
63
*/
64
public static final int JOB_FAILED = 103;
65
66
/**
67
* The print service indicates that a - possibly transient - problem may
68
* require external intervention before the print service can continue. One
69
* example of an event that can generate this message is when the printer
70
* runs out of paper.
71
*/
72
public static final int REQUIRES_ATTENTION = 104;
73
74
/**
75
* Not all print services may be capable of delivering interesting events,
76
* or even telling when a job is complete. This message indicates the print
77
* job has no further information or communication with the print service.
78
* This message should always be delivered if a terminal event
79
* (completed/failed/canceled) is not delivered. For example, if messages
80
* such as {@code JOB_COMPLETE} have NOT been received before receiving this
81
* message, the only inference that should be drawn is that the print
82
* service does not support delivering such an event.
83
*/
84
public static final int NO_MORE_EVENTS = 105;
85
86
/**
87
* The job is not necessarily printed yet, but the data has been transferred
88
* successfully from the client to the print service. The client may free
89
* data resources.
90
*/
91
public static final int DATA_TRANSFER_COMPLETE = 106;
92
93
/**
94
* Constructs a {@code PrintJobEvent} object.
95
*
96
* @param source a {@code DocPrintJob} object
97
* @param reason an int specifying the reason
98
* @throws IllegalArgumentException if {@code source} is {@code null}
99
*/
100
public PrintJobEvent( DocPrintJob source, int reason) {
101
102
super(source);
103
this.reason = reason;
104
}
105
106
/**
107
* Gets the reason for this event.
108
*
109
* @return reason int
110
*/
111
public int getPrintEventType() {
112
return reason;
113
}
114
115
/**
116
* Determines the {@code DocPrintJob} to which this print job event
117
* pertains.
118
*
119
* @return the {@code DocPrintJob} object that represents the print job that
120
* reports the events encapsulated by this {@code PrintJobEvent}
121
*/
122
public DocPrintJob getPrintJob() {
123
return (DocPrintJob) getSource();
124
}
125
}
126
127