ElegantJ Data Tables Java API Specification v1.1

com.elegantj.util.printer
Class Printer

java.lang.Object
  extended bycom.elegantj.util.printer.Printer
All Implemented Interfaces:
java.io.Externalizable, java.awt.print.Printable, java.io.Serializable
Direct Known Subclasses:
AWTTablePrinter, ReportPrinter

public class Printer
extends java.lang.Object
implements java.awt.print.Printable, java.io.Externalizable

Printer which implements functionality of the Printer which provides the page setup, preview and print facility for any component also provides the special implementation of the JTable, JTextPane, JTextArea AWTTextArea for the print also provides the header, footer,and margins

See Also:
Serialized Form

Field Summary
static int A2_ENVELOP_TYPE
          The paper type
static int A4_TYPE
          The paper type
static int A5_TYPE
          The paper type
static int A6_CARD_TYPE
          The paper type
protected static int ASCENT
          protected value of ascent
static int B5_TYPE
          The paper type
protected  double bottomMargin
          holds the value of the bottom margin in pixels
protected  double bottomMarginDInch
          holds the value of the bottom margin in inches
 com.elegantj.editors.C1 c1
           
static int C6_ENVELOP_TYPE
          The paper type
protected  java.lang.String centerFooter
          holds the center footer value
protected  java.lang.String centerHeader
          holds the center header value
static java.lang.String CURRENT_DATE
          To display the current date in the header or footer
static java.lang.String CURRENT_TIME
          To display the current time in the header or footer
static int CUSTOM_TYPE
          The paper type
protected static int DESCENT
          protected value of descent
static int DL_ENVELOP_TYPE
          The paper type
static int EXECUTIVE_TYPE
          The paper type
protected  double gapAboveFooter
          holds the value of the gap above footer in pixels
protected  double gapAboveFooterDInch
          holds the value of the gap above footer in inches
protected  double gapBelowHeader
          holds the value of the gap below header in pixels
protected  double gapBelowHeaderDInch
          holds the value of the gap below header in inches
static int HAGAKI_CARD_TYPE
          The paper type
static int INDEX_CARD_4x6_TYPE
          The paper type
static int INDEX_CARD_5x8_TYPE
          The paper type
static int LANDSCAPE
          The orientation of the page(s)
protected  java.lang.String leftFooter
          holds the left footer value
protected  java.lang.String leftHeader
          holds the left header value
protected  double leftMargin
          holds the value of the left margin in pixels
protected  double leftMarginDInch
          holds the value of the left margin in inches
static int LEGAL_TYPE
          The paper type
static int LETTER_TYPE
          The paper type
static int N010_ENVELOP_TYPE
          The paper type
protected  int noOfCopies
          the no of copies value
static java.lang.String PAGE_NO
          To display the page number in the header or footer
protected  int pageOrientation
          the value of the page orientation either PORTRAIT or LANDSCAPE
protected  double paperHeight
          paper height in pixels
protected  double paperHeightDInch
          paper height in inches
protected  int paperType
          the paper type
protected  double paperWidth
          paper width in pixels
protected  double paperWidthDInch
          paper width in inches
static int PORTRAIT
          The orientation of the page(s)
static java.util.ResourceBundle RESOURCE_BUNDLE
          Specifies the resurce bundle
protected  java.lang.String rightFooter
          holds the right footer value
protected  java.lang.String rightHeader
          holds the right header value
protected  double rightMargin
          holds the value of the right margin in pixels
protected  double rightMarginDInch
          holds the value of the right margin in inches
protected  boolean showLineAboveFooter
          wheather to show line above header or not
protected  boolean showLineBelowHeader
          wheather to show line below header or not
protected  boolean showPrintDialog
          wheather show print dialog or not
protected  double topMargin
          holds the value of the top margin in pixels
protected  double topMarginDInch
          holds the value of the top margin in inches
static java.lang.String TOTAL_PAGES
          To display the total pages number in the header or footer
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
Printer()
          Default constructor
 
Method Summary
 void addPrinterListener(PrinterListener l)
          Adds the printer listener
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Method which adds the PropertyChangeListener
protected  java.awt.Dialog createPageSetupDialog(java.awt.Frame frame)
          Creates the dialog for page setup
protected  PreviewPage createPreviewPage(int width, int height, java.awt.Image image, int pageIndex)
          Method which creates the preview page
protected  void drawHeaders(java.awt.Graphics2D g, int pageIndex)
          method which draws headers for the every pages
 javax.swing.JFrame findFrame(java.awt.Component component)
          Utility method for find a frame
 void firePrinterEvent(PrinterEvent e)
          fires the PrinterEvent
 void firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
          Method which fires the property change
 double getActualPaperHeight()
          Returns the actual paper height
 double getActualPaperWidth()
          Returns the actual paper width
 int getBookSize()
          Returns the book size
 double getBottomMargin()
          Returns the bottom margin of the page(s), in inches
 java.lang.String getCenterFooter()
          Returns the center footer of the page(s)
 java.lang.String getCenterHeader()
          Returns the center header of the page(s)
 double getGapAboveFooter()
          Returns the value of gap above footer of the page(s), in inches
 double getGapBelowHeader()
          Returns the value of gap below header of the page(s), in inches
 double getImageablePaperHeight()
          Returns the imageable paper height
 double getImageablePaperWidth()
          Returns the imageable paper width
 java.lang.String getLeftFooter()
          Returns the left footer of the page(s)
 java.lang.String getLeftHeader()
          Returns the left header of the page(s)
 double getLeftMargin()
          Returns the left margin of the page(s), in inches
 java.lang.String getLicenseKey()
          Returns the license key of the bean
 int getNoOfCopies()
          Returns the no of copies of the page(s)
 int getNoOfPages()
          Method which returns the no of pages
 int getPageOrientation()
          Returns the page orientation of the page(s)
 double getPaperHeight()
          Returns the value of property paper height, in inches
 int getPaperType()
          Returns the value of paper type property
 double getPaperWidth()
          Returns the value of property paper width, in inches
 java.lang.String getPort()
          Returns the target port
 java.awt.Dimension getPreferredSize()
          Method which returns the preferred size
 java.lang.String getPrintJobName()
          Returns the print job name
 java.lang.String getRightFooter()
          Returns the right footer of the page(s)
 java.lang.String getRightHeader()
          Returns the right header of the page(s)
 double getRightMargin()
          Returns the right margin of the page(s), in inches
 double getTopMargin()
          Returns the top margin of the page(s), in inches
 boolean isPrintBookIndividually()
          Returns the wheather print the book of pages individually or not
 boolean isScaleComponentToSinglePage()
          Returns the wheather scale the component to fit to the single page
If true, the big component will be scaled to fit to the single page
If false, the big component will be wrapped and component will be
printed on multiple pages instead of single page
 boolean isShowLineAboveFooter()
          Returns The boolean value of, is line above footer to be drawn?
 boolean isShowLineBelowHeader()
          Returns The boolean value of, is line below header to be drawn?
 boolean isShowPrintDialog()
          Returns The boolean value of, is display the print dialog while print method is called
 void pageSetup()
          Displays the page setup dialog
 void pageSetup(java.awt.Frame frame)
          Displays the page setup dialog
 void preview()
          Displays the preview dialog
 void preview(java.awt.Frame frame)
          Displays the preview dialog
 void print()
          Call this method to take print outs
If the value of the ShowPrintDialog set true, then this method
first of shows the print dialog and then takes print.
This print dialog will be shown only if the value of PrintBookIndividually is false.
Note : If the no.
 void print(byte[] bytes)
          Reads the contents of bytes array and send it
to the printer for print outs.
 void print(byte[] bytes, java.lang.String port)
          Reads the contents of bytes array and send it
to the specified printer port for print outs.
 void print(java.io.FileInputStream fis)
          Reads the contents from FileInputStream and send it to the printer for print outs.
 void print(java.io.FileInputStream fis, java.lang.String port)
          Reads the contents from FileInputStream and send it
to the specified printer port for print outs.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
          Implementation of the Printable
protected  int Print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
          Method which is called from print
 void print(int pageIndex)
          Prints the page at the specified page index
 void print(int startPageIndex, int endPageIndex)
          Prints the pages from startPageIndex(inclusive) to the endPageIndex(inclusive)
protected  int printPreview(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
          This method called during print preview
 void readExternal(java.io.ObjectInput in)
          Implementation of writeExternal method
 void removePrinterListener(PrinterListener l)
          Removes the printer listener
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Method which removes the PropertyChangeListener
 void setAWTTextArea(java.awt.TextArea textArea)
          Sets the awt TextArea for taking print
 void setBookSize(int bookSize)
          Sets the book size
 void setBottomMargin(double bottomMargin)
          Sets the bottom margin of the page(s), in inches
 void setCenterFooter(java.lang.String centerFooter)
          Sets the center footer of the page(s)
 void setCenterHeader(java.lang.String centerHeader)
          Sets the center header of the page(s)
 void setComponent(java.awt.Component component)
          Sets the component for taking print
 void setGapAboveFooter(double gapAboveFooter)
          Sets the value of gap above footer of the page(s), in inches
 void setGapBelowHeader(double gapBelowHeader)
          Sets the value of gap below header of the page(s), in inches
 void setJTable(javax.swing.JTable table)
          Sets the JTable for taking print
 void setJTextArea(javax.swing.JTextArea textArea)
          Sets the JTextArea for taking print
 void setJTextPane(javax.swing.JTextPane textPane)
          Sets the JTextPane for taking print
 void setLeftFooter(java.lang.String leftFooter)
          Sets the left footer of the page(s)
 void setLeftHeader(java.lang.String leftHeader)
          Sets the left header of the page(s)
 void setLeftMargin(double leftMargin)
          Sets the left margin of the page(s), in inches
 void setLicenseKey(java.lang.String licenseKey)
          Methods which sets the license key
 void setNoOfCopies(int noOfCopies)
          Sets the no of copies of the page(s)
 void setPageOrientation(int pageOrientation)
          Sets the page orientation of the page(s)
 void setPaperSize(double width, double height)
          Sets the paper's size
 void setPaperType(int paperType)
          Sets the value of paper type property
 void setPort(java.lang.String port)
          Sets the target port, printer use this port to print pages
 void setPrintBookIndividually(boolean isPrintBookIndividually)
          Sets the wheather user want to print the book of pages individually or not
 void setPrintJobName(java.lang.String jobName)
          Returns the print job name
 void setRightFooter(java.lang.String rightFooter)
          Sets the right footer of the page(s)
 void setRightHeader(java.lang.String rightHeader)
          Sets the right header of the page(s)
 void setRightMargin(double rightMargin)
          Sets the right margin of the page(s), in inches
 void setScaleComponentToSinglePage(boolean isScaleComponentToSinglePage)
          Sets the wheather scale the component to fit to the single page
If true, the big component will be scaled to fit to the single page
If false, the big component will be wrapped and component will be
printed on multiple pages instead of single page
 void setShowLineAboveFooter(boolean showLineAboveFooter)
          Sets the boolean value of, is line above footer to be drawn?
 void setShowLineBelowHeader(boolean showLineBelowHeader)
          Sets the boolean value of, is line below header to be drawn?
 void setShowPrintDialog(boolean showPrintDialog)
          Sets the boolean value of, is display the print dialog while print method is called
 void setTopMargin(double topMargin)
          Sets the top margin of the page(s), in inches
 void writeExternal(java.io.ObjectOutput out)
          Implementation of writeExternal method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_BUNDLE

public static final java.util.ResourceBundle RESOURCE_BUNDLE
Specifies the resurce bundle


PORTRAIT

public static int PORTRAIT
The orientation of the page(s)


LANDSCAPE

public static int LANDSCAPE
The orientation of the page(s)


LETTER_TYPE

public static int LETTER_TYPE
The paper type


LEGAL_TYPE

public static int LEGAL_TYPE
The paper type


EXECUTIVE_TYPE

public static int EXECUTIVE_TYPE
The paper type


A4_TYPE

public static int A4_TYPE
The paper type


A5_TYPE

public static int A5_TYPE
The paper type


B5_TYPE

public static int B5_TYPE
The paper type


N010_ENVELOP_TYPE

public static int N010_ENVELOP_TYPE
The paper type


A2_ENVELOP_TYPE

public static int A2_ENVELOP_TYPE
The paper type


DL_ENVELOP_TYPE

public static int DL_ENVELOP_TYPE
The paper type


C6_ENVELOP_TYPE

public static int C6_ENVELOP_TYPE
The paper type


INDEX_CARD_4x6_TYPE

public static int INDEX_CARD_4x6_TYPE
The paper type


INDEX_CARD_5x8_TYPE

public static int INDEX_CARD_5x8_TYPE
The paper type


A6_CARD_TYPE

public static int A6_CARD_TYPE
The paper type


HAGAKI_CARD_TYPE

public static int HAGAKI_CARD_TYPE
The paper type


CUSTOM_TYPE

public static int CUSTOM_TYPE
The paper type


CURRENT_DATE

public static java.lang.String CURRENT_DATE
To display the current date in the header or footer


CURRENT_TIME

public static java.lang.String CURRENT_TIME
To display the current time in the header or footer


PAGE_NO

public static java.lang.String PAGE_NO
To display the page number in the header or footer


TOTAL_PAGES

public static java.lang.String TOTAL_PAGES
To display the total pages number in the header or footer


ASCENT

protected static int ASCENT
protected value of ascent


DESCENT

protected static int DESCENT
protected value of descent


pageOrientation

protected int pageOrientation
the value of the page orientation either PORTRAIT or LANDSCAPE


noOfCopies

protected int noOfCopies
the no of copies value


showLineBelowHeader

protected boolean showLineBelowHeader
wheather to show line below header or not


showLineAboveFooter

protected boolean showLineAboveFooter
wheather to show line above header or not


showPrintDialog

protected boolean showPrintDialog
wheather show print dialog or not


leftHeader

protected java.lang.String leftHeader
holds the left header value


centerHeader

protected java.lang.String centerHeader
holds the center header value


rightHeader

protected java.lang.String rightHeader
holds the right header value


leftFooter

protected java.lang.String leftFooter
holds the left footer value


centerFooter

protected java.lang.String centerFooter
holds the center footer value


rightFooter

protected java.lang.String rightFooter
holds the right footer value


leftMarginDInch

protected double leftMarginDInch
holds the value of the left margin in inches


leftMargin

protected double leftMargin
holds the value of the left margin in pixels


rightMarginDInch

protected double rightMarginDInch
holds the value of the right margin in inches


rightMargin

protected double rightMargin
holds the value of the right margin in pixels


topMarginDInch

protected double topMarginDInch
holds the value of the top margin in inches


topMargin

protected double topMargin
holds the value of the top margin in pixels


bottomMarginDInch

protected double bottomMarginDInch
holds the value of the bottom margin in inches


bottomMargin

protected double bottomMargin
holds the value of the bottom margin in pixels


gapBelowHeaderDInch

protected double gapBelowHeaderDInch
holds the value of the gap below header in inches


gapBelowHeader

protected double gapBelowHeader
holds the value of the gap below header in pixels


gapAboveFooterDInch

protected double gapAboveFooterDInch
holds the value of the gap above footer in inches


gapAboveFooter

protected double gapAboveFooter
holds the value of the gap above footer in pixels


paperType

protected int paperType
the paper type


paperWidthDInch

protected double paperWidthDInch
paper width in inches


paperWidth

protected double paperWidth
paper width in pixels


paperHeightDInch

protected double paperHeightDInch
paper height in inches


paperHeight

protected double paperHeight
paper height in pixels


c1

public transient com.elegantj.editors.C1 c1
Constructor Detail

Printer

public Printer()
Default constructor

Method Detail

setComponent

public void setComponent(java.awt.Component component)
Sets the component for taking print

Parameters:
component - the component

setJTable

public void setJTable(javax.swing.JTable table)
Sets the JTable for taking print

Parameters:
table - The JTable

setJTextPane

public void setJTextPane(javax.swing.JTextPane textPane)
Sets the JTextPane for taking print

Parameters:
textPane - The JTextPane

setJTextArea

public void setJTextArea(javax.swing.JTextArea textArea)
Sets the JTextArea for taking print


setAWTTextArea

public void setAWTTextArea(java.awt.TextArea textArea)
Sets the awt TextArea for taking print

Parameters:
textArea - The awt TextArea

pageSetup

public void pageSetup()
Displays the page setup dialog


pageSetup

public void pageSetup(java.awt.Frame frame)
Displays the page setup dialog

Parameters:
frame - The frame on to which this page setup dialog is added if frame is null then new Frame created internally

createPageSetupDialog

protected java.awt.Dialog createPageSetupDialog(java.awt.Frame frame)
Creates the dialog for page setup

Parameters:
frame - The frame on to which this page setup dialog is added
Returns:
the page setup dialog instance

preview

public void preview()
Displays the preview dialog


preview

public void preview(java.awt.Frame frame)
Displays the preview dialog

Parameters:
frame - The frame on to which this preview dialog is added if frame is null then new Frame created internally

print

public void print()
Call this method to take print outs
If the value of the ShowPrintDialog set true, then this method
first of shows the print dialog and then takes print.
This print dialog will be shown only if the value of PrintBookIndividually is false.
Note : If the no. of pages is very large number then
make the value of PrintBookIndividually property to true to print fast without spooling whole job.


print

public void print(int pageIndex)
Prints the page at the specified page index

Parameters:
pageIndex - The specified page index
This print method does not display the print dialog it will take print directly without
showing the print dialog.
Note: The pageIndex is zero based index.

print

public void print(int startPageIndex,
                  int endPageIndex)
Prints the pages from startPageIndex(inclusive) to the endPageIndex(inclusive)

Parameters:
startPageIndex - The start page index
endPageIndex - The end page index
This print method does not display the print dialog it will take print directly without
showing the print dialog.
Note: The start and end page indexes are zero based index.

printPreview

protected int printPreview(java.awt.Graphics g,
                           java.awt.print.PageFormat pageFormat,
                           int pageIndex)
This method called during print preview


print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
Implementation of the Printable

Specified by:
print in interface java.awt.print.Printable

Print

protected int Print(java.awt.Graphics g,
                    java.awt.print.PageFormat pageFormat,
                    int pageIndex)
Method which is called from print


print

public void print(java.io.FileInputStream fis)
Reads the contents from FileInputStream and send it to the printer for print outs.

Parameters:
fis - The specified FileInputStream Note : The port property will be considered while user takes print outs using this method.

print

public void print(java.io.FileInputStream fis,
                  java.lang.String port)
Reads the contents from FileInputStream and send it
to the specified printer port for print outs.

Parameters:
fis - The specified FileInputStream
port - The specified printer port on to which print out will be taken
If port value is null string then LPT1 port will be considered.

print

public void print(byte[] bytes)
Reads the contents of bytes array and send it
to the printer for print outs.

Parameters:
bytes - The specified bytes arry
Note : The port property will be considered while user
takes print outs using this method.

print

public void print(byte[] bytes,
                  java.lang.String port)
Reads the contents of bytes array and send it
to the specified printer port for print outs.

Parameters:
bytes - The specified bytes array
port - The specified printer port on to which print out will be taken
If port value is null then LPT1 port will be considered.

getNoOfPages

public int getNoOfPages()
Method which returns the no of pages

Returns:
returns the no of pages

drawHeaders

protected void drawHeaders(java.awt.Graphics2D g,
                           int pageIndex)
method which draws headers for the every pages


getPreferredSize

public java.awt.Dimension getPreferredSize()
Method which returns the preferred size


findFrame

public javax.swing.JFrame findFrame(java.awt.Component component)
Utility method for find a frame

Parameters:
component - The component for which frame required

setPaperType

public void setPaperType(int paperType)
Sets the value of paper type property

Parameters:
paperType - The int value for paper type property
possible values are :
LETTER_TYPE,
LEGAL_TYPE,
EXECUTIVE_TYPE,
A4_TYPE,
A5_TYPE,
B5_TYPE,
N010_ENVELOP_TYPE,
A2_ENVELOP_TYPE,
DL_ENVELOP_TYPE,
C6_ENVELOP_TYPE,
INDEX_CARD_4x6_TYPE,
INDEX_CARD_5x8_TYPE,
A6_CARD_TYPE,
HAGAKI_CARD_TYPE,
CUSTOM_TYPE,

getPaperType

public int getPaperType()
Returns the value of paper type property

Returns:
The value of paper type property

setPaperSize

public void setPaperSize(double width,
                         double height)
Sets the paper's size

Parameters:
width - The width of the page
height - The height of the page
Note : if you are using paper type = "Custom" then only set it, otherwise do not set it
Please supply this value in inches

getPaperWidth

public double getPaperWidth()
Returns the value of property paper width, in inches

Returns:
The value of property paper width, in inches
Note : if you are using paper type = "Custom" then only set it, otherwise do not set it

getPaperHeight

public double getPaperHeight()
Returns the value of property paper height, in inches

Returns:
The value of property paper height, in inches

getImageablePaperWidth

public double getImageablePaperWidth()
Returns the imageable paper width

Returns:
The imageable paper width, i.e. the width only on to which printing occurs
The value returned in 1/72nds of an inch

getImageablePaperHeight

public double getImageablePaperHeight()
Returns the imageable paper height

Returns:
The imageable paper height, i.e. the height only on to which printing occurs
The value returned in 1/72nds of an inch

getActualPaperWidth

public double getActualPaperWidth()
Returns the actual paper width

Returns:
The actual paper width
i.e actualPaperWidth = (paperWidth - leftMargin - rightMargin)
The value returned in 1/72nds of an inch

getActualPaperHeight

public double getActualPaperHeight()
Returns the actual paper height

Returns:
The actual paper height
i.e actualPaperHeight = (paperHeight - topMargin - bottomMargin - gapBelowHeader - gapAboveFooter - headerHeight - footerHeight)
The value returned in 1/72nds of an inch

setLeftHeader

public void setLeftHeader(java.lang.String leftHeader)
Sets the left header of the page(s)

Parameters:
leftHeader - The left header of the page(s)
Note: one can mix header/footer with the following following string constants.
Printer.CURRENT_DATE
Printer.CURRENT_TIME
Printer.PAGE_NO
Printer.TOTAL_PAGES
Example: suppose one want to set the current date then use
setXXXYYY("Date: "+Printer.CURRENT_DATE);
Example: suppose one want to set the current time then use
setXXXYYY("Date: "+Printer.CURRENT_TIME);
Example: suppose one want to set the page no. then use
setXXXYYY("Page No.: "+Printer.PAGE_NO);
Example: suppose one want to set the page no. of total no. of pages (Page 1/10) then use
setXXXYYY("Page: " + Printer.PAGE_NO + " of " + Printer.TOTAL_PAGES);
where XXX = set and
YYY = Header/Footer

getLeftHeader

public java.lang.String getLeftHeader()
Returns the left header of the page(s)

Returns:
The left header of the page(s)

setCenterHeader

public void setCenterHeader(java.lang.String centerHeader)
Sets the center header of the page(s)

Parameters:
centerHeader - The center header of the page(s)
Note: one can mix header/footer with the following following string constants.
Printer.CURRENT_DATE
Printer.CURRENT_TIME
Printer.PAGE_NO
Printer.TOTAL_PAGES
Example: suppose one want to set the current date then use
setXXXYYY("Date: "+Printer.CURRENT_DATE);
Example: suppose one want to set the current time then use
setXXXYYY("Date: "+Printer.CURRENT_TIME);
Example: suppose one want to set the page no. then use
setXXXYYY("Page No.: "+Printer.PAGE_NO);
Example: suppose one want to set the page no. of total no. of pages (Page 1/10) then use
setXXXYYY("Page: " + Printer.PAGE_NO + " of " + Printer.TOTAL_PAGES);
where XXX = set and YYY = Header/Footer

getCenterHeader

public java.lang.String getCenterHeader()
Returns the center header of the page(s)

Returns:
The center header of the page(s)

setRightHeader

public void setRightHeader(java.lang.String rightHeader)
Sets the right header of the page(s)

Parameters:
rightHeader - The right header of the page(s)
Note: one can mix header/footer with the following following string constants.
Printer.CURRENT_DATE
Printer.CURRENT_TIME
Printer.PAGE_NO
Printer.TOTAL_PAGES
Example: suppose one want to set the current date then use
setXXXYYY("Date: "+Printer.CURRENT_DATE);
Example: suppose one want to set the current time then use
setXXXYYY("Date: "+Printer.CURRENT_TIME);
Example: suppose one want to set the page no. then use
setXXXYYY("Page No.: "+Printer.PAGE_NO);
Example: suppose one want to set the page no. of total no. of pages (Page 1/10) then use
setXXXYYY("Page: " + Printer.PAGE_NO + " of " + Printer.TOTAL_PAGES);
where XXX = set and
YYY = Header/Footer

getRightHeader

public java.lang.String getRightHeader()
Returns the right header of the page(s)

Returns:
The right header of the page(s)

setLeftFooter

public void setLeftFooter(java.lang.String leftFooter)
Sets the left footer of the page(s)

Parameters:
leftFooter - The left footer of the page(s)
Note: one can mix header/footer with the following following string constants.
Printer.CURRENT_DATE
Printer.CURRENT_TIME
Printer.PAGE_NO
Printer.TOTAL_PAGES
Example: suppose one want to set the current date then use
setXXXYYY("Date: "+Printer.CURRENT_DATE);
Example: suppose one want to set the current time then use
setXXXYYY("Date: "+Printer.CURRENT_TIME);
Example: suppose one want to set the page no. then use
setXXXYYY("Page No.: "+Printer.PAGE_NO);
Example: suppose one want to set the page no. of total no. of pages (Page 1/10) then use
setXXXYYY("Page: " + Printer.PAGE_NO + " of " + Printer.TOTAL_PAGES);
where XXX = set and
YYY = Header/Footer

getLeftFooter

public java.lang.String getLeftFooter()
Returns the left footer of the page(s)

Returns:
The left footer of the page(s)

setCenterFooter

public void setCenterFooter(java.lang.String centerFooter)
Sets the center footer of the page(s)

Parameters:
centerFooter - The center footer of the page(s)
Note: one can mix header/footer with the following following string constants.
Printer.CURRENT_DATE
Printer.CURRENT_TIME
Printer.PAGE_NO
Printer.TOTAL_PAGES
Example: suppose one want to set the current date then use
setXXXYYY("Date: "+Printer.CURRENT_DATE);
Example: suppose one want to set the current time then use
setXXXYYY("Date: "+Printer.CURRENT_TIME);
Example: suppose one want to set the page no. then use
setXXXYYY("Page No.: "+Printer.PAGE_NO);
Example: suppose one want to set the page no. of total no. of pages (Page 1/10) then use
setXXXYYY("Page: " + Printer.PAGE_NO + " of " + Printer.TOTAL_PAGES);
where XXX = set and
YYY = Header/Footer

getCenterFooter

public java.lang.String getCenterFooter()
Returns the center footer of the page(s)

Returns:
The center footer of the page(s)

setRightFooter

public void setRightFooter(java.lang.String rightFooter)
Sets the right footer of the page(s)

Parameters:
rightFooter - The right footer of the page(s)
Note: one can mix header/footer with the following following string constants.
Printer.CURRENT_DATE
Printer.CURRENT_TIME
Printer.PAGE_NO
Printer.TOTAL_PAGES
Example: suppose one want to set the current date then use
setXXXYYY("Date: "+Printer.CURRENT_DATE);
Example: suppose one want to set the current time then use
setXXXYYY("Date: "+Printer.CURRENT_TIME);
Example: suppose one want to set the page no. then use
setXXXYYY("Page No.: "+Printer.PAGE_NO);
Example: suppose one want to set the page no. of total no. of pages (Page 1/10) then use
setXXXYYY("Page: " + Printer.PAGE_NO + " of " + Printer.TOTAL_PAGES);
where XXX = set and
YYY = Header/Footer

getRightFooter

public java.lang.String getRightFooter()
Returns the right footer of the page(s)

Returns:
The right footer of the page(s)

setLeftMargin

public void setLeftMargin(double leftMargin)
Sets the left margin of the page(s), in inches

Parameters:
leftMargin - the left margin of the page(s), in inches

getLeftMargin

public double getLeftMargin()
Returns the left margin of the page(s), in inches

Returns:
The left margin of the page(s), in inches

setRightMargin

public void setRightMargin(double rightMargin)
Sets the right margin of the page(s), in inches

Parameters:
rightMargin - the right margin of the page(s), in inches

getRightMargin

public double getRightMargin()
Returns the right margin of the page(s), in inches

Returns:
The right margin of the page(s), in inches

setTopMargin

public void setTopMargin(double topMargin)
Sets the top margin of the page(s), in inches

Parameters:
topMargin - the top margin of the page(s), in inches

getTopMargin

public double getTopMargin()
Returns the top margin of the page(s), in inches

Returns:
The top margin of the page(s), in inches

setBottomMargin

public void setBottomMargin(double bottomMargin)
Sets the bottom margin of the page(s), in inches

Parameters:
bottomMargin - the bottom margin of the page(s), in inches

getBottomMargin

public double getBottomMargin()
Returns the bottom margin of the page(s), in inches

Returns:
The bottom margin of the page(s), in inches

setPageOrientation

public void setPageOrientation(int pageOrientation)
Sets the page orientation of the page(s)

Parameters:
pageOrientation - The page orientation of the page(s)
The possible values for the pageOrientation is LANDSCAPE or PORTRAIT

getPageOrientation

public int getPageOrientation()
Returns the page orientation of the page(s)

Returns:
The page orientation of the page(s)

setNoOfCopies

public void setNoOfCopies(int noOfCopies)
Sets the no of copies of the page(s)

Parameters:
noOfCopies - The no of copies of the page(s)

getNoOfCopies

public int getNoOfCopies()
Returns the no of copies of the page(s)

Returns:
The no of copies of the page(s)

setGapBelowHeader

public void setGapBelowHeader(double gapBelowHeader)
Sets the value of gap below header of the page(s), in inches

Parameters:
gapBelowHeader - The value of gap below header of the page(s), in inches

getGapBelowHeader

public double getGapBelowHeader()
Returns the value of gap below header of the page(s), in inches

Returns:
The value of gap below header of the page(s), in inches

setGapAboveFooter

public void setGapAboveFooter(double gapAboveFooter)
Sets the value of gap above footer of the page(s), in inches


getGapAboveFooter

public double getGapAboveFooter()
Returns the value of gap above footer of the page(s), in inches

Returns:
The value of gap above footer of the page(s), in inches

setShowLineBelowHeader

public void setShowLineBelowHeader(boolean showLineBelowHeader)
Sets the boolean value of, is line below header to be drawn?

Parameters:
showLineBelowHeader - The boolean value of, is line below header to be drawn?

isShowLineBelowHeader

public boolean isShowLineBelowHeader()
Returns The boolean value of, is line below header to be drawn?

Returns:
The boolean value of, is line below header to be drawn?

setShowLineAboveFooter

public void setShowLineAboveFooter(boolean showLineAboveFooter)
Sets the boolean value of, is line above footer to be drawn?

Parameters:
showLineAboveFooter - The boolean value of, is line above footer to be drawn?

isShowLineAboveFooter

public boolean isShowLineAboveFooter()
Returns The boolean value of, is line above footer to be drawn?

Returns:
The boolean value of, is line above footer to be drawn?

setShowPrintDialog

public void setShowPrintDialog(boolean showPrintDialog)
Sets the boolean value of, is display the print dialog while print method is called

Parameters:
showPrintDialog - The boolean value of, is display the print dialog while print method is called

isShowPrintDialog

public boolean isShowPrintDialog()
Returns The boolean value of, is display the print dialog while print method is called

Returns:
The boolean value of, is display the print dialog while print method is called

setPrintJobName

public void setPrintJobName(java.lang.String jobName)
Returns the print job name


getPrintJobName

public java.lang.String getPrintJobName()
Returns the print job name


setScaleComponentToSinglePage

public void setScaleComponentToSinglePage(boolean isScaleComponentToSinglePage)
Sets the wheather scale the component to fit to the single page
If true, the big component will be scaled to fit to the single page
If false, the big component will be wrapped and component will be
printed on multiple pages instead of single page

Parameters:
isScaleComponentToSinglePage - The specified value either scale or wrap component

isScaleComponentToSinglePage

public boolean isScaleComponentToSinglePage()
Returns the wheather scale the component to fit to the single page
If true, the big component will be scaled to fit to the single page
If false, the big component will be wrapped and component will be
printed on multiple pages instead of single page

Returns:
isScaleComponentToSinglePage The specified value either scale or wrap component

setPort

public void setPort(java.lang.String port)
Sets the target port, printer use this port to print pages

Parameters:
port - The target port
Note : This port will be considered by printer bean only when one
will invoke one of the following methods to take print outs
1. print(FileInputStream fis);
2. print(byte[] bytes);
Example : LPT1, LPT2 or
\\machine1\\tvs
where machine1 is the name of network computer and tvs is port name
Default : Default value of this Port property is LPT1.

getPort

public java.lang.String getPort()
Returns the target port

Returns:
The target port

setPrintBookIndividually

public void setPrintBookIndividually(boolean isPrintBookIndividually)
Sets the wheather user want to print the book of pages individually or not

Parameters:
isPrintBookIndividually - Wheather user want to print the book of pages individually or not
If the parameter value is true, printer will make the individual print call for individual books,
and each book of pages has size equals to Book Size property value
This property is important when the number of pages is very large number,
and in that case if user prints all the pages with single printer job,
then due to spooling process it will take too long to print all the pages,
instead of taking print of all the pages in one print call,
it is recommonded that when there is very large number of pages to print
set the value of this property to true, so it will print the book of pages individually
and prints the diffrent books separately so printer does not stuck in spooling process
and it print fast.
The book size property is depends on this property, after set value of this property to true
set the book size which you desire.
Example : If there are 1000 pages and the book size = 5 has been set
Then printer prints all the 1000/5 = 200 books individually

isPrintBookIndividually

public boolean isPrintBookIndividually()
Returns the wheather print the book of pages individually or not

Returns:
The wheather print the book of pages individually or not

setBookSize

public void setBookSize(int bookSize)
Sets the book size

Parameters:
bookSize - The book size
This property takes effect only if the value of property PrintBookIndividually is true
otherwise book size does not take any effect
default value of the book size is 1
If the value of property PrintBookIndividually is true, and book size is 5 then
it prints the book of 5 pages individually

getBookSize

public int getBookSize()
Returns the book size

Returns:
The book size
This property takes effect only if the value of property PrintBookIndividually is true
otherwise book size does not take any effect

setLicenseKey

public void setLicenseKey(java.lang.String licenseKey)
Methods which sets the license key


getLicenseKey

public java.lang.String getLicenseKey()
Returns the license key of the bean

Returns:
The license key of the bean

createPreviewPage

protected PreviewPage createPreviewPage(int width,
                                        int height,
                                        java.awt.Image image,
                                        int pageIndex)
Method which creates the preview page

Parameters:
width - The width for the preview page
height - The height for the preview page
image - The image for the preview page
pageIndex - The pageIndex for the preview page
Returns:
The preview page

addPrinterListener

public void addPrinterListener(PrinterListener l)
Adds the printer listener

Parameters:
l - The printer listener

removePrinterListener

public void removePrinterListener(PrinterListener l)
Removes the printer listener

Parameters:
l - The printer listener

firePrinterEvent

public void firePrinterEvent(PrinterEvent e)
fires the PrinterEvent

Parameters:
e - The PrinterEvent

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Method which adds the PropertyChangeListener

Parameters:
l - The PropertyChangeListener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Method which removes the PropertyChangeListener

Parameters:
l - The PropertyChangeListener

firePropertyChange

public void firePropertyChange(java.lang.String property,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Method which fires the property change

Parameters:
property - The property name
oldValue - The old value
newValue - The new value

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Implementation of writeExternal method

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Implementation of writeExternal method

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

ElegantJ Data Tables Java API Specification v1.1

Submit a bug or feature

Copyright(c)
Elegant Microweb Technologies Pvt. Ltd.
www.elegantmicroweb.com
www.elegantjbeans.com
All Rights Reserved.