DocPrintJob.java 5.4 KB

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