| 1 |
772 |
jeremybenn |
/* DocPrintJob.java --
|
| 2 |
|
|
Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
| 3 |
|
|
|
| 4 |
|
|
This file is part of GNU Classpath.
|
| 5 |
|
|
|
| 6 |
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
| 7 |
|
|
it under the terms of the GNU General Public License as published by
|
| 8 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
| 9 |
|
|
any later version.
|
| 10 |
|
|
|
| 11 |
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
| 12 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
|
|
General Public License for more details.
|
| 15 |
|
|
|
| 16 |
|
|
You should have received a copy of the GNU General Public License
|
| 17 |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
| 18 |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
| 19 |
|
|
02110-1301 USA.
|
| 20 |
|
|
|
| 21 |
|
|
Linking this library statically or dynamically with other modules is
|
| 22 |
|
|
making a combined work based on this library. Thus, the terms and
|
| 23 |
|
|
conditions of the GNU General Public License cover the whole
|
| 24 |
|
|
combination.
|
| 25 |
|
|
|
| 26 |
|
|
As a special exception, the copyright holders of this library give you
|
| 27 |
|
|
permission to link this library with independent modules to produce an
|
| 28 |
|
|
executable, regardless of the license terms of these independent
|
| 29 |
|
|
modules, and to copy and distribute the resulting executable under
|
| 30 |
|
|
terms of your choice, provided that you also meet, for each linked
|
| 31 |
|
|
independent module, the terms and conditions of the license of that
|
| 32 |
|
|
module. An independent module is a module which is not derived from
|
| 33 |
|
|
or based on this library. If you modify this library, you may extend
|
| 34 |
|
|
this exception to your version of the library, but you are not
|
| 35 |
|
|
obligated to do so. If you do not wish to do so, delete this
|
| 36 |
|
|
exception statement from your version. */
|
| 37 |
|
|
|
| 38 |
|
|
|
| 39 |
|
|
package javax.print;
|
| 40 |
|
|
|
| 41 |
|
|
import javax.print.attribute.PrintJobAttributeSet;
|
| 42 |
|
|
import javax.print.attribute.PrintRequestAttributeSet;
|
| 43 |
|
|
import javax.print.event.PrintJobAttributeListener;
|
| 44 |
|
|
import javax.print.event.PrintJobListener;
|
| 45 |
|
|
|
| 46 |
|
|
/**
|
| 47 |
|
|
* <code>DocPrintJob</code> represents a print job which supports printing
|
| 48 |
|
|
* of a single document.
|
| 49 |
|
|
* <p>
|
| 50 |
|
|
* An instance can be obtained from every <code>PrintService</code> available
|
| 51 |
|
|
* by calling the {@link javax.print.PrintService#createPrintJob()} method.
|
| 52 |
|
|
* A print job is bound to the print service it is created from.
|
| 53 |
|
|
* </p>
|
| 54 |
|
|
*
|
| 55 |
|
|
* @author Michael Koch (konqueror@gmx.de)
|
| 56 |
|
|
*/
|
| 57 |
|
|
public interface DocPrintJob
|
| 58 |
|
|
{
|
| 59 |
|
|
/**
|
| 60 |
|
|
* Registers a listener for changes in the specified attribute set
|
| 61 |
|
|
* during processing of this print job.
|
| 62 |
|
|
* <p>
|
| 63 |
|
|
* If the given attribute set is empty no changes will be reported.
|
| 64 |
|
|
* If the set is <code>null</code> all attributes are monitored.
|
| 65 |
|
|
* </p>
|
| 66 |
|
|
*
|
| 67 |
|
|
* @param listener the listener to register.
|
| 68 |
|
|
* @param attributes the attributes to observe.
|
| 69 |
|
|
*
|
| 70 |
|
|
* @see #removePrintJobAttributeListener(PrintJobAttributeListener)
|
| 71 |
|
|
*/
|
| 72 |
|
|
void addPrintJobAttributeListener(PrintJobAttributeListener listener,
|
| 73 |
|
|
PrintJobAttributeSet attributes);
|
| 74 |
|
|
|
| 75 |
|
|
/**
|
| 76 |
|
|
* Registers a listener for events occuring during processing
|
| 77 |
|
|
* of this print job.
|
| 78 |
|
|
*
|
| 79 |
|
|
* @param listener the listener to add, if <code>null</code> nothing is done.
|
| 80 |
|
|
*
|
| 81 |
|
|
* @see #removePrintJobListener(PrintJobListener)
|
| 82 |
|
|
*/
|
| 83 |
|
|
void addPrintJobListener(PrintJobListener listener);
|
| 84 |
|
|
|
| 85 |
|
|
/**
|
| 86 |
|
|
* Returns the print job's attributes.
|
| 87 |
|
|
* <p>
|
| 88 |
|
|
* The returned set of attributes is a snapshot at the time of calling this
|
| 89 |
|
|
* method and will not be updated if changes to the print job's attributes
|
| 90 |
|
|
* happens. To monitor changes register a print job listener.
|
| 91 |
|
|
* </p>
|
| 92 |
|
|
*
|
| 93 |
|
|
* @return The attributes of this print job,
|
| 94 |
|
|
* may be empty but never <code>null</code>.
|
| 95 |
|
|
*/
|
| 96 |
|
|
PrintJobAttributeSet getAttributes();
|
| 97 |
|
|
|
| 98 |
|
|
/**
|
| 99 |
|
|
* Returns the <code>PrintService</code> object this print job is bound to.
|
| 100 |
|
|
*
|
| 101 |
|
|
* @return The print service.
|
| 102 |
|
|
*/
|
| 103 |
|
|
PrintService getPrintService();
|
| 104 |
|
|
|
| 105 |
|
|
/**
|
| 106 |
|
|
* Prints a document with the specified print job attributes.
|
| 107 |
|
|
*
|
| 108 |
|
|
* <p>
|
| 109 |
|
|
* If the doc flavor provided by the <code>Doc</code> implementation is
|
| 110 |
|
|
* not supported by this print service a <code>PrintException</code>
|
| 111 |
|
|
* implementing the <code>FlavorException</code> interface will be thrown.
|
| 112 |
|
|
* </p>
|
| 113 |
|
|
*
|
| 114 |
|
|
* @param doc the document to print
|
| 115 |
|
|
* @param attributes the job attributes to use. If <code>null</code> the
|
| 116 |
|
|
* default attribute values of the print service will be used.
|
| 117 |
|
|
*
|
| 118 |
|
|
* @throws PrintException if an error occurs. The thrown exception may
|
| 119 |
|
|
* implement refining print exception interface to provide more detail of
|
| 120 |
|
|
* the error.
|
| 121 |
|
|
*
|
| 122 |
|
|
* @see AttributeException
|
| 123 |
|
|
* @see FlavorException
|
| 124 |
|
|
*/
|
| 125 |
|
|
void print(Doc doc, PrintRequestAttributeSet attributes) throws PrintException;
|
| 126 |
|
|
|
| 127 |
|
|
/**
|
| 128 |
|
|
* Removes the given listener from the listeners registered for changes
|
| 129 |
|
|
* in their provided attribute set during processing of this print job.
|
| 130 |
|
|
*
|
| 131 |
|
|
* @param listener the listener to remove, if <code>null</code> or not
|
| 132 |
|
|
* registered nothing will be done.
|
| 133 |
|
|
*
|
| 134 |
|
|
* @see #addPrintJobAttributeListener(PrintJobAttributeListener, PrintJobAttributeSet)
|
| 135 |
|
|
*/
|
| 136 |
|
|
void removePrintJobAttributeListener(PrintJobAttributeListener listener);
|
| 137 |
|
|
|
| 138 |
|
|
/**
|
| 139 |
|
|
* Removes the given listener from the listeners registered for events
|
| 140 |
|
|
* occuring during processing of this print job.
|
| 141 |
|
|
*
|
| 142 |
|
|
* @param listener the listener to remove, if <code>null</code> or not
|
| 143 |
|
|
* registered nothing will be done.
|
| 144 |
|
|
*
|
| 145 |
|
|
* @see #addPrintJobListener(PrintJobListener)
|
| 146 |
|
|
*/
|
| 147 |
|
|
void removePrintJobListener(PrintJobListener listener);
|
| 148 |
|
|
}
|