org.loom.tags.paged
Class AbstractPagedContainerTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by org.loom.tags.AbstractTag
          extended by org.loom.tags.paged.AbstractPagedContainerTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag, LoomTag, ParameterContainer
Direct Known Subclasses:
PagedListTag, PagedTableTag

public abstract class AbstractPagedContainerTag
extends AbstractTag
implements ParameterContainer

Parent of paged containers (tables or lists)


Field Summary
 
Fields inherited from class org.loom.tags.AbstractTag
expressionLanguageProxy, loomServletRequestFactory, out, repository, request, response
 
Constructor Summary
AbstractPagedContainerTag()
           
 
Method Summary
 ParameterContainer addParameter(java.lang.String name, java.lang.Object value)
          Adds a parameter to the resulting url
 void doTagImpl()
          The method that must be implemented by the child class
 PagedListData<?> getData()
           
 java.lang.String getId()
           
 java.lang.String getIndexName()
           
 java.lang.String getMessagePrefix()
           
 java.lang.String getRowClass()
           
 int getRowIndex()
           
 java.lang.String getRowName()
           
 java.lang.Object getRowObject()
           
 UrlBuilder getUrl()
           
 boolean isAlternateRows()
           
 boolean isIndexInRange(int pageIndex)
           
 boolean isRenderIfEmpty()
           
protected  void printLink(UrlBuilder url, int pageIndex)
           
protected  void printLink(UrlBuilder url, java.lang.String contents, java.lang.String cssClassName, int pageIndex)
          Print a li item
protected  void renderContainer()
          Render the table or list with the data
protected abstract  void renderEmptyContainer()
          Render an empty container
protected abstract  void renderFooter()
          Render the footer of the container component
protected abstract  void renderHeader()
          Render the header of the container component
 void renderLinks(org.loom.tags.paged.AbstractPagedContainerTag.Position position)
          Render the next/previous links
 void renderOverview(org.loom.tags.paged.AbstractPagedContainerTag.Position position)
          Render the overview message
protected abstract  void renderRowEnd()
          Render the end of a row
protected abstract  void renderRowStart()
          Render the start of a new row
 void setAction(java.lang.String action)
          If set, this action will be used to generate the paged links.
 void setAlternateRows(boolean differenciateRows)
           
<T> void
setCollection(java.util.Collection<T> data)
          When set, this attribute will be converted to a single-paged data container.
 void setCssClass(java.lang.String css)
          HTML attribute
 void setData(PagedListData<?> data)
           
 void setEvent(java.lang.String event)
          If set, this event will be used to generate the paged links.
 void setHash(java.lang.String hash)
          If set, the table links will include this hash.
 void setHref(java.lang.String href)
          If set, this link will be used as the paged link.
 void setId(java.lang.String id)
           
 void setIf(boolean ifClause)
          Set to false to skip tag execution.
 void setIndexName(java.lang.String indexName)
           
 void setLinksCount(int linksCount)
           
 void setLinksPosition(java.lang.String position)
          Where to put the links bar.
 void setMapping(java.lang.String mapping)
          The mapping as action.event.
 void setMessagePrefix(java.lang.String messagePrefix)
           
 void setOverviewPosition(java.lang.String position)
          Where to put the overview message.
 void setRenderIfEmpty(boolean renderIfEmpty)
           
 void setRequest(LoomServletRequest request)
           
 void setRowClass(java.lang.String rowCssClass)
           
 void setRowIndex(int rowIndex)
           
 void setRowName(java.lang.String rowName)
           
 void setStyle(java.lang.String style)
           
 java.lang.String withPrefix(java.lang.String paramName)
          if id != null, return the provided parameter name prefixed by ${id.} else return the param name
 
Methods inherited from class org.loom.tags.AbstractTag
createWriterWrapper, doBody, doBufferedBody, doTag, endTag, evaluateExpression, getActionProperty, getAncestorWithClass, getBufferedBody, getExtendedAttributes, getMessagesRepository, getPageContext, getRequest, getResponse, getScopedAttribute, getWriter, initTag, printParentAttributes, removeScopedAttribute, setDynamicAttribute, setExtendedAttribute, setJspContext, setResponse, setScopedAttribute, setWriter
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPagedContainerTag

public AbstractPagedContainerTag()
Method Detail

setRequest

public void setRequest(LoomServletRequest request)
Overrides:
setRequest in class AbstractTag

doTagImpl

public void doTagImpl()
               throws javax.servlet.jsp.JspException,
                      java.io.IOException
Description copied from class: AbstractTag
The method that must be implemented by the child class

Specified by:
doTagImpl in class AbstractTag
Throws:
javax.servlet.jsp.JspException
java.io.IOException

withPrefix

public java.lang.String withPrefix(java.lang.String paramName)
if id != null, return the provided parameter name prefixed by ${id.} else return the param name


renderContainer

protected void renderContainer()
                        throws java.io.IOException,
                               javax.servlet.jsp.JspException
Render the table or list with the data

Throws:
java.io.IOException
javax.servlet.jsp.JspException

renderHeader

protected abstract void renderHeader()
                              throws java.io.IOException,
                                     javax.servlet.jsp.JspException
Render the header of the container component

Throws:
java.io.IOException
javax.servlet.jsp.JspException

renderFooter

protected abstract void renderFooter()
                              throws java.io.IOException,
                                     javax.servlet.jsp.JspException
Render the footer of the container component

Throws:
java.io.IOException
javax.servlet.jsp.JspException

renderRowStart

protected abstract void renderRowStart()
                                throws java.io.IOException,
                                       javax.servlet.jsp.JspException
Render the start of a new row

Throws:
java.io.IOException
javax.servlet.jsp.JspException

renderRowEnd

protected abstract void renderRowEnd()
                              throws java.io.IOException,
                                     javax.servlet.jsp.JspException
Render the end of a row

Throws:
java.io.IOException
javax.servlet.jsp.JspException

renderEmptyContainer

protected abstract void renderEmptyContainer()
                                      throws java.io.IOException,
                                             javax.servlet.jsp.JspException
Render an empty container

Throws:
java.io.IOException
javax.servlet.jsp.JspException

renderOverview

public void renderOverview(org.loom.tags.paged.AbstractPagedContainerTag.Position position)
                    throws java.io.IOException,
                           javax.servlet.jsp.JspException
Render the overview message

Parameters:
position - the position where we are rendering. It will only print the message if overviewPosition is the same as the provided one, or it is set to BOTH
Throws:
java.io.IOException
javax.servlet.jsp.JspException

renderLinks

public void renderLinks(org.loom.tags.paged.AbstractPagedContainerTag.Position position)
                 throws java.io.IOException,
                        javax.servlet.jsp.JspException
Render the next/previous links

Parameters:
position - the position where we are rendering. It will only print the links if linkPosition is the same as the provided one, or it is set to BOTH
Throws:
java.io.IOException
javax.servlet.jsp.JspException

printLink

protected void printLink(UrlBuilder url,
                         int pageIndex)
                  throws java.io.IOException
Throws:
java.io.IOException

printLink

protected void printLink(UrlBuilder url,
                         java.lang.String contents,
                         java.lang.String cssClassName,
                         int pageIndex)
                  throws java.io.IOException
Print a li item

Parameters:
url - the builder that is being reused to generate all links
contents - the contents of the tag
pageIndex - the pageIndex of the tag
Throws:
java.io.IOException

isIndexInRange

public boolean isIndexInRange(int pageIndex)
Returns:
true if the provided page index exists (if it's greater than zero and less than the total number of pages)

setCssClass

@Attribute(name="class")
public void setCssClass(java.lang.String css)
HTML attribute


setAction

@Attribute
public void setAction(java.lang.String action)
If set, this action will be used to generate the paged links. Default to the current action / event pair


setEvent

@Attribute
public void setEvent(java.lang.String event)
If set, this event will be used to generate the paged links. Default to the current action / event pair


setMapping

@Attribute
public void setMapping(java.lang.String mapping)
The mapping as action.event. This method is equivalent to setting action and event separately.


setHref

@Attribute
public void setHref(java.lang.String href)
If set, this link will be used as the paged link. Default to the current action / event pair


addParameter

public ParameterContainer addParameter(java.lang.String name,
                                       java.lang.Object value)
Description copied from interface: ParameterContainer
Adds a parameter to the resulting url

Specified by:
addParameter in interface ParameterContainer
Parameters:
name - the name of the parameter
value - the value of the parameter
Returns:
the same instance of ParameterContainer, to allow nested calls.

getRowName

public java.lang.String getRowName()

setRowName

public void setRowName(java.lang.String rowName)

getRowClass

public java.lang.String getRowClass()

setRowClass

public void setRowClass(java.lang.String rowCssClass)

getUrl

public UrlBuilder getUrl()

getId

public java.lang.String getId()

getData

public PagedListData<?> getData()

getRowIndex

public int getRowIndex()

setId

public void setId(java.lang.String id)

getRowObject

public java.lang.Object getRowObject()

setData

public void setData(PagedListData<?> data)

setCollection

@Attribute
public <T> void setCollection(java.util.Collection<T> data)
When set, this attribute will be converted to a single-paged data container. This is a convenient method when displaying non-paginated collections.


setLinksPosition

@Attribute
public void setLinksPosition(java.lang.String position)
Where to put the links bar. Possible values are top (default), bottom, both and none


setOverviewPosition

@Attribute
public void setOverviewPosition(java.lang.String position)
Where to put the overview message. Possible values are top (default), bottom, both and none


setLinksCount

public void setLinksCount(int linksCount)

setRowIndex

public void setRowIndex(int rowIndex)

isAlternateRows

public boolean isAlternateRows()

setAlternateRows

public void setAlternateRows(boolean differenciateRows)

setHash

@Attribute
public void setHash(java.lang.String hash)
If set, the table links will include this hash.


getIndexName

public java.lang.String getIndexName()

setIndexName

public void setIndexName(java.lang.String indexName)

getMessagePrefix

public java.lang.String getMessagePrefix()

setMessagePrefix

public void setMessagePrefix(java.lang.String messagePrefix)

setRenderIfEmpty

public void setRenderIfEmpty(boolean renderIfEmpty)

isRenderIfEmpty

public boolean isRenderIfEmpty()

setStyle

public void setStyle(java.lang.String style)

setIf

@Attribute
public void setIf(boolean ifClause)
Set to false to skip tag execution.