|
Ontimize 5.2072EN | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ontimize.printing.HTMLProcessor
Class to parse HTML code. This class can use the html string or the path of a
html file.
It allows to replace some keys in the text with other string values. It does
not allow page break
| Field Summary | |
static java.lang.String |
CELL_HEAD_TAG
|
static java.lang.String |
CELL_TAG
|
protected java.lang.String |
code
|
static boolean |
DEBUG
|
protected javax.swing.text.html.HTMLDocument |
document
|
protected javax.swing.text.html.HTMLEditorKit |
editor
|
static java.lang.String |
END_CELL_HEAD_TAG
|
static java.lang.String |
END_CELL_TAG
|
static java.lang.String |
END_ROW_TAG
|
static java.lang.String |
END_TABLE_TAG
|
protected java.lang.String |
footId
|
protected java.lang.String |
headId
|
static java.lang.String |
ROW_TAG
|
static java.lang.String |
TABLE_TAG
|
protected javax.swing.JTextPane |
textPane
|
| Constructor Summary | |
HTMLProcessor(java.lang.String htmlCode,
java.net.URL base)
Creates a processor class using the html code |
|
HTMLProcessor(java.net.URL fileURL)
Builds a new processor using the html file with the specified URL |
|
HTMLProcessor(java.net.URL fileURL,
java.net.URL base)
Builds a new processor using the file with the specified URL |
|
| Method Summary | |
void |
advancedPrint(java.awt.print.PageFormat pf,
int height)
|
javax.swing.text.html.HTMLDocument |
getDocument()
Get the document used for this processor to can use it in a text panel |
javax.swing.text.html.HTMLEditorKit |
getEditorKit()
Get the EditorKit used for this processor to can use it in a text panel |
java.lang.String |
getHTML()
|
javax.swing.JTextPane |
getJTextPane()
Get a JTextPanel with the current document text The processor save a reference to the returned panel |
java.awt.print.Printable |
getPrintable(java.awt.print.PageFormat pf,
int height)
|
java.lang.String |
insertTable(java.lang.String text,
java.util.Hashtable tableValues)
|
java.lang.String |
insertTable(java.lang.String text,
java.util.Hashtable tableValues,
java.util.Vector sortColumns)
Insert a table using its values, replacing in the html code the key word text with the table HTML equivalence. |
void |
print(java.awt.print.PageFormat pf,
int height)
|
void |
replaceTextInHTML(java.lang.String text,
byte[] imageBytes,
int width,
int height)
Replace the text in the html code with the image represented
by the bytes array. |
void |
replaceTextInHTML(java.lang.String text,
java.lang.String newText)
Replaces the text in the string HTML with the newTextThis replaces the code in the same html code and this method must be used carefully. |
void |
reset()
Undo all the changes in the html code and set the original value again |
void |
setFoot(java.lang.String id)
Fixes the element with attribute id as footer in the template
for all the pages.If the element has children the children will be in the
footer too. |
void |
setHead(java.lang.String id)
Fixes the element with attribute id as header in the template
for all the pages. |
java.util.Vector |
toPages(java.awt.print.PageFormat pageFormat)
Gets a vector of JTextPane with the document separated by pages with the specified page format. |
void |
updateTextPane()
Update the values of the JTextPane with the last changes in the HTML |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final boolean DEBUG
public static final java.lang.String TABLE_TAG
public static final java.lang.String ROW_TAG
public static final java.lang.String CELL_HEAD_TAG
public static final java.lang.String CELL_TAG
public static final java.lang.String END_ROW_TAG
public static final java.lang.String END_CELL_HEAD_TAG
public static final java.lang.String END_CELL_TAG
public static final java.lang.String END_TABLE_TAG
protected java.lang.String code
protected javax.swing.text.html.HTMLDocument document
protected javax.swing.text.html.HTMLEditorKit editor
protected javax.swing.JTextPane textPane
protected java.lang.String headId
protected java.lang.String footId
| Constructor Detail |
public HTMLProcessor(java.lang.String htmlCode,
java.net.URL base)
throws java.lang.Exception
htmlCode - base -
java.lang.Exception
public HTMLProcessor(java.net.URL fileURL,
java.net.URL base)
throws java.lang.Exception
fileURL - base -
java.lang.Exception
public HTMLProcessor(java.net.URL fileURL)
throws java.lang.Exception
fileURL -
java.lang.Exception| Method Detail |
public void replaceTextInHTML(java.lang.String text,
java.lang.String newText)
text in the string HTML with the newText
text - Text to replacenewText - New text to set
public void replaceTextInHTML(java.lang.String text,
byte[] imageBytes,
int width,
int height)
text in the html code with the image represented
by the bytes array.width or height are 0 then the image size
will be the real
text - imageBytes - width - height - public javax.swing.text.html.HTMLEditorKit getEditorKit()
public javax.swing.text.html.HTMLDocument getDocument()
public java.lang.String getHTML()
public javax.swing.JTextPane getJTextPane()
public void updateTextPane()
public void reset()
throws java.lang.Exception
java.lang.Exception
public java.lang.String insertTable(java.lang.String text,
java.util.Hashtable tableValues,
java.util.Vector sortColumns)
text with the table HTML equivalence.
text - tableValues - The keys of this hashtable are the names of the table columns
and the values are vectors whit the column values. If some of
these values are hashtables then they are new tables in the
appropriate cell.sortColumns - This vector contains the name of the table columns in the order
to put them in the table. These columns must be the keys of the
tableValues hashtable
public java.lang.String insertTable(java.lang.String text,
java.util.Hashtable tableValues)
public java.util.Vector toPages(java.awt.print.PageFormat pageFormat)
pageFormat -
public void print(java.awt.print.PageFormat pf,
int height)
public void setHead(java.lang.String id)
id as header in the template
for all the pages. If the element has children the children will be in the
header too.
id - public void setFoot(java.lang.String id)
id as footer in the template
for all the pages.If the element has children the children will be in the
footer too.
id -
public void advancedPrint(java.awt.print.PageFormat pf,
int height)
pf - Page format to use in the printing methodheight - Height in pixels from the text pane of this processor
public java.awt.print.Printable getPrintable(java.awt.print.PageFormat pf,
int height)
|
Ontimize | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||