org.hdpagination.web.jsf
Class PaginateFacesAction

java.lang.Object
  extended by org.hdpagination.web.jsf.PaginateFacesAction
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public abstract class PaginateFacesAction
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

JSF managed bean for pagination query should extend from this class. The execute method should be binding with the action property of commandLink or commandButton via method-binding expression.

Since:
1.1
Author:
Liangfeng Ren
See Also:
Serialized Form

Constructor Summary
PaginateFacesAction()
           
 
Method Summary
protected  java.lang.Object clone()
          If (1) the scope of search result is other than 'request' (e.g.
 java.lang.String execute()
          Action method binding with the action property of commandLink or commandButton via method-binding expression.
 java.lang.Integer getPageSize()
          How many records should be displayed in one page.
 PaginateDefinition getPaginateDefinition()
          The instance of PaginateDefinition defines configuration properties used in pagination search under JSF environment.
abstract  QueryCallback getQueryCallback()
          Generate a QueryCallback instance based on request parameters which will be executed by the back-end search execute engine.
 void setPageSize(java.lang.Integer pageSize)
          How many records should be displayed in one page.
 void setPaginateDefinition(PaginateDefinition pagDefinition)
          Set the instance of PaginateDefinition which defines configuration properties used in pagination search under JSF environment.
protected  boolean validate(javax.faces.context.FacesContext context)
          For cross field validation (validate based on multiple fields).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PaginateFacesAction

public PaginateFacesAction()
Method Detail

getPageSize

public java.lang.Integer getPageSize()
How many records should be displayed in one page. This property is used to change the page size (number of records per page) from the UI input.

Use value binding expression to associate this property with a UI Component's value in the searching input page. If this property is not associated with any UI Component in the searching input page, the page size defined in PaginateDefinition, the page size defined in GlobalConfig, or the default value (10) will be used.

Returns:
Since:
1.2

setPageSize

public void setPageSize(java.lang.Integer pageSize)
How many records should be displayed in one page. This property is used to change the page size (number of records per page) from the UI input.

Use value binding expression to associate this property with a UI Component's value in the searching input page. If this property is not associated with any UI Component in the searching input page, the page size defined in PaginateDefinition, the page size defined in GlobalConfig, or the default value (10) will be used.

Parameters:
pageSize -
Since:
1.2

getPaginateDefinition

public PaginateDefinition getPaginateDefinition()
The instance of PaginateDefinition defines configuration properties used in pagination search under JSF environment.

Returns:

setPaginateDefinition

public void setPaginateDefinition(PaginateDefinition pagDefinition)
Set the instance of PaginateDefinition which defines configuration properties used in pagination search under JSF environment.

Parameters:
pagDefinition -

getQueryCallback

public abstract QueryCallback getQueryCallback()
Generate a QueryCallback instance based on request parameters which will be executed by the back-end search execute engine.

Returns:

execute

public java.lang.String execute()
Action method binding with the action property of commandLink or commandButton via method-binding expression.

Returns:
Returns the forwardPath property of the associated instance.

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
If (1) the scope of search result is other than 'request' (e.g. 'session' or 'application'); (2) And the method execute in subclass of PaginateFacesAction use anonymous inner class to return QueryCallback instance. (3) subclass of PaginateFacesAction contains attribute with type of user defined class and status of that attribute affects the status of QueryCallback. Then subclass of PaginateFacesAction needs to override clone() method to deep copy the attribute that affects the status QueryCallback. Otherwise, unpredictable behavior will happen when user clicks pagination links if search criteria fields have been changed.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

validate

protected boolean validate(javax.faces.context.FacesContext context)
For cross field validation (validate based on multiple fields). The default implementation performs no validation and returns true. Subclasses must override this method to provide any validation they wish to perform, and add error messages to FacesContext if validation fails.

Parameters:
context -
Returns:
return true if validation passes, otherwise return false


Copyright © 2008 HDPagination All Rights Reserved.