org.hdpagination.web.jsf.tag
Class PaginateLinkTag

java.lang.Object
  extended by javax.faces.webapp.UIComponentTagBase
      extended by javax.faces.webapp.UIComponentClassicTagBase
          extended by javax.faces.webapp.UIComponentTag
              extended by org.hdpagination.web.jsf.tag.AbstractBaseTag
                  extended by org.hdpagination.web.jsf.tag.PaginateLinkTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspIdConsumer, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class PaginateLinkTag
extends AbstractBaseTag

This JSF Tag is to render pagination navigation links (e.g. Previous Next 1 2 3 4 5 6 7 8 First Last). The layout of the links is configurable via injecting different implementation instance of PageLinksPattern interface into GlobalConfig. There are some pattern implementation classes available to choose in package org.hdpagination.config.pattern

Since:
1.1
Author:
Liangfeng Ren

Field Summary
 
Fields inherited from class javax.faces.webapp.UIComponentClassicTagBase
bodyContent, pageContext, UNIQUE_ID_PREFIX
 
Fields inherited from class javax.faces.webapp.UIComponentTagBase
log
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Constructor Summary
PaginateLinkTag()
           
 
Method Summary
 java.lang.String getComponentType()
           
 java.lang.String getRendererType()
           
 void setFirstResultVar(java.lang.String firstResultVar)
          Name of variable in request scope containing index (starting from 1) of the first record in the current page.
 void setIsPaginatedVar(java.lang.String isPaginatedVar)
          Name of variable in request scope containing flag (Boolean) indicating if pagination is required.
 void setLastResultVar(java.lang.String lastResultVar)
          Name of variable in request scope containing index (starting from 1) of the last record in the current page.
 void setPageIndexVar(java.lang.String pageIndexVar)
          Name of variable in request scope containing index (starting from 1) of current page.
 void setPagesVar(java.lang.String pagesVar)
          Name of variable in request scope containing number of pages.
 void setProperties(javax.faces.component.UIComponent component)
           
 void setRecordsVar(java.lang.String recordsVar)
          Name of variable in request scope containing number of total records.
 
Methods inherited from class org.hdpagination.web.jsf.tag.AbstractBaseTag
setAccesskey, setPagiDefinitionId, setStyle, setStyleClass, setTabindex, setTitle
 
Methods inherited from class javax.faces.webapp.UIComponentTag
createComponent, getParentUIComponentTag, hasBinding, isSuppressed, isValueReference, release, setBinding, setRendered
 
Methods inherited from class javax.faces.webapp.UIComponentClassicTagBase
addChild, addFacet, addVerbatimAfterComponent, addVerbatimBeforeComponent, createVerbatimComponent, createVerbatimComponentFromBodyContent, doAfterBody, doEndTag, doInitBody, doStartTag, encodeBegin, encodeChildren, encodeEnd, findComponent, getBodyContent, getComponentInstance, getCreated, getCreatedComponents, getDoAfterBodyValue, getDoEndValue, getDoStartValue, getFacesContext, getFacesJspId, getFacetName, getId, getIndexOfNextChildTag, getJspId, getParent, getParentUIComponentClassicTagBase, getPreviousOut, setBodyContent, setId, setJspId, setPageContext, setParent, setupResponseWriter
 
Methods inherited from class javax.faces.webapp.UIComponentTagBase
getELContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
doEndTag, doStartTag, getParent, setPageContext, setParent
 

Constructor Detail

PaginateLinkTag

public PaginateLinkTag()
Method Detail

getRendererType

public java.lang.String getRendererType()
Specified by:
getRendererType in class javax.faces.webapp.UIComponentTagBase

getComponentType

public java.lang.String getComponentType()
Specified by:
getComponentType in class javax.faces.webapp.UIComponentTagBase

setPageIndexVar

public void setPageIndexVar(java.lang.String pageIndexVar)
Name of variable in request scope containing index (starting from 1) of current page. You can use this variable to print out the current page number.

For example, if this property value is specified as "_pageIndex" then you can use the following snippet to display the current page number:

<h:outputText value="#{_pageIndex}" />

Parameters:
pageIndexVar -

setPagesVar

public void setPagesVar(java.lang.String pagesVar)
Name of variable in request scope containing number of pages. You can use this variable to print out the count of pages for the current search result.

For example, if this property value is specified as "_pages" then you can use the following snippet to display the count of pages:

<h:outputText value="#{_pages}" />

Parameters:
pagesVar -

setRecordsVar

public void setRecordsVar(java.lang.String recordsVar)
Name of variable in request scope containing number of total records. You can use this variable to print out the count of total records for the current search result.

For example, if this property value is specified as "_records" then you can use the following snippet to display the count of total records:

<h:outputText value="#{_records}" />

Parameters:
recordsVar -

setFirstResultVar

public void setFirstResultVar(java.lang.String firstResultVar)
Name of variable in request scope containing index (starting from 1) of the first record in the current page.

Taking an example with following assumptions:

  1) the page size is defined to 10

  2) currently in the 3rd page

  3) this property value is specified as "_firstResult"

The following snippet

      <h:outputText value="#{_firstResult}" />

will display 20

Parameters:
firstResultVar -

setLastResultVar

public void setLastResultVar(java.lang.String lastResultVar)
Name of variable in request scope containing index (starting from 1) of the last record in the current page.

Taking an example with following assumptions:

  1) the page size is defined to 10

  2) currently in the 3rd page

  3) this property value is specified as "_lastResult"

The following snippet

      <h:outputText value="#{_lastResult}" />

will display

   (a) 30 -- if current page is not the last page

   (b) index of the last record -- if current page is not the last page (e.g, it will display 25 if there are 25 records totally in the search results).

Parameters:
lastResultVar -

setIsPaginatedVar

public void setIsPaginatedVar(java.lang.String isPaginatedVar)
Name of variable in request scope containing flag (Boolean) indicating if pagination is required. You can use this variable to determine whether other pagination related information should be rendered or not.

For example, if this property value is specified as "_isPaginated" then you can use the following snippet to display the pagination information:

     <h:panelGroup rendered="#{_isPaginated}">

       <h:outputText value="Page "/>

       <h:outputText value="#{_pageIndex}" />

       <h:outputText value=" of "/>

       <h:outputText value="#{_pages}" />

       ....

     </h:panelGroup>

Parameters:
isPaginatedVar -

setProperties

public void setProperties(javax.faces.component.UIComponent component)
Overrides:
setProperties in class AbstractBaseTag


Copyright © 2008 HDPagination All Rights Reserved.