org.ujac.web.tag
Class PrintTableTag

java.lang.Object
  extended by org.ujac.web.tag.ForeachTag
      extended by org.ujac.web.tag.PrintTableTag
All Implemented Interfaces:
IterationTag, Tag, TemplateContextHolder

public class PrintTableTag
extends ForeachTag

Name: PrintTableTag
Description: A custom tag class for convinient output of tables.

Author:
lauerc

Nested Class Summary
 class PrintTableTag.DummyColumn
          Name: DummyColumn
Description: A class for dummy columns which are added through the insert-column tag.
 
Field Summary
static String ATTRIBUTE_TABLE_CELLS
          Constant for the _TABLE_CELLS attribute.
static String ATTRIBUTE_TABLE_ROW_HEIGHT
          Constant for the _TABLE_ROW_HEIGHT attribute.
static String ATTRIBUTE_TABLE_ROW_STYLE
          Constant for the _TABLE_ROW_STYLE attribute.
static String ATTRIBUTE_TABLE_ROW_TYPE
          Constant for the _TABLE_ROW_TYPE attribute.
static String ATTRIBUTE_TABLE_WIDTH
          Constant for the _TABLE_WIDTH attribute.
static int DIRECTION_AFTER
          Constant for the insert direction 'after'.
static int DIRECTION_BEFORE
          Constant for the insert direction 'before'.
 
Fields inherited from class org.ujac.web.tag.ForeachTag
customFormat, dateFormat, doubleFormat, integerFormat, timeFormat, timestampFormat
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
PrintTableTag()
           
 
Method Summary
 void alterColumn(String name, float width, int hAlign, String title)
          Alters a column at the table.
 void defineColumn(String name, float width, int hAlign, String title, String defaultContents)
          Defines a column for the table.
 int doEndTag()
           
 int doStartTag()
           
protected  Object evalSequenceHolder()
          Evaluates the sequence holder.
 int getBorder()
          Getter method for the the property border.
 int getCellpadding()
          Getter method for the the property cellpadding.
 int getCellspacing()
          Getter method for the the property cellspacing.
protected  int getColumnIndex(String columnName)
          Gets the index of the given column.
protected  Row getCurrentRow()
          Gets the current row.
protected  String getDefaultContent(int idx)
          Gets the default contents for the given column.
 String getHeight()
          Getter method for the the property height.
 String getId()
          Getter method for the the property id.
 int getLevelFilter()
          Getter method for the the property levelFilter.
protected  int getNumColumns()
          Gets the number of columns by row to print.
 Table getTable()
          Getter method for the the property table.
 String getTemplate()
          Getter method for the the property template.
 Column[] getVisibleColumns()
          Gets all visible columns.
 String getWidth()
          Getter method for the the property width.
 float[] getWidths()
          Getter method for the the property widths.
 void insertColumn(String name, float width, int hAlign, String title, String reference, int direction, String defaultContents)
          Inserts a column into the table.
protected  boolean isColumnStylesDefined()
          Tells whether or not the column styles had been defined so far.
 boolean isFooterPrinted()
          Getter method for the the property footerPrinted.
 boolean isHeaderPrinted()
          Getter method for the the property headerPrinted.
 boolean isOutputStarted()
          Checks whether the table output has been started or not.
 void release()
           
 void removeColumn(String name)
          Removes a column from the table.
 void setBorder(int border)
          Setter method for the the property border.
 void setCellpadding(int cellpadding)
          Setter method for the the property cellpadding.
 void setCellspacing(int cellspacing)
          Setter method for the the property cellspacing.
protected  void setColumnAttributes(Column column, List columnAttributes)
          Sets the column styles.
 void setFooterPrinted(boolean footerPrinted)
          Setter method for the the property footerPrinted.
 void setHeaderPrinted(boolean headerPrinted)
          Setter method for the the property headerPrinted.
 void setHeight(String height)
          Setter method for the the property height.
 void setId(String id)
          Setter method for the the property id.
 void setLevelFilter(int levelFilter)
          Setter method for the the property levelFilter.
 void setTemplate(String template)
          Setter method for the the property template.
 void setWidth(String width)
          Setter method for the the property width.
 
Methods inherited from class org.ujac.web.tag.ForeachTag
doAfterBody, evalTemplate, getAttribute, getCurrentValue, getEvenStyle, getIterationIdx, getLoopVariable, getOddStyle, getPageContext, getParent, getSequence, getSequenceHolder, getSequenceIterator, getTemplateContext, getTemplateInterpreter, isEvenIteration, setAttribute, setDateFormat, setDoubleFormat, setEvenStyle, setIntegerFormat, setLoopVariable, setOddStyle, setPageContext, setParent, setSequence, setTimeFormat, setTimestampFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTION_BEFORE

public static final int DIRECTION_BEFORE
Constant for the insert direction 'before'.

See Also:
Constant Field Values

DIRECTION_AFTER

public static final int DIRECTION_AFTER
Constant for the insert direction 'after'.

See Also:
Constant Field Values

ATTRIBUTE_TABLE_ROW_STYLE

public static final String ATTRIBUTE_TABLE_ROW_STYLE
Constant for the _TABLE_ROW_STYLE attribute.

See Also:
Constant Field Values

ATTRIBUTE_TABLE_ROW_TYPE

public static final String ATTRIBUTE_TABLE_ROW_TYPE
Constant for the _TABLE_ROW_TYPE attribute.

See Also:
Constant Field Values

ATTRIBUTE_TABLE_ROW_HEIGHT

public static final String ATTRIBUTE_TABLE_ROW_HEIGHT
Constant for the _TABLE_ROW_HEIGHT attribute.

See Also:
Constant Field Values

ATTRIBUTE_TABLE_CELLS

public static final String ATTRIBUTE_TABLE_CELLS
Constant for the _TABLE_CELLS attribute.

See Also:
Constant Field Values

ATTRIBUTE_TABLE_WIDTH

public static final String ATTRIBUTE_TABLE_WIDTH
Constant for the _TABLE_WIDTH attribute.

See Also:
Constant Field Values
Constructor Detail

PrintTableTag

public PrintTableTag()
Method Detail

getBorder

public int getBorder()
Getter method for the the property border.

Returns:
The current value of property border.

setBorder

public void setBorder(int border)
Setter method for the the property border.

Parameters:
border - The value to set for the property border.

getId

public String getId()
Getter method for the the property id.

Returns:
The current value of property id.

setId

public void setId(String id)
Setter method for the the property id.

Parameters:
id - The value to set for the property id.

getWidth

public String getWidth()
Getter method for the the property width.

Returns:
The current value of property width.

setWidth

public void setWidth(String width)
Setter method for the the property width.

Parameters:
width - The value to set for the property width.

getHeight

public String getHeight()
Getter method for the the property height.

Returns:
The current value of property height.

setHeight

public void setHeight(String height)
Setter method for the the property height.

Parameters:
height - The value to set for the property height.

getCellpadding

public int getCellpadding()
Getter method for the the property cellpadding.

Returns:
The current value of property cellpadding.

setCellpadding

public void setCellpadding(int cellpadding)
Setter method for the the property cellpadding.

Parameters:
cellpadding - The value to set for the property cellpadding.

getCellspacing

public int getCellspacing()
Getter method for the the property cellspacing.

Returns:
The current value of property cellspacing.

setCellspacing

public void setCellspacing(int cellspacing)
Setter method for the the property cellspacing.

Parameters:
cellspacing - The value to set for the property cellspacing.

getLevelFilter

public int getLevelFilter()
Getter method for the the property levelFilter.

Returns:
The current value of property levelFilter.

setLevelFilter

public void setLevelFilter(int levelFilter)
Setter method for the the property levelFilter.

Parameters:
levelFilter - The value to set for the property levelFilter.

getTemplate

public String getTemplate()
Getter method for the the property template.

Returns:
The current value of the property template.

setTemplate

public void setTemplate(String template)
Setter method for the the property template.

Parameters:
template - The value to set for the property template.

isHeaderPrinted

public boolean isHeaderPrinted()
Getter method for the the property headerPrinted.

Returns:
The current value of property headerPrinted.

setHeaderPrinted

public void setHeaderPrinted(boolean headerPrinted)
Setter method for the the property headerPrinted.

Parameters:
headerPrinted - The value to set for the property headerPrinted.

isFooterPrinted

public boolean isFooterPrinted()
Getter method for the the property footerPrinted.

Returns:
The current value of property footerPrinted.

setFooterPrinted

public void setFooterPrinted(boolean footerPrinted)
Setter method for the the property footerPrinted.

Parameters:
footerPrinted - The value to set for the property footerPrinted.

getVisibleColumns

public Column[] getVisibleColumns()
Gets all visible columns.

Returns:
An array holding all visible columns.

getNumColumns

protected int getNumColumns()
Gets the number of columns by row to print.

Returns:
The number of columns by row.

getColumnIndex

protected int getColumnIndex(String columnName)
Gets the index of the given column.

Parameters:
columnName - The name of the column to get the index for.
Returns:
The index of the column.

getDefaultContent

protected String getDefaultContent(int idx)
Gets the default contents for the given column.

Parameters:
idx - The index of the column to get the default contents for.
Returns:
The index of the column.

isOutputStarted

public boolean isOutputStarted()
Checks whether the table output has been started or not.

Returns:
true if the table output has been started, else false.

getTable

public Table getTable()
Getter method for the the property table.

Returns:
The current value of property table.

getWidths

public float[] getWidths()
Getter method for the the property widths.

Returns:
The current value of property widths.

getCurrentRow

protected Row getCurrentRow()
Gets the current row.

Returns:
The current row.

evalSequenceHolder

protected Object evalSequenceHolder()
                             throws UjacException
Evaluates the sequence holder.

Overrides:
evalSequenceHolder in class ForeachTag
Returns:
The sequence holder.
Throws:
UjacException - In case the evaluation failed.

doStartTag

public int doStartTag()
               throws JspException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class ForeachTag
Throws:
JspException
See Also:
Tag.doStartTag()

doEndTag

public int doEndTag()
             throws JspException
Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class ForeachTag
Throws:
JspException
See Also:
Tag.doEndTag()

release

public void release()
Specified by:
release in interface Tag
Overrides:
release in class ForeachTag
See Also:
Tag.release()

defineColumn

public void defineColumn(String name,
                         float width,
                         int hAlign,
                         String title,
                         String defaultContents)
                  throws JspException
Defines a column for the table.

Parameters:
name - The name of the column.
width - The width of the column.
hAlign - The horizontal alignment of the column.
title - The title of the column.
defaultContents - The default contents to use for this column.
Throws:
JspException - In case the given reference column does not exist.

insertColumn

public void insertColumn(String name,
                         float width,
                         int hAlign,
                         String title,
                         String reference,
                         int direction,
                         String defaultContents)
                  throws JspException
Inserts a column into the table.

Parameters:
name - The name of the new column.
width - The width of the new column.
hAlign - The horizontal alignment of the new column.
title - The title of the column.
reference - The column at which to insert the new column.
direction - The insert direction. In case null was given as reference, DIRECTION_BEFORE inserts before the first colummn, DIRECTION_AFTER appends behind the last column.
defaultContents - The default contents to use for this column.
Throws:
JspException - In case the given reference column does not exist.
See Also:
DIRECTION_BEFORE, DIRECTION_AFTER

alterColumn

public void alterColumn(String name,
                        float width,
                        int hAlign,
                        String title)
                 throws JspException
Alters a column at the table.

Parameters:
name - The name of the new column.
width - The width of the new column.
hAlign - The horizontal alignment of the new column.
title - The title of the column.
Throws:
JspException - In case the given reference column does not exist.

removeColumn

public void removeColumn(String name)
                  throws JspException
Removes a column from the table.

Parameters:
name - The name of the new column.
Throws:
JspException - In case the given column does not exist.

isColumnStylesDefined

protected boolean isColumnStylesDefined()
Tells whether or not the column styles had been defined so far.

Returns:
true in case the column styles had been defined so far, else false.

setColumnAttributes

protected void setColumnAttributes(Column column,
                                   List columnAttributes)
Sets the column styles.

Parameters:
column - The column.
columnAttributes - The column attribute list.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.