Classes | Public Member Functions | Static Public Member Functions

cern.laser.guiplatform.printing.PrintUtil Class Reference

List of all members.

Classes

class  MissingPrintableObjectException
class  SettingsNotCorrectException

Public Member Functions

 PrintUtil ()
boolean printDialog () throws MissingPrintableObjectException
void print () throws SettingsNotCorrectException
void setPrintable (Printable painter)
boolean print (File printableFile, char fileType, String nameOfPrinter)

Static Public Member Functions

static String getBuildingNumber ()
static String[] getPrintersInBuilding (String buildingNumber) throws Exception
static String[] getPrintersInThisBuilding () throws Exception
static boolean checkPrinter (String printerName)
static void main (String[] args)

Detailed Description

Class for printing objects which implements interface Printable.

Author:
woloszyn

Constructor & Destructor Documentation

cern.laser.guiplatform.printing.PrintUtil.PrintUtil (  ) 

Creates a new instance of PrintUtil


Member Function Documentation

static boolean cern.laser.guiplatform.printing.PrintUtil.checkPrinter ( String  printerName  )  [static]

Checks if printer with given name exists in network

Parameters:
printerName name of printer ( without suffix .print.cern.ch )
Returns:
true if printer seems to be valid
static String cern.laser.guiplatform.printing.PrintUtil.getBuildingNumber (  )  [static]

Method obtains building number on the basis of ip address

Returns:
Number of building as a string

Referenced by cern.laser.guiplatform.printing.PrintUtil.getPrintersInThisBuilding().

static String [] cern.laser.guiplatform.printing.PrintUtil.getPrintersInBuilding ( String  buildingNumber  )  throws Exception [static]

Method returns printers available in building with given number

Parameters:
buildingNumber Number of building
Exceptions:
Exception occures when is problem with connection to IT Print Support web script or the format of returned data has changed
Returns:
table witch names of printers present in building

Referenced by cern.laser.guiplatform.printing.PrintUtil.getPrintersInThisBuilding().

static String [] cern.laser.guiplatform.printing.PrintUtil.getPrintersInThisBuilding (  )  throws Exception [static]

Method returns printers available in client's building

Exceptions:
Exception occures when is problem with connection to IT Print Support web script or the format of returned data has changed
Returns:
table witch names of printers present in building

References cern.laser.guiplatform.printing.PrintUtil.getBuildingNumber(), and cern.laser.guiplatform.printing.PrintUtil.getPrintersInBuilding().

static void cern.laser.guiplatform.printing.PrintUtil.main ( String[]  args  )  [static]
void cern.laser.guiplatform.printing.PrintUtil.print (  )  throws SettingsNotCorrectException

method prints printable object on printer choosen in dialog with respecting settings from this dialog

Exceptions:
SettingsNotCorrectException you should use printDialog() method before invoking print() method
boolean cern.laser.guiplatform.printing.PrintUtil.print ( File  printableFile,
char  fileType,
String  nameOfPrinter 
)

Sends a file to a printer to be printed. (method from cern.printing package)
This method returns true if the job was sent successfully or returns false if an error or timeout occured.
The file's format must be specified as a single character, and must be one of the following types:

  • f - a formatted file (the default)
  • l - a binary/literal file
  • c - a CIF file
  • d - a DVI file
  • g - the output from the plot(3X)
  • n - a ditroff output file
  • o - a Postscript output file
  • p - print file using 'pr' format
  • r - a text file with FORTRAN carriage
  • t - a troff output file
  • v - a raster file
Parameters:
printableFile The file to be printed
fileType The format of the file (see above)
nameOfPrinter The name of the printer to use
Returns:
blank
boolean cern.laser.guiplatform.printing.PrintUtil.printDialog (  )  throws MissingPrintableObjectException

Displays print dialog. When obtaining of printers from OS is successfull it displays regular print dialog. In other case it displays dialog which obtains printers on the base of building number from IT Print Support web script. Obtaining client's building number is automatic, as well.

Exceptions:
MissingPrintableObjectException Printable object is missing. Use: setPrintable method
Returns:
true: settings are correct and user wants to continue printing (print Button) false: user pressed Cancel buttom

References cern.laser.guiplatform.printing.PrintDialog.areSettingsOK(), cern.laser.guiplatform.printing.PrintDialog.getFileToPrint(), cern.laser.guiplatform.printing.PrintDialog.getNumberOfCopies(), cern.laser.guiplatform.printing.PrintDialog.getPrinterName(), cern.laser.guiplatform.printing.PrintDialog.getRangeFrom(), cern.laser.guiplatform.printing.PrintDialog.getRangeTo(), cern.laser.guiplatform.printing.PrintDialog.isAllPagePrint(), cern.laser.guiplatform.printing.PrintDialog.isLandscape(), cern.laser.guiplatform.printing.PrintDialog.isPrintToFile(), cern.laser.guiplatform.printing.PrintDialog.isRangePagePrint(), and cern.laser.guiplatform.printing.PrintDialog.isTwoSidedPrint().

void cern.laser.guiplatform.printing.PrintUtil.setPrintable ( Printable  painter  ) 

sets reference to object which will be printed

Parameters:
painter reference to printable object. It have to implement interface Printable

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties