echopointng.table
Class DefaultLiveTableRenderer

java.lang.Object
  extended by echopointng.table.DefaultLiveTableRenderer
All Implemented Interfaces:
LiveTableRenderer

public class DefaultLiveTableRenderer
extends java.lang.Object
implements LiveTableRenderer

DefaultLiveTableRenderer is a default implementation for rendering the rows in LiveTable.

This class uses the folllowing styles names when rendering the styles for the LiveTable data. The names are intentionally kept short to minmise the traffic between the server and client.

A tr.sNNNN CSS rule and a tr.seNNNN CSS rule is generated for rows of table data and the empty row of table data.

A td.sNNNN CSS rule and a td.seNNNN CSS rule is generated for each cell within a row of data.

A td.srNNNN CSS rule is generated to perform rollovers.

A td.ssNNNN CSS rule is generated to perform selection.

See Also:
LiveTableRenderer

Field Summary
protected static java.lang.String NBSP
          This contains the entityt numeric value for  
 
Constructor Summary
DefaultLiveTableRenderer()
           
 
Method Summary
 void renderEmptyRow(LiveTable liveTable, org.w3c.dom.Node parentNode)
          This method is called to get the XHTML for an empty row with the LiveTable.
 java.lang.String renderRolloverStyle(LiveTable liveTable, org.w3c.dom.Node parentNode, RenderContext rc)
          This method will be called if rollover's are enabled on the LiveTable.
protected  void renderRowCell(LiveTable liveTable, org.w3c.dom.Element parentTD, int column, int row)
          This method is called to render a cell within a given row.
 void renderRows(LiveTable liveTable, org.w3c.dom.Node parentNode, int rowStart, int rowEnd)
          This method is called to render the XHTML for the data starting from rowStart and ending at rowEnd.
 java.lang.String renderSelectionStyle(LiveTable liveTable, org.w3c.dom.Node parentNode, RenderContext rc)
          This method will be called if selection is enabled on the LiveTable.
 void renderStyles(LiveTable liveTable, org.w3c.dom.Node parentNode)
          This method is called to render a series of XTHML Style Elements (eg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NBSP

protected static java.lang.String NBSP
This contains the entityt numeric value for  

Constructor Detail

DefaultLiveTableRenderer

public DefaultLiveTableRenderer()
Method Detail

renderEmptyRow

public void renderEmptyRow(LiveTable liveTable,
                           org.w3c.dom.Node parentNode)
Description copied from interface: LiveTableRenderer
This method is called to get the XHTML for an empty row with the LiveTable. When a LiveTable row has not been loaded with data, then an empty row is shown.

This XHTML is a TR tag representing an empty row.

Each row must be the same height as all the other rows otherwise the LiveTable scrolling algorithm wont work.

You should use the styleNames returned in the getStyles() method on rows cells to ensure the least amount of data is sent down the client and hence UI feedback is faster.

Specified by:
renderEmptyRow in interface LiveTableRenderer
Parameters:
liveTable - - the LiveTable in question
parentNode - - the parentNode to place the XHTML in
See Also:
LiveTableRenderer.renderEmptyRow(echopointng.LiveTable, org.w3c.dom.Node)

renderRows

public void renderRows(LiveTable liveTable,
                       org.w3c.dom.Node parentNode,
                       int rowStart,
                       int rowEnd)
Description copied from interface: LiveTableRenderer
This method is called to render the XHTML for the data starting from rowStart and ending at rowEnd.

This XHTML is a series of TR tags for the given data.

Each row must be the same height as all the other rows otherwise the LiveTable scrolling algorithm wont work.

You should use the styleNames returned in the getStyles() method on rows cells to ensure the least amount of data is sent down the client and hence UI feedback is faster.

Specified by:
renderRows in interface LiveTableRenderer
Parameters:
liveTable - - the LiveTable in question
parentNode - - the parentNode to place the XHTML in
rowStart - - the starting row of data
rowEnd - - the ending row of data

renderRowCell

protected void renderRowCell(LiveTable liveTable,
                             org.w3c.dom.Element parentTD,
                             int column,
                             int row)
This method is called to render a cell within a given row. You can override this method to provide more customised output than the DefaultLiveTableRenderer, which simply gets the String.valueOf() the TableModel value.

One thing you could possibly do is put <a> tags into the output, which would allow the user to click on some given row data. You can use a construct like this to raise action events back on the LiveTable.

                <a href="javascript:EPLiveTable.href('c_1234','actionValue')">Click Me To Raise An ActionEvent</a>        
 

Parameters:
liveTable - - the LiveTable in question
parentTD - - the parent TD element to place the XHTML in
column - - the current column
row - - the current row

renderStyles

public void renderStyles(LiveTable liveTable,
                         org.w3c.dom.Node parentNode)
Description copied from interface: LiveTableRenderer
This method is called to render a series of XTHML Style Elements (eg. <style>xxx</style>) that can be used to "style" the rows of data in the LiveTable. This allows each row of XHTML to only contain "class=stylename" entries and hence save on the amount of data that is sent to the client.

The style names should perhaps use the renderId() of the LiveTable to ensure that they are unique.

Specified by:
renderStyles in interface LiveTableRenderer
Parameters:
liveTable - - the LiveTable in question
parentNode - - the parentNode to place the XHTML in
See Also:
LiveTableRenderer.renderStyles(echopointng.LiveTable, org.w3c.dom.Node)

renderRolloverStyle

public java.lang.String renderRolloverStyle(LiveTable liveTable,
                                            org.w3c.dom.Node parentNode,
                                            RenderContext rc)
Description copied from interface: LiveTableRenderer
This method will be called if rollover's are enabled on the LiveTable.

Th implementor should render a rollover style for a cell inside row data (eg a TD) and then return the style className that will be applied to the cell when the mouse moves over the cells in a row of data.

The rollover style properties should be based on the LiveTable rollover related properties.

Specified by:
renderRolloverStyle in interface LiveTableRenderer
Parameters:
liveTable - - the LiveTable in question
parentNode - - the parentNode to place the XHTML in
rc - - the RenderContext in place at the time this call is made
Returns:
the name of the rollover style to be placed in the cell className
See Also:
LiveTableRenderer.renderRolloverStyle(LiveTable, Node, RenderContext)

renderSelectionStyle

public java.lang.String renderSelectionStyle(LiveTable liveTable,
                                             org.w3c.dom.Node parentNode,
                                             RenderContext rc)
Description copied from interface: LiveTableRenderer
This method will be called if selection is enabled on the LiveTable.

Th implementor should render a selection style for a cell inside row data (eg a TD) and then return the style className that will be applied to the cell when the selection is made on a row of data. .

The selection style properties should be based on the LiveTable selection related properties.

Specified by:
renderSelectionStyle in interface LiveTableRenderer
Parameters:
liveTable - - the LiveTable in question
parentNode - - the parentNode to place the XHTML in
rc - - the RenderContext in place at the time this call is made
Returns:
the name of the selection style to be placed in the cell className
See Also:
LiveTableRenderer.renderSelectionStyle(LiveTable, Node, RenderContext)