Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

cern::laser::guiplatform::printing::PrintUtil Class Reference

List of all members.

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

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

Private Member Functions

File createTempFile () throws IOException

Static Private Member Functions

String getSwitchIP (String ip) throws ArrayIndexOutOfBoundsException
String getSwitchName (String switchIP)
boolean waitForData (BufferedReader reader, int timeout) throws IOException

Private Attributes

Printable toPrint
String printerName
int numberOfCopies
boolean isTwoSidePrint
boolean isAllPagePrint
boolean isRangePagePrint
int rangeFrom
int rangeTo
boolean isPrintToFile
File fileToPrint
boolean isLandscape
boolean settingsOK
int sendStatus
int nextJob = 1
String cfName
String dfName
String controlFile
String userName = "null"
String jobName = "null"
int printOptions = USE_DEFAULTS
int widthCode = -1
String pagePosition = "twopage"
String rectoVerso = "rverso"
Socket sock = null
int nextPort = 721
final int timeout = 30

Static Private Attributes

final int USE_DEFAULTS = 1
final int USE_FORM_CODES = 2
final int USE_OPTIONS = 3

Detailed Description

Class for printing objects which implements interface Printable.
Author:
woloszyn


Constructor & Destructor Documentation

cern::laser::guiplatform::printing::PrintUtil::PrintUtil  )  [inline]
 

Creates a new instance of PrintUtil


Member Function Documentation

boolean cern::laser::guiplatform::printing::PrintUtil::checkPrinter String  printerName  )  [inline, 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

File cern::laser::guiplatform::printing::PrintUtil::createTempFile  )  throws IOException [inline, private]
 

Method creates temporary file. It file is used later for storing Postscript file created before sending it to printer. It is created in temporary directory.

Exceptions:
IOException problem with creation file in temporary directory
Returns:
created temporary file

String cern::laser::guiplatform::printing::PrintUtil::getBuildingNumber  )  [inline, static]
 

Method obtains building number on the basis of ip address

Returns:
Number of building as a string

String [] cern::laser::guiplatform::printing::PrintUtil::getPrintersInBuilding String  buildingNumber  )  throws Exception [inline, 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

String [] cern::laser::guiplatform::printing::PrintUtil::getPrintersInThisBuilding  )  throws Exception [inline, 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

String cern::laser::guiplatform::printing::PrintUtil::getSwitchIP String  ip  )  throws ArrayIndexOutOfBoundsException [inline, static, private]
 

Method obtains building number on the basis of ip address

Parameters:
ip IP od client in text format
Exceptions:
ArrayIndexOutOfBoundsException when the IP from parameter is in incorect format
Returns:
switch IP address to which client is connected

String cern::laser::guiplatform::printing::PrintUtil::getSwitchName String  switchIP  )  [inline, static, private]
 

Method returns host name of switch with a given IP

Parameters:
switchIP switch IP
Returns:
hostname of switch

void cern::laser::guiplatform::printing::PrintUtil::main String[]  args  )  [inline, static]
 

boolean cern::laser::guiplatform::printing::PrintUtil::print File  printableFile,
char  fileType,
String  nameOfPrinter
[inline]
 

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

void cern::laser::guiplatform::printing::PrintUtil::print  )  throws SettingsNotCorrectException [inline]
 

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::printDialog  )  throws MissingPrintableObjectException [inline]
 

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

void cern::laser::guiplatform::printing::PrintUtil::setPrintable Printable  painter  )  [inline]
 

sets reference to object which will be printed

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

boolean cern::laser::guiplatform::printing::PrintUtil::waitForData BufferedReader  reader,
int  timeout
throws IOException [inline, static, private]
 

Waits for data to become available from a reader, or a timeout. Returns true if some data is received before the timeout specified.

Parameters:
reader The reader to read data from
timeout The timeout in seconds
Exceptions:
IOException if an I/O error occurs
Returns:
true if reader is ready after given time


Member Data Documentation

String cern::laser::guiplatform::printing::PrintUtil::cfName [private]
 

String cern::laser::guiplatform::printing::PrintUtil::controlFile [private]
 

String cern::laser::guiplatform::printing::PrintUtil::dfName [private]
 

File cern::laser::guiplatform::printing::PrintUtil::fileToPrint [private]
 

destination file for printing ( mode: printing to file in dialog )

boolean cern::laser::guiplatform::printing::PrintUtil::isAllPagePrint [private]
 

if true all pages printing

boolean cern::laser::guiplatform::printing::PrintUtil::isLandscape [private]
 

if true, printing in landscape mode

boolean cern::laser::guiplatform::printing::PrintUtil::isPrintToFile [private]
 

if true, printing to file

boolean cern::laser::guiplatform::printing::PrintUtil::isRangePagePrint [private]
 

if true range printing

boolean cern::laser::guiplatform::printing::PrintUtil::isTwoSidePrint [private]
 

if true two side printing

String cern::laser::guiplatform::printing::PrintUtil::jobName = "null" [private]
 

int cern::laser::guiplatform::printing::PrintUtil::nextJob = 1 [private]
 

int cern::laser::guiplatform::printing::PrintUtil::nextPort = 721 [private]
 

int cern::laser::guiplatform::printing::PrintUtil::numberOfCopies [private]
 

number of copies

String cern::laser::guiplatform::printing::PrintUtil::pagePosition = "twopage" [private]
 

String cern::laser::guiplatform::printing::PrintUtil::printerName [private]
 

name of printer (without suffix .print.cern.ch)

int cern::laser::guiplatform::printing::PrintUtil::printOptions = USE_DEFAULTS [private]
 

int cern::laser::guiplatform::printing::PrintUtil::rangeFrom [private]
 

first page to print

int cern::laser::guiplatform::printing::PrintUtil::rangeTo [private]
 

last page to print

String cern::laser::guiplatform::printing::PrintUtil::rectoVerso = "rverso" [private]
 

int cern::laser::guiplatform::printing::PrintUtil::sendStatus [private]
 

status of printing

boolean cern::laser::guiplatform::printing::PrintUtil::settingsOK [private]
 

id true, all properties needed for printing are correct

Socket cern::laser::guiplatform::printing::PrintUtil::sock = null [private]
 

final int cern::laser::guiplatform::printing::PrintUtil::timeout = 30 [private]
 

Printable cern::laser::guiplatform::printing::PrintUtil::toPrint [private]
 

printable object

final int cern::laser::guiplatform::printing::PrintUtil::USE_DEFAULTS = 1 [static, private]
 

final int cern::laser::guiplatform::printing::PrintUtil::USE_FORM_CODES = 2 [static, private]
 

final int cern::laser::guiplatform::printing::PrintUtil::USE_OPTIONS = 3 [static, private]
 

String cern::laser::guiplatform::printing::PrintUtil::userName = "null" [private]
 

int cern::laser::guiplatform::printing::PrintUtil::widthCode = -1 [private]
 


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 03:09:34 2009 for ACS Java API by doxygen 1.3.8