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

Collaboration diagram for cern::laser::guiplatform::printing::PrintUtil:
Collaboration graph
[legend]

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)

Private Member Functions

File createTempFile () throws IOException

Static Private Member Functions

static String getSwitchIP (String ip) throws ArrayIndexOutOfBoundsException
static String getSwitchName (String switchIP)
static 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

static final int USE_DEFAULTS = 1
static final int USE_FORM_CODES = 2
static 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

References sendStatus, settingsOK, toPrint, and userName.


Member Function Documentation

static 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

Referenced by print().

static 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

References getSwitchIP(), and getSwitchName().

Referenced by getPrintersInThisBuilding().

static 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

Referenced by getPrintersInThisBuilding().

static 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

References getBuildingNumber(), and getPrintersInBuilding().

static 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

Referenced by getBuildingNumber().

static 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

Referenced by getBuildingNumber().

static 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

References cfName, controlFile, dfName, fileToPrint, jobName, nextJob, nextPort, pagePosition, printerName, printOptions, rectoVerso, sendStatus, sock, timeout, USE_DEFAULTS, USE_FORM_CODES, USE_OPTIONS, userName, waitForData(), and widthCode.

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

References createTempFile(), fileToPrint, isLandscape, isPrintToFile, isRangePagePrint, isTwoSidePrint, numberOfCopies, printerName, rangeFrom, rangeTo, settingsOK, and toPrint.

Referenced by cern::laser::guiplatform::actions::PrintActiveListAction::performAction().

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

References cern::laser::guiplatform::printing::PrintDialog::areSettingsOK(), fileToPrint, 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(), isAllPagePrint, cern::laser::guiplatform::printing::PrintDialog::isLandscape(), isLandscape, cern::laser::guiplatform::printing::PrintDialog::isPrintToFile(), isPrintToFile, cern::laser::guiplatform::printing::PrintDialog::isRangePagePrint(), isRangePagePrint, cern::laser::guiplatform::printing::PrintDialog::isTwoSidedPrint(), isTwoSidePrint, numberOfCopies, printerName, rangeFrom, rangeTo, settingsOK, and toPrint.

Referenced by cern::laser::guiplatform::actions::PrintActiveListAction::performAction().

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

References toPrint.

Referenced by cern::laser::guiplatform::actions::PrintActiveListAction::performAction().

static 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

References timeout.

Referenced by print().


Member Data Documentation

Referenced by print().

Referenced by print().

Referenced by print().

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

Referenced by print(), and printDialog().

if true all pages printing

Referenced by printDialog().

if true, printing in landscape mode

Referenced by print(), and printDialog().

if true, printing to file

Referenced by print(), and printDialog().

if true range printing

Referenced by print(), and printDialog().

if true two side printing

Referenced by print(), and printDialog().

Referenced by print().

Referenced by print().

Referenced by print().

number of copies

Referenced by print(), and printDialog().

Referenced by print().

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

Referenced by print(), and printDialog().

Referenced by print().

first page to print

Referenced by print(), and printDialog().

last page to print

Referenced by print(), and printDialog().

Referenced by print().

status of printing

Referenced by print(), and PrintUtil().

id true, all properties needed for printing are correct

Referenced by print(), printDialog(), and PrintUtil().

Referenced by print().

Referenced by print(), and waitForData().

printable object

Referenced by print(), printDialog(), PrintUtil(), and setPrintable().

Referenced by print().

Referenced by print().

Referenced by print().

Referenced by print(), and PrintUtil().

Referenced by print().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2