Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.print
Class PrintServiceLookup  view PrintServiceLookup download PrintServiceLookup.java

java.lang.Object
  extended byjavax.print.PrintServiceLookup

public abstract class PrintServiceLookup
extends java.lang.Object

PrintServiceLookup implementations provide a way to lookup print services based on different constraints.

Implementations are located and loaded automatically through the SPI JAR file specification. Therefore implementation classes must provide a default constructor for instantiation. Furthermore, applications are able to register further instances directly at runtime.

If an SecurityManager is installed implementors should call checkPrintJobAccess() to disable access for untrusted code. This check is to be made in every lookup service implementation for flexibility. Print services registered by applications through registerService(PrintService) are suppressed in the lookup results if a security manager is installed and disallows access.


Field Summary
private static java.util.HashSet printServiceLookups
           
private static java.util.HashSet printServices
           
private static gnu.javax.print.CupsPrintServiceLookup systemProvider
           
 
Constructor Summary
PrintServiceLookup()
          Constructs a PrintServiceLookup object.
 
Method Summary
abstract  PrintService getDefaultPrintService()
          Not to be called directly by applications.
abstract  MultiDocPrintService[] getMultiDocPrintServices(DocFlavor[] flavors, javax.print.attribute.AttributeSet attributes)
          Not to be called directly by applications.
abstract  PrintService[] getPrintServices()
          Not to be called directly by applications.
abstract  PrintService[] getPrintServices(DocFlavor flavor, javax.print.attribute.AttributeSet attributes)
          Not to be called directly by applications.
static PrintService lookupDefaultPrintService()
          Searches the default print service in the current environment.
static MultiDocPrintService[] lookupMultiDocPrintServices(DocFlavor[] flavors, javax.print.attribute.AttributeSet attributes)
          Searches print services capable of multi document printing in all of the given document flavors and supporting the specified printing attributes.
static PrintService[] lookupPrintServices(DocFlavor flavor, javax.print.attribute.AttributeSet attributes)
          Searches print services capable of printing in the given document flavor which supports the specified printing attributes.
static boolean registerService(PrintService service)
          Explicitly registers the provided print service instance.
static boolean registerServiceProvider(PrintServiceLookup sp)
          Explicitly registers the provided print service lookup implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemProvider

private static final gnu.javax.print.CupsPrintServiceLookup systemProvider

printServices

private static final java.util.HashSet printServices

printServiceLookups

private static final java.util.HashSet printServiceLookups
Constructor Detail

PrintServiceLookup

public PrintServiceLookup()
Constructs a PrintServiceLookup object.

Method Detail

registerServiceProvider

public static boolean registerServiceProvider(PrintServiceLookup sp)
Explicitly registers the provided print service lookup implementation.

The registration will silently fail (returning false) if the lookup service is already registered or the registration somehow else fails.


registerService

public static boolean registerService(PrintService service)
Explicitly registers the provided print service instance.

The registration will silently fail (returning false) if the print service instance is already registered or the registration somehow else fails.


lookupPrintServices

public static final PrintService[] lookupPrintServices(DocFlavor flavor,
                                                       javax.print.attribute.AttributeSet attributes)
Searches print services capable of printing in the given document flavor which supports the specified printing attributes.


lookupMultiDocPrintServices

public static final MultiDocPrintService[] lookupMultiDocPrintServices(DocFlavor[] flavors,
                                                                       javax.print.attribute.AttributeSet attributes)
Searches print services capable of multi document printing in all of the given document flavors and supporting the specified printing attributes.


lookupDefaultPrintService

public static final PrintService lookupDefaultPrintService()
Searches the default print service in the current environment.

If multiple lookup services are registered and each has a default print service the result is not specified. Usually the default print service of the native platform lookup service is returned.

The GNU classpath implementation will return the CUPS default printing service as the default print service, if available.

The default print service may be overriden by users through the property javax.print.defaultPrinter. A service specified must be found to be returned as the default.


getDefaultPrintService

public abstract PrintService getDefaultPrintService()
Not to be called directly by applications.


getMultiDocPrintServices

public abstract MultiDocPrintService[] getMultiDocPrintServices(DocFlavor[] flavors,
                                                                javax.print.attribute.AttributeSet attributes)
Not to be called directly by applications.


getPrintServices

public abstract PrintService[] getPrintServices()
Not to be called directly by applications.


getPrintServices

public abstract PrintService[] getPrintServices(DocFlavor flavor,
                                                javax.print.attribute.AttributeSet attributes)
Not to be called directly by applications.