org.htmlparser.parserapplications.filterbuilder

Class HtmlTreeCellRenderer

Implemented Interfaces:
TreeCellRenderer

public class HtmlTreeCellRenderer
extends DefaultTreeCellRenderer
implements TreeCellRenderer

Renderer for tree view of a NodeList.

Constructor Summary

HtmlTreeCellRenderer()
Create a new tree cell renderer for Nodes.

Method Summary

Component
getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
Render the node for the tree cell.
String
toHtml(TagNode tag)
Render the tag as HTML.
String
toText(TextNode node)
Express this string node as a printable string This is suitable for display in a debugger or output to a printout.

Constructor Details

HtmlTreeCellRenderer

public HtmlTreeCellRenderer()
Create a new tree cell renderer for Nodes.

Method Details

getTreeCellRendererComponent

public Component getTreeCellRendererComponent(JTree tree,
                                              Object value,
                                              boolean selected,
                                              boolean expanded,
                                              boolean leaf,
                                              int row,
                                              boolean hasFocus)
Render the node for the tree cell.
Parameters:
tree -
value -
selected -
expanded -
leaf -
row -
hasFocus -
Returns:
See Also:
TreeCellRenderer.getTreeCellRendererComponent(JTree, Object, boolean, boolean, boolean, int, boolean)

toHtml

public String toHtml(TagNode tag)
Render the tag as HTML. This is different from the tag's normal toHtml() method in that it doesn't process children or end tags, just the initial tag, and it also wraps the tag in html a label would expect.
Parameters:
tag - The tag to convert to HTML.
Returns:
A string suitable for rendering the tag.
See Also:
Node.toHtml()

toText

public String toText(TextNode node)
Express this string node as a printable string This is suitable for display in a debugger or output to a printout. Control characters are replaced by their equivalent escape sequence and contents is truncated to 80 characters.
Parameters:
node - The node to render.
Returns:
A string representation of the string node.

HTML Parser is an open source library released under LGPL. SourceForge.net