PrinterJob.java 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /* PrinterJob.java -- This job is the printer control class
  2. Copyright (C) 1999 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., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 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 java.awt.print;
  32. /**
  33. * This class controls printing.
  34. *
  35. * @author Aaron M. Renn (arenn@urbanophile.com)
  36. */
  37. public abstract class PrinterJob
  38. {
  39. /*
  40. * Class Methods
  41. */
  42. /**
  43. * Creates a new print job.
  44. *
  45. * @return A <code>PrinterJob</code> object for the newly created print job.
  46. */
  47. public static PrinterJob
  48. getPrinterJob()
  49. {
  50. // FIXME: Need to fix this to load a default implementation instance.
  51. return(null);
  52. }
  53. /*************************************************************************/
  54. /*
  55. * Constructors
  56. */
  57. /**
  58. * Initializes a new instance of <code>PrinterJob</code>.
  59. */
  60. public
  61. PrinterJob()
  62. {
  63. ;
  64. }
  65. /*************************************************************************/
  66. /*
  67. * Instance Methods
  68. */
  69. /**
  70. * Returns the number of copies to be printed.
  71. *
  72. * @return The number of copies to be printed.
  73. */
  74. public abstract int
  75. getCopies();
  76. /*************************************************************************/
  77. /**
  78. * Sets the number of copies to be printed.
  79. *
  80. * @param copies The number of copies to be printed.
  81. */
  82. public abstract void
  83. setCopies();
  84. /*************************************************************************/
  85. /**
  86. * Returns the name of the print job.
  87. *
  88. * @return The name of the print job.
  89. */
  90. public abstract String
  91. getJobName();
  92. /*************************************************************************/
  93. /**
  94. * Sets the name of the print job.
  95. *
  96. * @param job_name The name of the print job.
  97. */
  98. public abstract String
  99. setJobName(String job_name);
  100. /*************************************************************************/
  101. /**
  102. * Returns the printing user name.
  103. *
  104. * @return The printing username.
  105. */
  106. public abstract String
  107. getUserName();
  108. /*************************************************************************/
  109. /**
  110. * Cancels an in progress print job.
  111. */
  112. public abstract void
  113. cancel();
  114. /*************************************************************************/
  115. /**
  116. * Tests whether or not this job has been cancelled.
  117. *
  118. * @param <code>true</code> if this job has been cancelled, <code>false</code>
  119. * otherwise.
  120. */
  121. public abstract boolean
  122. isCancelled();
  123. /*************************************************************************/
  124. /**
  125. * Returns an instance of the default page which will have the default
  126. * paper and orientation.
  127. *
  128. * @return A default instance of <code>PageFormat</code>.
  129. */
  130. public PageFormat
  131. defaultPage()
  132. {
  133. return(new PageFormat());
  134. }
  135. /*************************************************************************/
  136. /**
  137. * Clones the specified <code>PageFormat</code> object then alters the
  138. * clone so that it represents the default page format.
  139. *
  140. * @param page_format The <code>PageFormat</code> to clone.
  141. *
  142. * @return A new default page format.
  143. */
  144. public abstract PageFormat
  145. defaultPage(PageFormat page_format);
  146. /*************************************************************************/
  147. /**
  148. * Displays a dialog box to the user which allows the page format
  149. * attributes to be modified.
  150. *
  151. * @param page_format The <code>PageFormat</code> object to modify.
  152. *
  153. * @return The modified <code>PageFormat</code>.
  154. */
  155. public abstract PageFormat
  156. pageDialog(PageFormat page_format);
  157. /*************************************************************************/
  158. /**
  159. * Prints the pages.
  160. */
  161. public abstract void
  162. print();
  163. /**
  164. * Displays a dialog box to the user which allows the print job
  165. * attributes to be modified.
  166. *
  167. * @return <code>false</code> if the user cancels the dialog box,
  168. * <code>true</code> otherwise.
  169. */
  170. public abstract boolean
  171. printDialog();
  172. /*************************************************************************/
  173. /**
  174. * This sets the pages that are to be printed.
  175. *
  176. * @param pageable The pages to be printed, which may not be <code>null</code>.
  177. */
  178. public abstract void
  179. setPageable(Pageable pageable);
  180. /*************************************************************************/
  181. /**
  182. * Sets this specified <code>Printable</code> as the one to use for
  183. * rendering the pages on the print device.
  184. *
  185. * @param printable The <code>Printable</code> for the print job.
  186. */
  187. public abstract void
  188. setPrintable(Printable printable);
  189. /*************************************************************************/
  190. /**
  191. * Sets the <code>Printable</code> and the page format for the pages
  192. * to be printed.
  193. *
  194. * @param printable The <code>Printable</code> for the print job.
  195. * @param page_format The <code>PageFormat</code> for the print job.
  196. */
  197. public abstract void
  198. setPrintable(Printable printable, PageFormat page_format);
  199. /*************************************************************************/
  200. /**
  201. * Makes any alterations to the specified <code>PageFormat</code>
  202. * necessary to make it work with the current printer. The alterations
  203. * are made to a clone of the input object, which is then returned.
  204. *
  205. * @param page_format The <code>PageFormat</code> to validate.
  206. *
  207. * @return The validated <code>PageFormat</code>.
  208. */
  209. public abstract PageFormat
  210. validatePage(PageFormat page);
  211. } // class PrinterJob