|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--prog.utils.HTMLTable
This class enables the creation of an HTML table.
You provide the contents for the cells and
specify how many
columns the table is to have, which direction to
fill the table (by
column/VERT
or by row/HORIZ
) and what table properties you prefer. The
makeTable() methods return an String of HTML
tags representing the cell contents in an HTML table.
You can supply the cell data via a Vector of Strings or supply the cell data on cell at a time via addCell().
Field Summary | |
static int |
BOTTOM
A variable representing placement. |
static int |
CENTER
A variable representing placement. |
static int |
HORIZ
A variable representing placement. |
int |
indentSize
How much to indent the table tags in the raw HTML file. |
static int |
LEFT
A variable representing placement. |
static int |
RIGHT
A variable representing placement. |
int |
tableBorder
The size of the table border. |
static int |
TOP
A variable representing placement. |
static int |
VERT
A variable representing placement. |
Constructor Summary | |
HTMLTable()
Prepares for generating a table with 0 indent size. |
|
HTMLTable(int indent)
Prepares for generating a table with specified indent size. |
Method Summary | |
void |
addCell(java.lang.String cellContents)
Adds the cell information to a vector that is used when you call makeTable() with a null value of cellStrs. |
static void |
main(java.lang.String[] args)
|
java.lang.String |
makeTable(java.util.Vector cellStrs,
int direction,
int numCols)
Returns a String expression representing an HTML table with fixed number of columns whose cells are filled with the String values supplied in cellStrs. |
java.lang.String |
makeTable(java.util.Vector cellStrs,
int direction,
int preferredMaxItemsPerCol,
int minCols,
int maxCols)
Returns an HTML table (see makeTable(Vector, int, int) . |
void |
setCellPadSpace(int cellPadding,
int cellSpacing)
Changes the default cell padding and spacing of 2 to cellPadding and cellSpacing. |
void |
setColParams(int column,
int horizAlign,
int vertAlign,
int widthPixels)
Establishes horizontal and vertical alignment of all cells in a given column. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public int tableBorder
public int indentSize
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int TOP
public static final int BOTTOM
public static final int HORIZ
public static final int VERT
Constructor Detail |
public HTMLTable()
public HTMLTable(int indent)
Method Detail |
public void setColParams(int column, int horizAlign, int vertAlign, int widthPixels)
public void setCellPadSpace(int cellPadding, int cellSpacing)
public void addCell(java.lang.String cellContents)
public java.lang.String makeTable(java.util.Vector cellStrs, int direction, int numCols)
addCell(String)
are used. (If no cell values were previously provided,
an error message is returned.)
If direction is HORIZ, cell data are inserted
into the table row by row. If VERT, column by column.
If cellStrs is null, makeTable()uses cell data provided
previously via addCell(String)
.
If no cell data were previously provided, the method
returns an error message.
public java.lang.String makeTable(java.util.Vector cellStrs, int direction, int preferredMaxItemsPerCol, int minCols, int maxCols)
makeTable(Vector, int, int)
. You specify the
direction cell data are to be added to the table,
the preferred maximum number of cells per column
and the maximum and minimum columns you will
allow, and this method determines the best number
of columns for the available data.minCols
- The minimum number of columns if there
are more than one elements. (For only one element,
a single-column table is returned.)preferredMaxItemsPerCol
- The maximum number of
elements allowed per column before a new column is
started. If a new column is needed, elements are
balanced over all columns.maxCols
- The maximum number of columns. If
preferredMaxItemsPerCol would result in more than
maxCols, maxCols takes precedence over
preferredMaxItemsPerCol.public static void main(java.lang.String[] args)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |