2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
|
2
|
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
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
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 |
*
|
5506
|
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.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
package javax.print;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* This interface is used by a printing application to cancel a
|
|
30 |
* print job. This interface extends {@link DocPrintJob}. A
|
|
31 |
* <code>DocPrintJob</code> implementation returned from a print
|
|
32 |
* service implements this interface if the print job can be
|
|
33 |
* cancelled. Before trying to cancel
|
|
34 |
* a print job, the client needs to test if the
|
|
35 |
* <code>DocPrintJob</code> object returned from the print service
|
|
36 |
* actually implements this interface. Clients should never assume
|
|
37 |
* that a <code>DocPrintJob</code> implements this interface. A
|
|
38 |
* print service might support cancellation only for certain types
|
|
39 |
* of print data and representation class names. This means that
|
|
40 |
* only some of the <code>DocPrintJob</code> objects returned from
|
|
41 |
* a service will implement this interface.
|
|
42 |
* <p>
|
|
43 |
* Service implementors are encouraged to implement this optional interface
|
|
44 |
* and to deliver a javax.print.event.PrintJobEvent.JOB_CANCELLED event
|
|
45 |
* to any listeners if a job is successfully cancelled with an
|
|
46 |
* implementation of this interface. Services should also note that an
|
|
47 |
* implementation of this method may be made from a separate client thread
|
|
48 |
* than that which made the print request. Thus the implementation of
|
|
49 |
* this interface must be made thread safe.
|
|
50 |
*/
|
|
51 |
|
|
52 |
public interface CancelablePrintJob extends DocPrintJob {
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Stops further processing of a print job.
|
|
56 |
* <p>
|
|
57 |
* If a service supports this method it cannot be concluded that
|
21278
|
58 |
* job cancellation will always succeed. A job may not be able to be
|
2
|
59 |
* cancelled once it has reached and passed some point in its processing.
|
|
60 |
* A successful cancellation means only that the entire job was not
|
|
61 |
* printed, some portion may already have printed when cancel returns.
|
|
62 |
* <p>
|
|
63 |
* The service will throw a PrintException if the cancellation did not
|
|
64 |
* succeed. A job which has not yet been submitted for printing should
|
|
65 |
* throw this exception.
|
|
66 |
* Cancelling an already successfully cancelled Print Job is not
|
|
67 |
* considered an error and will always succeed.
|
|
68 |
* <p>
|
|
69 |
* Cancellation in some services may be a lengthy process, involving
|
|
70 |
* requests to a server and processing of its print queue. Clients
|
|
71 |
* may wish to execute cancel in a thread which does not affect
|
|
72 |
* application execution.
|
|
73 |
* @throws PrintException if the job could not be successfully cancelled.
|
|
74 |
*/
|
|
75 |
public void cancel() throws PrintException;
|
|
76 |
|
|
77 |
}
|