org.jfree.report.modules.output.pageable.plaintext
Class AbstractEpsonPrinterDriver

java.lang.Object
  |
  +--org.jfree.report.modules.output.pageable.plaintext.AbstractEpsonPrinterDriver
Direct Known Subclasses:
Epson24PinPrinterDriver, Epson9PinPrinterDriver

public abstract class AbstractEpsonPrinterDriver
extends java.lang.Object
implements PrinterDriver


Inner Class Summary
protected static class AbstractEpsonPrinterDriver.DriverState
           
 
Field Summary
static java.lang.String FONT_15_CPI
           
static java.lang.String OP_NO_ASSIGN_CHAR_TABLE
           
 
Fields inherited from interface org.jfree.report.modules.output.pageable.plaintext.PrinterDriver
CARRIAGE_RETURN, CPI_10, CPI_12, CPI_15, CPI_17, CPI_20, FORM_FEED, LINE_FEED, LPI_10, LPI_6, SELECT_FONT_COURIER, SELECT_FONT_FROM_MENU, SELECT_FONT_GOTHIC, SELECT_FONT_OCR_A, SELECT_FONT_OCR_B, SELECT_FONT_ORATOR, SELECT_FONT_PRESTIGE, SELECT_FONT_ROMAN, SELECT_FONT_SWISS, SELECT_FONT_SWISS_BOLD, SPACE
 
Constructor Summary
protected AbstractEpsonPrinterDriver(java.io.OutputStream out, float charsPerInch, float linesPerInch, java.lang.String printerModel)
           
 
Method Summary
 void endLine(boolean overflow)
          Ends a new line.
 void endPage(boolean overflow)
          Ends the current page.
 void flush()
          Flushes the output stream.
 float getCharactersPerInch()
          Gets the default character width in CPI.
 AbstractEpsonPrinterDriver.DriverState getDriverState()
           
protected  EncodingUtilities getEncodingUtilities(java.lang.String encoding)
           
 byte getFallBackCharset()
           
 FontMapper getFontMapper()
           
 float getLinesPerInch()
          Gets the default line height.
protected  java.io.OutputStream getOut()
           
 PrinterSpecification getPrinterSpecification()
           
protected abstract  PrinterSpecificationManager getPrinterSpecificationManager()
           
protected  int getSelectedCharacterTable()
           
protected  boolean isFirstPage()
           
 void printChunk(PlaintextDataChunk chunk)
          Prints a single text chunk at the given position on the current line.
 void printEmptyChunk(int count)
          Prints an empty chunk.
 void printRaw(byte[] raw)
          Prints some raw content.
protected  void sendDefineCharacterWidth(float charactersPerInch)
           
protected  void sendDefineCodepage(java.lang.String encoding, int characterTable)
           
protected  void sendDefineFont(byte printerFont)
           
protected  void sendDefineHorizontalBorders(int left, int right)
           
protected abstract  void sendDefineLineSpacing(float lineHeightInPoints)
           
protected  void sendDefinePageLengthInLines(int paperSizeInLines)
           
protected  void sendDefineUserCharacters()
           
protected abstract  void sendFontStyle(boolean bold, boolean italic, boolean underline, boolean strikeTrough)
           
protected  void sendResetPrinter()
           
 void setFallBackCharset(byte fallBackCharset)
           
 void setFontMapper(FontMapper fontMapper)
           
 void startLine()
          Starts a new line.
 void startPage(java.awt.print.Paper paper, java.lang.String encoding)
          Resets the printer and starts a new page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OP_NO_ASSIGN_CHAR_TABLE

public static final java.lang.String OP_NO_ASSIGN_CHAR_TABLE

FONT_15_CPI

public static final java.lang.String FONT_15_CPI
Constructor Detail

AbstractEpsonPrinterDriver

protected AbstractEpsonPrinterDriver(java.io.OutputStream out,
                                     float charsPerInch,
                                     float linesPerInch,
                                     java.lang.String printerModel)
Method Detail

getDriverState

public AbstractEpsonPrinterDriver.DriverState getDriverState()

getFontMapper

public FontMapper getFontMapper()

setFontMapper

public void setFontMapper(FontMapper fontMapper)

getOut

protected java.io.OutputStream getOut()

isFirstPage

protected boolean isFirstPage()

getPrinterSpecification

public PrinterSpecification getPrinterSpecification()

endLine

public void endLine(boolean overflow)
             throws java.io.IOException
Ends a new line.
Specified by:
endLine in interface PrinterDriver
Parameters:
overflow -  
Throws:
java.io.IOException - if an IOError occures.

endPage

public void endPage(boolean overflow)
             throws java.io.IOException
Ends the current page. Should print empty lines or an FORM_FEED command.
Specified by:
endPage in interface PrinterDriver
Parameters:
overflow -  
Throws:
java.io.IOException - if there was an IOError while writing the command

getCharactersPerInch

public float getCharactersPerInch()
Gets the default character width in CPI.
Specified by:
getCharactersPerInch in interface PrinterDriver
Returns:
the default character width in CPI.

getLinesPerInch

public float getLinesPerInch()
Gets the default line height.
Specified by:
getLinesPerInch in interface PrinterDriver
Returns:
the default line height.

flush

public void flush()
           throws java.io.IOException
Flushes the output stream.
Specified by:
flush in interface PrinterDriver
Throws:
java.io.IOException - if an IOError occured.

printChunk

public void printChunk(PlaintextDataChunk chunk)
                throws java.io.IOException
Prints a single text chunk at the given position on the current line. The chunk should not be printed, if an previous chunk overlays this chunk.
Specified by:
printChunk in interface PrinterDriver
Parameters:
chunk - the chunk that should be written
Throws:
java.io.IOException - if an IO error occured.

sendFontStyle

protected abstract void sendFontStyle(boolean bold,
                                      boolean italic,
                                      boolean underline,
                                      boolean strikeTrough)
                               throws java.io.IOException

sendDefineFont

protected void sendDefineFont(byte printerFont)
                       throws java.io.IOException

printEmptyChunk

public void printEmptyChunk(int count)
                     throws java.io.IOException
Prints an empty chunk. This is called for all undefined chunk-cells. The last defined font is used to print that empty text.
Specified by:
printEmptyChunk in interface PrinterDriver
Throws:
java.io.IOException - if an IOError occured.

printRaw

public void printRaw(byte[] raw)
              throws java.io.IOException
Prints some raw content. This content is not processed in any way, so be very carefull.
Specified by:
printRaw in interface PrinterDriver
Parameters:
raw - the content that should be printed.

startLine

public void startLine()
               throws java.io.IOException
Starts a new line.
Specified by:
startLine in interface PrinterDriver
Throws:
java.io.IOException - if an IOError occures.

startPage

public void startPage(java.awt.print.Paper paper,
                      java.lang.String encoding)
               throws java.io.IOException
Resets the printer and starts a new page. Prints the top border lines (if necessary).
Specified by:
startPage in interface PrinterDriver
Throws:
java.io.IOException - if there was an IOError while writing the command

sendDefineCharacterWidth

protected void sendDefineCharacterWidth(float charactersPerInch)
                                 throws java.io.IOException

sendResetPrinter

protected void sendResetPrinter()
                         throws java.io.IOException

sendDefineLineSpacing

protected abstract void sendDefineLineSpacing(float lineHeightInPoints)
                                       throws java.io.IOException

sendDefinePageLengthInLines

protected void sendDefinePageLengthInLines(int paperSizeInLines)
                                    throws java.io.IOException

sendDefineHorizontalBorders

protected void sendDefineHorizontalBorders(int left,
                                           int right)
                                    throws java.io.IOException

sendDefineCodepage

protected void sendDefineCodepage(java.lang.String encoding,
                                  int characterTable)
                           throws java.io.IOException

sendDefineUserCharacters

protected void sendDefineUserCharacters()

getSelectedCharacterTable

protected int getSelectedCharacterTable()

getEncodingUtilities

protected EncodingUtilities getEncodingUtilities(java.lang.String encoding)
                                          throws java.io.IOException

getPrinterSpecificationManager

protected abstract PrinterSpecificationManager getPrinterSpecificationManager()

getFallBackCharset

public byte getFallBackCharset()

setFallBackCharset

public void setFallBackCharset(byte fallBackCharset)