i-net Clear Reports

com.inet.report.schedule
Class PrintAction

java.lang.Object
  extended by com.inet.report.schedule.ScheduleAction
      extended by com.inet.report.schedule.PrintAction

public class PrintAction
extends ScheduleAction

A ScheduleAction for printing the generated reports of a task to a printer. You can set a number of properties for the printing e.g. if color should be used or not, which quality should be used or the printer resolution.
Please have a look at the documentation of these properties to get more details.

Since:
6.0

Field Summary
static int ORIENTATION_LANDSCAPE
          This will explicitly set the orientation for the PrinterJob to landscape.
static int ORIENTATION_PORTRAIT
          This will explicitly set the orientation for the PrinterJob to portrait.
static int ORIENTATION_USE_DEFAULT
          This will set the orientation for the PrinterJob with the value defined in the report template.
static int QUALITY_DRAFT
          This constant can be used to set the print quality to "draft".
static int QUALITY_HIGH
          This constant can be used to set the print quality to "high".
static int QUALITY_NORMAL
          This constant can be used to set the print quality to "normal".
 
Fields inherited from class com.inet.report.schedule.ScheduleAction
TYPE_CACHE, TYPE_CUSTOM, TYPE_EMAIL, TYPE_FILE, TYPE_FTP, TYPE_PRINT
 
Constructor Summary
PrintAction()
          Creates an instance of PrintAction.
 
Method Summary
 void action(ExecutedTask task)
          This method will print all reports of the given task with the properties set in this PrintAction.
 int getCopies()
          Returns the number of times the associated report(s) will be printed.
 java.lang.String[] getErrorMessages()
          Will provide error information.
 int getOrientation()
          Returns the orientation that will be used for printing the reports.
 java.lang.String getPrinterName()
          Returns the name of the printer that will be used for printing the reports.
 int getQuality()
          Returns the preferred printing quality.
 boolean isUseColor()
          Will tell you whether the reports will be monochrome or printed using colors.
 void setCopies(int copies)
          Sets the number of copies which should be printed for each report rendered with the associated task.
 void setOrientation(int orientation)
          Sets the orientation that will be used for printing the reports.
 void setPrinterName(java.lang.String printerName)
          Sets the name of the printer which should be used for printing.
 void setQuality(int quality)
          Allows you to set the printing quality, which should be one of the QUALITY_NORMAL, QUALITY_DRAFT, or QUALITY_HIGH.
 void setUseColor(boolean useColor)
          Allows you to specify whether the reports should be printed in color or monochrome.
 java.lang.String toString()
          Returns a string representation of this PrintAction.
 
Methods inherited from class com.inet.report.schedule.ScheduleAction
getType, isValid
 

Field Detail

ORIENTATION_USE_DEFAULT

public static final int ORIENTATION_USE_DEFAULT
This will set the orientation for the PrinterJob with the value defined in the report template.

See Also:
getOrientation(), setOrientation(int), Constant Field Values

ORIENTATION_PORTRAIT

public static final int ORIENTATION_PORTRAIT
This will explicitly set the orientation for the PrinterJob to portrait.

See Also:
getOrientation(), setOrientation(int), Constant Field Values

ORIENTATION_LANDSCAPE

public static final int ORIENTATION_LANDSCAPE
This will explicitly set the orientation for the PrinterJob to landscape.

See Also:
getOrientation(), setOrientation(int), Constant Field Values

QUALITY_NORMAL

public static final int QUALITY_NORMAL
This constant can be used to set the print quality to "normal".

See Also:
getQuality(), setQuality(int), Constant Field Values

QUALITY_DRAFT

public static final int QUALITY_DRAFT
This constant can be used to set the print quality to "draft".

See Also:
getQuality(), setQuality(int), Constant Field Values

QUALITY_HIGH

public static final int QUALITY_HIGH
This constant can be used to set the print quality to "high".

See Also:
getQuality(), setQuality(int), Constant Field Values
Constructor Detail

PrintAction

public PrintAction()
Creates an instance of PrintAction.

Method Detail

getErrorMessages

public java.lang.String[] getErrorMessages()
Will provide error information. The returned array will have a length of zero when there are no errors to report.

Overrides:
getErrorMessages in class ScheduleAction
Returns:
an array containing error messages

action

public void action(ExecutedTask task)
This method will print all reports of the given task with the properties set in this PrintAction.

Specified by:
action in class ScheduleAction
Parameters:
task - The executed task which reports should be printed.

getCopies

public int getCopies()
Returns the number of times the associated report(s) will be printed.

Returns:
number of copies
See Also:
setCopies(int)

setCopies

public void setCopies(int copies)
Sets the number of copies which should be printed for each report rendered with the associated task. If you set a value less or equal to zero the action will not be valid anymore.
Note: Invalid actions will not be executed.

Parameters:
copies - Number of copies which should be printed per report.
See Also:
getCopies()

getOrientation

public int getOrientation()
Returns the orientation that will be used for printing the reports.

Returns:
One of the following: ORIENTATION_USE_DEFAULT, ORIENTATION_LANDSCAPE or ORIENTATION_PORTRAIT
See Also:
setOrientation(int), ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE, ORIENTATION_USE_DEFAULT

setOrientation

public void setOrientation(int orientation)
Sets the orientation that will be used for printing the reports. It has to be one of the three constants ORIENTATION_USE_DEFAULT, ORIENTATION_PORTRAIT, or ORIENTATION_LANDSCAPE. If you set an invalid value the action will not be valid anymore.
Note: Invalid actions will not be executed.

Parameters:
orientation - The orientation which should be used for printing.
See Also:
getOrientation(), ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE, ORIENTATION_USE_DEFAULT

getPrinterName

public java.lang.String getPrinterName()
Returns the name of the printer that will be used for printing the reports.

Returns:
The name ot the printer which will be used for printing.
See Also:
setPrinterName(String)

setPrinterName

public void setPrinterName(java.lang.String printerName)
Sets the name of the printer which should be used for printing. Setting a value of null means that i-net Clear Reports will use the default printer of the system.

Parameters:
printerName - The name of the printer which should be used.
See Also:
getPrinterName()

getQuality

public int getQuality()
Returns the preferred printing quality.

Returns:
One of the following values: QUALITY_NORMAL, QUALITY_DRAFT or QUALITY_HIGH.
See Also:
setQuality(int), QUALITY_DRAFT, QUALITY_NORMAL, QUALITY_HIGH

setQuality

public void setQuality(int quality)
Allows you to set the printing quality, which should be one of the QUALITY_NORMAL, QUALITY_DRAFT, or QUALITY_HIGH.

Parameters:
quality - The quality which should be used.
See Also:
getQuality(), QUALITY_DRAFT, QUALITY_NORMAL, QUALITY_HIGH

isUseColor

public boolean isUseColor()
Will tell you whether the reports will be monochrome or printed using colors.

Returns:
True if printing should be done with colors or false if printing should be done black/white.
See Also:
setUseColor(boolean)

setUseColor

public void setUseColor(boolean useColor)
Allows you to specify whether the reports should be printed in color or monochrome.

Parameters:
useColor - True for colored printing and false for black/white printing.
See Also:
isUseColor()

toString

public java.lang.String toString()
Returns a string representation of this PrintAction. The string returned will contain the value of the properties printerName, copies, orientation, quality, useColor and printerResolution and any error message of ScheduleAction.getErrorMessages() if available.

Overrides:
toString in class ScheduleAction
Returns:
A string representation of this PrintAction.
Since:
6.1

i-net Clear Reports

Copyright © 1999-2011 by i-net software GmbH