org.apache.beehive.netui.databinding.datagrid.api.rendering
Class PagerRenderer

Object
  extended by PagerRenderer
Direct Known Subclasses:
FirstPreviousNextLastPagerRenderer, PreviousNextPagerRenderer

public abstract class PagerRenderer
extends Object

This is the base class for data grid pager renderers. Subclasses can be used by the data grid to render custom pager markup overriding one or both of the internalRender() and noDataRender() methods. Additional methods are implemented here as a convenience and may be overriden by subclasses needing to change their behavior.


Constructor Summary
PagerRenderer()
           
 
Method Summary
protected  void buildAnchor(AbstractRenderAppender appender, Map queryParams, String labelKey)
          Build the anchor
protected  String buildDeadFirstLink()
          Build literal text for the string displayed when there is no first page for the data set.
protected  String buildDeadLastLink()
          Build literal text for the string displayed when there is no last page for the data set.
protected  String buildDeadNextLink()
          Build literal text for the string displayed when there is no next page for the data set.
protected  String buildDeadPreviousLink()
          Build literal text for the string displayed when there is no previous page for the data set.
protected  String buildLiveFirstLink()
          Build an HTML anchor that contains URL state for navigating to the first page of a data set.
protected  String buildLiveLastLink()
          Build an HTML anchor that contains URL state for navigating to the last page of a data set.
protected  String buildLiveNextPageLink()
          Build an HTML anchor that contains URL state for navigating to the next page of a data set.
protected  String buildLivePreviousLink()
          Build an HTML anchor that contains URL state for navigating to the previous page of a data set.
protected  String buildPageUri(Map queryParams)
           
protected  DataGridTagModel getDataGridTagModel()
          Get the DataGridTagModel to which this pager is associated.
protected  PagerModel getPagerModel()
          Get the PagerModel that contains the current pager state.
protected  String internalRender()
          Render the pager.
protected  String noDataRender()
          Render the pager.
 String render()
           This method should be called when the pager is to be rendered.
 void setDataGridTagModel(DataGridTagModel dataGridTagModel)
           Set the DataGridTagModel with which this pager renderer instance is associated.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagerRenderer

public PagerRenderer()
Method Detail

setDataGridTagModel

public void setDataGridTagModel(DataGridTagModel dataGridTagModel)

Set the DataGridTagModel with which this pager renderer instance is associated. Pager renderer instances should not be shared between data grids without setting a DataGridTagModel for each data grid.

Parameters:
dataGridTagModel - the DataGridTagModel

render

public String render()

This method should be called when the pager is to be rendered. The result will be the String that represents the result of rendering.

If there is no data in the data set, the method noDataRender() will be invoked. Otherwise, the internalRender() method will be called.

Returns:
a string containing markup rendered by the pager

getPagerModel

protected PagerModel getPagerModel()
Get the PagerModel that contains the current pager state.

Returns:
the PagerModel

getDataGridTagModel

protected DataGridTagModel getDataGridTagModel()
Get the DataGridTagModel to which this pager is associated.

Returns:
the DataGridTagModel

internalRender

protected String internalRender()
Render the pager. This method is invoked when there is data available in the data set.

Returns:
a string containing markup rendered by the pager

noDataRender

protected String noDataRender()
Render the pager. This method is invoked when there is no data available in the data set.

Returns:
a string containing markup rendered by the pager

buildLiveFirstLink

protected String buildLiveFirstLink()
Build an HTML anchor that contains URL state for navigating to the first page of a data set.

Returns:
the HTML markup for anchor to the first page

buildDeadFirstLink

protected String buildDeadFirstLink()
Build literal text for the string displayed when there is no first page for the data set. This text is generally used when the PagerModel is already on the first page. By default, this text is obtained using the IDataGridMessageKeys.PAGER_MSG_FIRST message key.

Returns:
the text for the first page link

buildLivePreviousLink

protected String buildLivePreviousLink()
Build an HTML anchor that contains URL state for navigating to the previous page of a data set. The previous page is calculated relative to the current location in the PagerModel

Returns:
the HTML markup for anchor to the previous page

buildDeadPreviousLink

protected String buildDeadPreviousLink()
Build literal text for the string displayed when there is no previous page for the data set. This text is generally used when the PagerModel is on the first page. By default, this text is obtained using the IDataGridMessageKeys.PAGER_MSG_PREVIOUS message key.

Returns:
the text for the previous page link

buildLiveNextPageLink

protected String buildLiveNextPageLink()
Build an HTML anchor that contains URL state for navigating to the next page of a data set. The next page is calculated relative to the current location in the PagerModel

Returns:
the HTML markup for anchor to the next page

buildDeadNextLink

protected String buildDeadNextLink()
Build literal text for the string displayed when there is no next page for the data set. This text is generally used when the PagerModel is on the last page. By default, this text is obtained using the IDataGridMessageKeys.PAGER_MSG_NEXT message key.

Returns:
the text for the next page link

buildLiveLastLink

protected String buildLiveLastLink()
Build an HTML anchor that contains URL state for navigating to the last page of a data set.

Returns:
the HTML markup for anchor to the last page

buildDeadLastLink

protected String buildDeadLastLink()
Build literal text for the string displayed when there is no last page for the data set. This text is generally used when the PagerModel is on the last page. By default, this text is obtained using the IDataGridMessageKeys.PAGER_MSG_LAST message key.

Returns:
the text for the last page link

buildAnchor

protected final void buildAnchor(AbstractRenderAppender appender,
                                 Map queryParams,
                                 String labelKey)
Build the anchor

Parameters:
appender -
queryParams -
labelKey -

buildPageUri

protected String buildPageUri(Map queryParams)