com.javawisdom.util.print
Class JvPrinter

java.lang.Object
  extended bycom.javawisdom.util.print.JvPrinter
All Implemented Interfaces:
java.awt.print.Printable

public class JvPrinter
extends java.lang.Object
implements java.awt.print.Printable


Field Summary
static int A2_Envelop
          A2 Envelop (4.38 x 5.75 in.)
static int A3
          A3 (297 x 420 mm)
static int A4
          A4 (210 x 297 mm)
static int A5
          A5 (148 x 210 mm)
static int A6_Card
          A6 Card (105 x 148.5 mm)
static int B5_JIS
          B5(JIS) (182 x 257 mm)
static int C6_Envelop
          C6 Envelop (114 x 162 mm)")
static java.lang.String CURRENT_DATE
          Current date.
static java.lang.String CURRENT_TIME
          Displays the current time.
static int CUSTOM
          The paper type CUSTOM
static java.lang.String DateTime
          DateTime
static int DL_Envelop
          DL Envelop (220 x 110 mm)
static int Envelop_10
          10# Envelop (4.125 x 9.5 in.)
static int Executive
          Executive (7.25 x 10.5 in.)
static int Index_Card
          Index Card (4 x 6 in.)
static int Index_Card2
          Index Card (5 x 8 in.)
static int Invite_Envelop
          Invite Envelop (220 x 220 mm)
static int Italy_Envelop
          Italy Envelop (110 x 230 mm)
static int JP_Card
          JP Card (100 x 148 mm)
static int LANDSCAPE
          The orientation of page
static int Ledger
          Ledger (11 x 17 in.)
static int Legal
          Legal (8.5 x 14 in.)
static int Letter
          Letter (8.5 x 11 in.)
static java.lang.String PAGE_NO
          Current page number PAGE_NO
static int PORTRAIT
          The orientation of page
static int Tabloid
          Tabloid (17 x 11 in.)
static java.lang.String TOTAL_PAGES
          Total pages.
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
JvPrinter()
          Default constructor
 
Method Summary
 void addPrinterListener(com.javawisdom.util.print.PrinterListener printerlistener)
           
 double getBottomMargin()
          Returns the value of the bottom margin
 int getBufferSize()
          Returns the whole buffer size which the printer job will take place
 java.lang.String getCenterFooter()
           
 java.lang.String getCenterHeader()
          Returns the value of the center header
 double getFactPageHeight()
          Returns the value of the in fact page height
 double getFactPageWidth()
          Returns the value of the page width
 double getGapAboveFooter()
          Returns the value of gap above footer
 double getGapBelowHeader()
          Returns the value of the gap below the header
 double getImageablePaperHeight()
           
 double getImageablePaperWidth()
           
 java.lang.String getLeftFooter()
          Returns the left footer
 java.lang.String getLeftHeader()
          Returns the value of the left header
 double getLeftMargin()
          Returns the value of the left margin
 int getNoOfCopies()
           
 int getNoOfPages()
           
 int getPageOrientation()
           
 double getPaperHeight()
          Returns the value of the page height
 double getPaperWidth()
          Returns the value of the page width
 int getPapeType()
           
 java.lang.String getPort()
          Returns the printer port
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getPrintJobName()
          Returns the print job name
 java.lang.String getRightFooter()
          Returns the value of the roght footer
 java.lang.String getRightHeader()
          Returns the value of the right header
 double getRightMargin()
           
 double getTopMargin()
          Returuns the value of the top margin
 boolean isPrintDirect()
           
 boolean isShowLineAboveFooter()
          Returns the flag which indicates whether shows line above footer or not
 boolean isShowLineBelowHeader()
          Returns whether shows line below header
 boolean isShowPrintDialog()
          Returns whether shows print dialog or noe
 boolean isSinglePage()
          Returns Whether the component will be printed in a single page or mot
 void pageSetup()
          To set up the page
 void pageSetup(java.awt.Frame frame)
          Sets up print page
 void preview()
          Preview the printing page(s)
 void preview(java.awt.Frame frame)
          Displays the preview dialog
 void print()
          Call this method to execute the printing job
 void print(byte[] abyte0)
          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 fileinputstream)
          Reads the contents from FileInputStream and send it to the printer for print outs.
 void print(java.io.FileInputStream fileinputstream, 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)
          Prints the page at the specified index into the specified Graphics context in the specified format
 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)
 void setAWTTextArea(java.awt.TextArea textarea)
          Sets the AWTTextArea
 void setBottomMargin(double bMargin)
           
 void setBufferSize(int size)
           
 void setCenterFooter(java.lang.String centerfooter)
          Sets the value of the center footer
 void setCenterHeader(java.lang.String header)
          Sets the value of the center header
 void setComponent(java.awt.Component ct)
          Sets the component
 void setGapAboveFooter(double gap)
          Sets the value of the gap above footer
 void setGapBelowHeader(double gapbelowHeader)
          Sets the value of gap below header of the page
 void setJTable(javax.swing.JTable jtable)
          Sets hte jtable
 void setJTextArea(javax.swing.JTextArea jtextarea)
          Sets the JTextArea
 void setJTextPane(javax.swing.JTextPane jtextpane)
          Sets the JtestPane
 void setLeftFooter(java.lang.String leftfooter)
          Sets the left footer
 void setLeftHeader(java.lang.String leftheader)
          Sets the value of left header
 void setLeftMargin(double leftmargin)
          Sets the value of the left margin
 void setNoOfCopies(int copies)
          Sets how many copies to print
 void setPageOrientation(int i)
          Sets the the page orientation
 void setPaperSize(double width, double height)
          Sets the pape size
 void setPapeType(int pageType)
          Sets the value of pape type property
 void setPort(java.lang.String font)
           
 void setPrintDirect(boolean flag)
           
 void setPrintJobName(java.lang.String printjobname)
           
 void setRightFooter(java.lang.String rightfooter)
          Sets the value of the right footer
 void setRightHeader(java.lang.String rightheader)
          Sets the value of the right header
 void setRightMargin(double rightmargin)
          Sets the value of the right margin
 void setShowLineAboveFooter(boolean flag)
           
 void setShowLineBelowHeader(boolean flag)
           
 void setShowPrintDialog(boolean flag)
           
 void setSinglePage(boolean flag)
           
 void setTopMargin(double topmargin)
          Sets the value of the top margin
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

A3

public static int A3
A3 (297 x 420 mm)


A4

public static int A4
A4 (210 x 297 mm)


A5

public static int A5
A5 (148 x 210 mm)


B5_JIS

public static int B5_JIS
B5(JIS) (182 x 257 mm)


Letter

public static int Letter
Letter (8.5 x 11 in.)


Legal

public static int Legal
Legal (8.5 x 14 in.)


Ledger

public static int Ledger
Ledger (11 x 17 in.)


Tabloid

public static int Tabloid
Tabloid (17 x 11 in.)


Executive

public static int Executive
Executive (7.25 x 10.5 in.)


Invite_Envelop

public static int Invite_Envelop
Invite Envelop (220 x 220 mm)


Italy_Envelop

public static int Italy_Envelop
Italy Envelop (110 x 230 mm)


Envelop_10

public static int Envelop_10
10# Envelop (4.125 x 9.5 in.)


A2_Envelop

public static int A2_Envelop
A2 Envelop (4.38 x 5.75 in.)


DL_Envelop

public static int DL_Envelop
DL Envelop (220 x 110 mm)


C6_Envelop

public static int C6_Envelop
C6 Envelop (114 x 162 mm)")


Index_Card

public static int Index_Card
Index Card (4 x 6 in.)


Index_Card2

public static int Index_Card2
Index Card (5 x 8 in.)


JP_Card

public static int JP_Card
JP Card (100 x 148 mm)


A6_Card

public static int A6_Card
A6 Card (105 x 148.5 mm)


CUSTOM

public static int CUSTOM
The paper type CUSTOM


CURRENT_TIME

public static java.lang.String CURRENT_TIME
Displays the current time.
Example Time:
13:10:50


TOTAL_PAGES

public static java.lang.String TOTAL_PAGES
Total pages.
Example:
Page 10 of 50


PAGE_NO

public static java.lang.String PAGE_NO
Current page number PAGE_NO


CURRENT_DATE

public static java.lang.String CURRENT_DATE
Current date.
Example:
Date: 28/11/2005


DateTime

public static java.lang.String DateTime
DateTime


PORTRAIT

public static int PORTRAIT
The orientation of page


LANDSCAPE

public static int LANDSCAPE
The orientation of page

Constructor Detail

JvPrinter

public JvPrinter()
Default constructor

Method Detail

getLeftFooter

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

Returns:
The lsft footer

isShowLineBelowHeader

public boolean isShowLineBelowHeader()
Returns whether shows line below header

Returns:
Whether shows line below header

isShowPrintDialog

public boolean isShowPrintDialog()
Returns whether shows print dialog or noe

Returns:
Whether shows print dialog or not

getGapAboveFooter

public double getGapAboveFooter()
Returns the value of gap above footer

Returns:
The value of gap above footer

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

setLeftFooter

public void setLeftFooter(java.lang.String leftfooter)
Sets the left footer

Parameters:
leftfooter - The left footer

setGapBelowHeader

public void setGapBelowHeader(double gapbelowHeader)
Sets the value of gap below header of the page

Parameters:
gapbelowHeader - The gap below header

setJTable

public void setJTable(javax.swing.JTable jtable)
Sets hte jtable

Parameters:
jtable - The jtable

preview

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

Parameters:
frame - The frame

isShowLineAboveFooter

public boolean isShowLineAboveFooter()
Returns the flag which indicates whether shows line above footer or not

Returns:
Whether shows line above footer or not

setTopMargin

public void setTopMargin(double topmargin)
Sets the value of the top margin

Parameters:
topmargin - The value of the top margin

setJTextPane

public void setJTextPane(javax.swing.JTextPane jtextpane)
Sets the JtestPane

Parameters:
jtextpane - The JTextPane

setNoOfCopies

public void setNoOfCopies(int copies)
Sets how many copies to print

Parameters:
copies - The No of Copies

setLeftHeader

public void setLeftHeader(java.lang.String leftheader)
Sets the value of left header

Parameters:
leftheader - The left header

getCenterHeader

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

Returns:
The center header

setShowLineBelowHeader

public void setShowLineBelowHeader(boolean flag)
Parameters:
flag - Whether shows line below header or not

setRightFooter

public void setRightFooter(java.lang.String rightfooter)
Sets the value of the right footer

Parameters:
rightfooter - The right footer

setCenterFooter

public void setCenterFooter(java.lang.String centerfooter)
Sets the value of the center footer

Parameters:
centerfooter - The center footer

isSinglePage

public boolean isSinglePage()
Returns Whether the component will be printed in a single page or mot

Returns:
Whether the component will be printed in a single page or not

setBufferSize

public void setBufferSize(int size)
Parameters:
size - The Buffer size

setBottomMargin

public void setBottomMargin(double bMargin)
Parameters:
bMargin - The value of the bottom margin

getNoOfPages

public int getNoOfPages()
Returns:
The how many copied to print

print

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

Parameters:
fileinputstream - The file input stream
port - The port print

getCenterFooter

public java.lang.String getCenterFooter()
Returns:
The value of the center footer

setCenterHeader

public void setCenterHeader(java.lang.String header)
Sets the value of the center header

Parameters:
header - The value of the center header

setGapAboveFooter

public void setGapAboveFooter(double gap)
Sets the value of the gap above footer

Parameters:
gap - The value of thegap above footer

print

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

Parameters:
pageIndex - the page index

getBufferSize

public int getBufferSize()
Returns the whole buffer size which the printer job will take place

Returns:
The buffer size

setPrintJobName

public void setPrintJobName(java.lang.String printjobname)
Parameters:
printjobname - The print job name

setRightHeader

public void setRightHeader(java.lang.String rightheader)
Sets the value of the right header

Parameters:
rightheader - The value of the right header

setLeftMargin

public void setLeftMargin(double leftmargin)
Sets the value of the left margin

Parameters:
leftmargin - The value of the eft margin

setJTextArea

public void setJTextArea(javax.swing.JTextArea jtextarea)
Sets the JTextArea

Parameters:
jtextarea - The JtextArea

addPrinterListener

public void addPrinterListener(com.javawisdom.util.print.PrinterListener printerlistener)
Parameters:
printerlistener - The printlistener

preview

public void preview()
Preview the printing page(s)


getPaperHeight

public double getPaperHeight()
Returns the value of the page height

Returns:
The value of the page height

getPort

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

Returns:
The port

getPaperWidth

public double getPaperWidth()
Returns the value of the page width

Returns:
The value of the page width

pageSetup

public void pageSetup()
To set up the page


setRightMargin

public void setRightMargin(double rightmargin)
Sets the value of the right margin

Parameters:
rightmargin - The value of the right margin

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pageformat,
                 int pageindex)
Prints the page at the specified index into the specified Graphics context in the specified format

Specified by:
print in interface java.awt.print.Printable
Parameters:
g - The graphics
pageformat - The page format
pageindex - The page index

setAWTTextArea

public void setAWTTextArea(java.awt.TextArea textarea)
Sets the AWTTextArea

Parameters:
textarea - The text area

getFactPageHeight

public double getFactPageHeight()
Returns the value of the in fact page height

Returns:
The in fact page height

getPapeType

public int getPapeType()
Returns:
The page type

setShowLineAboveFooter

public void setShowLineAboveFooter(boolean flag)
Parameters:
flag - Whether shows line above footer

getRightMargin

public double getRightMargin()
Returns:
The value of the right margin

getNoOfCopies

public int getNoOfCopies()
Returns:
How many copies will be printed

setComponent

public void setComponent(java.awt.Component ct)
Sets the component

Parameters:
ct - The component

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

setSinglePage

public void setSinglePage(boolean flag)
Parameters:
flag - Whether to be a single page or not

setPapeType

public void setPapeType(int pageType)
Sets the value of pape type property

Parameters:
pageType -

setPrintDirect

public void setPrintDirect(boolean flag)
Parameters:
flag - Whether to print directly or not

getRightHeader

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

Returns:
The value of the right header

getImageablePaperWidth

public double getImageablePaperWidth()
Returns:
The imageable pager width

print

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

Parameters:
fileinputstream - The specified FileInputStream

print

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

Parameters:
abyte0 - The specified bytes arry

pageSetup

public void pageSetup(java.awt.Frame frame)
Sets up print page

Parameters:
frame - The frame

isPrintDirect

public boolean isPrintDirect()
Returns:
Whether to print directly

setPaperSize

public void setPaperSize(double width,
                         double height)
Sets the pape size

Parameters:
width - The page width
height - The page height

getPrintJobName

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

Returns:
The print job name

getBottomMargin

public double getBottomMargin()
Returns the value of the bottom margin

Returns:
The value of the bottom margin

setShowPrintDialog

public void setShowPrintDialog(boolean flag)
Parameters:
flag - Whether shows dialog or not

setPageOrientation

public void setPageOrientation(int i)
Sets the the page orientation

Parameters:
i - The page orientation

getTopMargin

public double getTopMargin()
Returuns the value of the top margin

Returns:
The value of the top margin

getLeftMargin

public double getLeftMargin()
Returns the value of the left margin

Returns:
The value of the left margin

getRightFooter

public java.lang.String getRightFooter()
Returns the value of the roght footer

Returns:
The value of the right footer

getImageablePaperHeight

public double getImageablePaperHeight()
Returns:
The imageable paper height

getLeftHeader

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

Returns:
The value of the left header

getFactPageWidth

public double getFactPageWidth()
Returns the value of the page width

Returns:
The value of the page width

getPageOrientation

public int getPageOrientation()
Returns:
The page orientation

print

public void print()
Call this method to execute the printing job


getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns:
The dimension

setPort

public void setPort(java.lang.String font)
Parameters:
font - The type of font

getGapBelowHeader

public double getGapBelowHeader()
Returns the value of the gap below the header

Returns:
The value of the gap below header