/[classpath]/classpath/java/awt/print/PrinterJob.java
ViewVC logotype

Diff of /classpath/java/awt/print/PrinterJob.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by mkoch, Tue Jun 3 16:49:45 2003 UTC revision 1.6.2.1 by gnu_andrew, Sun Jan 16 02:14:47 2005 UTC
# Line 1  Line 1 
1  /* PrinterJob.java -- This job is the printer control class  /* PrinterJob.java -- This job is the printer control class
2     Copyright (C) 1999 Free Software Foundation, Inc.     Copyright (C) 1999, 2004  Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package java.awt.print;  package java.awt.print;
40    
41  /**  import javax.print.DocFlavor;
42    * This class controls printing.  import javax.print.PrintService;
43    *  import javax.print.PrintServiceLookup;
44    * @author Aaron M. Renn (arenn@urbanophile.com)  //import javax.print.StreamPrintServiceFactory;
45    */  import javax.print.attribute.PrintRequestAttributeSet;
 public abstract class PrinterJob  
 {  
   
 /*  
  * Class Methods  
  */  
46    
47  /**  /**
48    * Creates a new print job.   * This class controls printing.
49    *   *
50    * @return A <code>PrinterJob</code> object for the newly created print job.   * @author Aaron M. Renn (arenn@urbanophile.com)
   */  
 public static PrinterJob  
 getPrinterJob()  
 {  
   // FIXME: Need to fix this to load a default implementation instance.  
   return(null);  
 }  
   
 /*************************************************************************/  
   
 /*  
  * Constructors  
51   */   */
52    public abstract class PrinterJob
 /**  
   * Initializes a new instance of <code>PrinterJob</code>.  
   */  
 public  
 PrinterJob()  
53  {  {
54    ;    // The print service associated with this job
55  }    private PrintService printer = null;
   
 /*************************************************************************/  
   
 /*  
  * Instance Methods  
  */  
56    
57  /**    /**
58    * Returns the number of copies to be printed.     * Creates a new print job.
59    *     *
60    * @return The number of copies to be printed.     * @return A <code>PrinterJob</code> object for the newly created print job.
61    */     */
62  public abstract int    public static PrinterJob getPrinterJob()
63  getCopies();    {
64      // FIXME: Need to fix this to load a default implementation instance.
65  /*************************************************************************/      return null;
66      }
 /**  
   * Sets the number of copies to be printed.  
   *  
   * @param copies The number of copies to be printed.  
   */  
 public abstract void setCopies (int copies);  
   
 /*************************************************************************/  
   
 /**  
   * Returns the name of the print job.  
   *  
   * @return The name of the print job.  
   */  
 public abstract String  
 getJobName();  
   
 /*************************************************************************/  
   
 /**  
   * Sets the name of the print job.  
   *  
   * @param job_name The name of the print job.  
   */  
 public abstract void setJobName (String job_name);  
   
 /*************************************************************************/  
   
 /**  
   * Returns the printing user name.  
   *  
   * @return The printing username.  
   */  
 public abstract String  
 getUserName();  
   
 /*************************************************************************/  
   
 /**  
   * Cancels an in progress print job.  
   */  
 public abstract void  
 cancel();  
   
 /*************************************************************************/  
   
 /**  
   * Tests whether or not this job has been cancelled.  
   *  
   * @param <code>true</code> if this job has been cancelled, <code>false</code>  
   * otherwise.  
   */  
 public abstract boolean  
 isCancelled();  
   
 /*************************************************************************/  
67    
68  /**    /**
69    * Returns an instance of the default page which will have the default     * Initializes a new instance of <code>PrinterJob</code>.
70    * paper and orientation.     */
71    *    public PrinterJob()
72    * @return A default instance of <code>PageFormat</code>.    {
73    */    }
74  public PageFormat  
75  defaultPage()    /**
76  {     * Returns the number of copies to be printed.
77    return(new PageFormat());     *
78       * @return The number of copies to be printed.
79       */
80      public abstract int getCopies();
81    
82      /**
83       * Sets the number of copies to be printed.
84       *
85       * @param copies The number of copies to be printed.
86       */
87      public abstract void setCopies(int copies);
88    
89      /**
90       * Returns the name of the print job.
91       *
92       * @return The name of the print job.
93       */
94      public abstract String getJobName();
95    
96      /**
97       * Sets the name of the print job.
98       *
99       * @param job_name The name of the print job.
100       */
101      public abstract void setJobName(String job_name);
102    
103      /**
104       * Returns the printing user name.
105       *
106       * @return The printing username.
107       */
108      public abstract String getUserName();
109    
110      /**
111       * Cancels an in progress print job.
112       */
113      public abstract void cancel();
114    
115      /**
116       * Tests whether or not this job has been cancelled.
117       *
118       * @return <code>true</code> if this job has been cancelled, <code>false</code>
119       * otherwise.
120       */
121      public abstract boolean isCancelled();
122    
123      /**
124       * Returns an instance of the default page which will have the default
125       * paper and orientation.
126       *
127       * @return A default instance of <code>PageFormat</code>.
128       */
129      public PageFormat defaultPage()
130      {
131        return new PageFormat();
132      }
133    
134      /**
135       * Clones the specified <code>PageFormat</code> object then alters the
136       * clone so that it represents the default page format.
137       *
138       * @param page_format The <code>PageFormat</code> to clone.
139       *
140       * @return A new default page format.
141       */
142      public abstract PageFormat defaultPage(PageFormat page_format);
143    
144      /**
145       * Displays a dialog box to the user which allows the page format
146       * attributes to be modified.
147       *
148       * @param page_format The <code>PageFormat</code> object to modify.
149       *
150       * @return The modified <code>PageFormat</code>.
151       */
152      public abstract PageFormat pageDialog(PageFormat page_format);
153    
154      /**
155       * Prints the pages.
156       */
157      public abstract void print () throws PrinterException;
158    
159      /**
160       * Prints the page with given attributes.
161       */
162      public abstract void print (PrintRequestAttributeSet attributes)
163        throws PrinterException;
164    
165      /**
166       * Displays a dialog box to the user which allows the print job
167       * attributes to be modified.
168       *
169       * @return <code>false</code> if the user cancels the dialog box,
170       * <code>true</code> otherwise.
171       */
172      public abstract boolean printDialog();
173    
174      /**
175       * Displays a dialog box to the user which allows the print job
176       * attributes to be modified.
177       *
178       * @return <code>false</code> if the user cancels the dialog box,
179       * <code>true</code> otherwise.
180       */
181      public abstract boolean printDialog(PrintRequestAttributeSet attributes);
182    
183      /**
184       * This sets the pages that are to be printed.
185       *
186       * @param pageable The pages to be printed, which may not be <code>null</code>.
187       */
188      public abstract void setPageable(Pageable pageable);
189    
190      /**
191       * Sets this specified <code>Printable</code> as the one to use for
192       * rendering the pages on the print device.
193       *
194       * @param printable The <code>Printable</code> for the print job.
195       */
196      public abstract void setPrintable(Printable printable);
197    
198      /**
199       * Sets the <code>Printable</code> and the page format for the pages
200       * to be printed.
201       *
202       * @param printable The <code>Printable</code> for the print job.
203       * @param page_format The <code>PageFormat</code> for the print job.
204       */
205      public abstract void setPrintable(Printable printable, PageFormat page_format);
206    
207      /**
208       * Makes any alterations to the specified <code>PageFormat</code>
209       * necessary to make it work with the current printer.  The alterations
210       * are made to a clone of the input object, which is then returned.
211       *
212       * @param page_format The <code>PageFormat</code> to validate.
213       *
214       * @return The validated <code>PageFormat</code>.
215       */
216      public abstract PageFormat validatePage(PageFormat page_format);
217    
218      /**
219       * Find and return 2D image print services.
220       *
221       * This is the same as calling PrintServiceLookup.lookupPrintServices()
222       * with Pageable service-specified DocFlavor.
223       * @return Array of PrintService objects, could be empty.
224       * @since 1.4
225       */
226      public static PrintService[] lookupPrintServices()
227      {
228        return new PrintService[0];
229        // FIXME:
230        // Enable this when javax.print has this implemented.
231    //    return PrintServiceLookup.lookupPrintServices(
232    //          new DocFlavor("application/x-java-jvm-local-objectref",
233    //                        "java.awt.print.Pageable"),
234    //          null);
235      }
236    
237      /**
238       * Find and return 2D image stream print services.
239       *
240       * This is the same as calling
241       * StreamPrintServiceFactory.lookupStreamPrintServices()
242       * with Pageable service-specified DocFlavor.
243       * @param mimeType The output format mime type, or null for any type.
244       * @return Array of stream print services, could be empty.
245       * @since 1.4
246       */
247            // FIXME:
248            // Enable when javax.print has StreamPrintServiceFactory
249    //  public static StreamPrintServiceFactory[] lookupStreamPrintServices(String mimeType)
250    //  {
251    //    return StreamPrintServiceFactory.lookupStreamServiceFactories(
252    //      new DocFlavor("application/x-java-jvm-local-objectref",
253    //      "java.awt.print.Pageable"),
254    //      mimeType);
255    //  }
256    
257      /**
258       * Return the printer for this job.  If print services aren't supported by
259       * the subclass, returns null.
260       *
261       * @return The associated PrintService.
262       * @since 1.4
263       */
264      public PrintService getPrintService()
265      {
266        return null;
267      }
268    
269      /**
270       * Change the printer for this print job to service.  Subclasses that
271       * support setting the print service override this method.  Throws
272       * PrinterException when the class doesn't support setting the printer,
273       * the service doesn't support Pageable or Printable interfaces for 2D
274       * print output.
275       * @param service The new printer to use.
276       * @throws PrinterException if service is not valid.
277       */
278      public void setPrintService(PrintService service)
279        throws PrinterException
280      {
281        throw new PrinterException();
282      }
283  }  }
   
 /*************************************************************************/  
   
 /**  
   * Clones the specified <code>PageFormat</code> object then alters the  
   * clone so that it represents the default page format.  
   *  
   * @param page_format The <code>PageFormat</code> to clone.  
   *  
   * @return A new default page format.  
   */  
 public abstract PageFormat  
 defaultPage(PageFormat page_format);  
   
 /*************************************************************************/  
   
 /**  
   * Displays a dialog box to the user which allows the page format  
   * attributes to be modified.  
   *  
   * @param page_format The <code>PageFormat</code> object to modify.  
   *  
   * @return The modified <code>PageFormat</code>.  
   */  
 public abstract PageFormat  
 pageDialog(PageFormat page_format);  
   
 /*************************************************************************/  
   
 /**  
   * Prints the pages.  
   */  
 public abstract void print () throws PrinterException;  
   
 /**  
   * Displays a dialog box to the user which allows the print job  
   * attributes to be modified.  
   *  
   * @return <code>false</code> if the user cancels the dialog box,  
   * <code>true</code> otherwise.  
   */  
 public abstract boolean  
 printDialog();  
   
 /*************************************************************************/  
   
 /**  
   * This sets the pages that are to be printed.  
   *  
   * @param pageable The pages to be printed, which may not be <code>null</code>.  
   */  
 public abstract void  
 setPageable(Pageable pageable);  
   
 /*************************************************************************/  
   
 /**  
   * Sets this specified <code>Printable</code> as the one to use for  
   * rendering the pages on the print device.  
   *  
   * @param printable The <code>Printable</code> for the print job.  
   */  
 public abstract void  
 setPrintable(Printable printable);  
   
 /*************************************************************************/  
   
 /**  
   * Sets the <code>Printable</code> and the page format for the pages  
   * to be printed.  
   *  
   * @param printable The <code>Printable</code> for the print job.  
   * @param page_format The <code>PageFormat</code> for the print job.  
   */  
 public abstract void  
 setPrintable(Printable printable, PageFormat page_format);  
   
 /*************************************************************************/  
   
 /**  
   * Makes any alterations to the specified <code>PageFormat</code>  
   * necessary to make it work with the current printer.  The alterations  
   * are made to a clone of the input object, which is then returned.  
   *  
   * @param page_format The <code>PageFormat</code> to validate.  
   *  
   * @return The validated <code>PageFormat</code>.  
   */  
 public abstract PageFormat  
 validatePage(PageFormat page);  
   
 } // class PrinterJob  
   

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.6.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26