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