com.genedavissoftware.printing
Class FormattedPrint

java.lang.Object
  extended bycom.genedavissoftware.printing.GDSPrinting
      extended bycom.genedavissoftware.printing.FormattedPrint

public class FormattedPrint
extends GDSPrinting

Build a formatted document and print it. types of input possible are plain text, bold text, italicized text, section titles, document titles tables of text and images.

The image and table options still need some work, the rest of this class should be functional.

There is the issue of what to do with multiple spaces. The internal HTML makes extra spaces go away. What should be done? have an addSpace() method? I haven't decided and will gladly take input.


Field Summary
(package private)  java.lang.String doc
           
 
Fields inherited from class com.genedavissoftware.printing.GDSPrinting
BOTTOM, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
FormattedPrint()
           
 
Method Summary
 void addBoldText(java.lang.String text)
          Add bold text to the document.
 void addDocumentTitle(java.lang.String text)
          Add a Title sized String to the document.
 void addImage(java.net.URL image)
          The URL to the image that is to be added to the document.
 void addItalicsText(java.lang.String text)
          Adds italicized text.
 void addLineBreak()
          Add a line break to the document.
 void addPlainText(java.lang.String text)
          Add plain text to the document.
 void addSectionTitle(java.lang.String text)
          Add a section title to the document.
 void addTable(int cols, int rows, java.lang.String[] data)
          Add in a table.
 void clear()
          Empty the internal document in preparation for filling with new text.
static void main(java.lang.String[] args)
          Testing/example for using FormattedPrint
 void print()
          Print the currently maintained internal document.
 
Methods inherited from class com.genedavissoftware.printing.GDSPrinting
setFooter, setFooterAlignment, setHeader, setHeaderAlignment, setInitialPageNumber, setPageNumberHorizontalAlignment, setPageNumberVerticalAlignment, showFooter, showHeader, showPageNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

java.lang.String doc
Constructor Detail

FormattedPrint

public FormattedPrint()
Method Detail

main

public static void main(java.lang.String[] args)
Testing/example for using FormattedPrint


print

public void print()
           throws GDSPrintException
Print the currently maintained internal document.

Throws:
GDSPrintException

clear

public void clear()
Empty the internal document in preparation for filling with new text.


addLineBreak

public void addLineBreak()
Add a line break to the document. Only titles (section and Document) do this automatically.


addPlainText

public void addPlainText(java.lang.String text)
Add plain text to the document.


addItalicsText

public void addItalicsText(java.lang.String text)
Adds italicized text. Some JVMs have a bug that will prevent the italicized text from being italicized.


addBoldText

public void addBoldText(java.lang.String text)
Add bold text to the document.


addSectionTitle

public void addSectionTitle(java.lang.String text)
Add a section title to the document. These titles are smaller than the document titles.


addDocumentTitle

public void addDocumentTitle(java.lang.String text)
Add a Title sized String to the document.


addTable

public void addTable(int cols,
                     int rows,
                     java.lang.String[] data)
Add in a table. The columns and rows of the table are based off the parameters that are passed in . The String[] array fills the table from left to right and top to bottom. Any left over Strings are silently ignored. Any extra fields are filled with empty strings.


addImage

public void addImage(java.net.URL image)
The URL to the image that is to be added to the document. The method ClassLoader.getResource(String name) provides a handy method for generating this URL.

For instance:

ClassLoader.getSystemResource("images/some.jpg");

Would grab the URL of the the image 'some.jpg' in the folder 'images' in the directory that your app was started in.







SourceForge.net Logo