Class HtmlTableWalker

  extended by ix.iface.util.HtmlTableWalker
Direct Known Subclasses:

public class HtmlTableWalker
extends java.lang.Object

A utility object that can be used to visit the cells of an HTML table. The walker assumes that the HTML document contains a single table and that the table represents something that looks like the properties of a list of objects. The walker requires two collections: rowItems and colItems. The rowItems are the objects whose properties are being shown, and the colItems are the properties. The leftmost column of the table is used to list the objects (rowItems), while the other columns correspond to properties. The top row is headers; then there is a row for each object (each rowItem).

So at the upper left corner is a "th" that describes the objects in some way. Maybe it's just "Objects". The rest of the top row consists of "th" elements that describe the properites, one for each property. Then there is one row for each rowItem. The leftmost item on these rows is a "th" describing the object (rowItem) that corresponds to that row; the rest of the row is "td"s that contain descriptions of that object's property values.

For example:

Block Size Colour
A large red
B small green
C tiny blue

A subclass will typically redefine the method walkTD(Element td, Object rowItem, Object colItem).

Field Summary
protected  java.util.Collection colItems
protected  java.util.Collection rowItems
Constructor Summary
HtmlTableWalker(java.util.Collection rowItems, java.util.Collection colItems)
Method Summary
protected  javax.swing.text.Element getChild(javax.swing.text.Element elt, javax.swing.text.html.HTML.Tag tag)
protected  javax.swing.text.html.HTML.Tag getTag(javax.swing.text.Element elt)
 void walkHTML(javax.swing.text.html.HTMLDocument doc)
 void walkRow(javax.swing.text.Element row, java.lang.Object rowItem)
 void walkTable(javax.swing.text.Element table)
 void walkTD(javax.swing.text.Element td, java.lang.Object rowItem, java.lang.Object colItem)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected java.util.Collection rowItems


protected java.util.Collection colItems
Constructor Detail


public HtmlTableWalker(java.util.Collection rowItems,
                       java.util.Collection colItems)
Method Detail


public void walkHTML(javax.swing.text.html.HTMLDocument doc)


public void walkTable(javax.swing.text.Element table)


public void walkRow(javax.swing.text.Element row,
                    java.lang.Object rowItem)


public void walkTD(javax.swing.text.Element td,
                   java.lang.Object rowItem,
                   java.lang.Object colItem)


protected javax.swing.text.html.HTML.Tag getTag(javax.swing.text.Element elt)


protected javax.swing.text.Element getChild(javax.swing.text.Element elt,
                                            javax.swing.text.html.HTML.Tag tag)