org.rhq.core.domain.util
Class PageControl

java.lang.Object
  extended by org.rhq.core.domain.util.PageControl
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
UnlimitedPageControl

public class PageControl
extends Object
implements Serializable, Cloneable

Used to pass information on pagination and sorting to data lookup methods. PersistenceUtility provides several methods that can be called to apply PageControls to various types of queries.

See Also:
Serialized Form

Field Summary
static int SIZE_MAX
           
static int SIZE_UNLIMITED
           
 
Constructor Summary
PageControl()
           
PageControl(int pageNumber, int pageSize)
           
PageControl(int pageNumber, int pageSize, OrderingField... orderingFields)
           
 
Method Summary
 void addDefaultOrderingField(String defaultField)
           
 void addDefaultOrderingField(String defaultField, PageOrdering defaultPageOrdering)
           
 Object clone()
           
 boolean equals(Object o)
           
static PageControl getExplicitPageControl(int firstRecord, int recordCount)
           
 Integer getFirstRecord()
           
 List<OrderingField> getOrderingFields()
           
 OrderingField[] getOrderingFieldsAsArray()
           
 int getPageNumber()
           
 int getPageSize()
           
 String getPrimarySortColumn()
           
 PageOrdering getPrimarySortOrder()
           
static PageControl getSingleRowInstance()
           
 int getStartRow()
          Get the index of the first item on the page as dictated by the page size and page number.
static PageControl getUnlimitedInstance()
           
 int hashCode()
           
 void initDefaultOrderingField(String defaultField)
           
 void initDefaultOrderingField(String defaultField, PageOrdering defaultPageOrdering)
           
 void removeOrderingField(String doomedField)
           
 void reset()
           
 void setFirstRecord(Integer firstRecord)
           
 void setPageNumber(int pageNumber)
           
 void setPageSize(int pageSize)
           
 void setPrimarySort(String sortColumn, PageOrdering sortOrder)
           
 void setPrimarySortOrder(PageOrdering sortOrder)
           
 void sortBy(String sortField)
           
 String toString()
           
 void truncateOrderingFields(int keepFieldCount)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE_UNLIMITED

public static final int SIZE_UNLIMITED
See Also:
Constant Field Values

SIZE_MAX

public static final int SIZE_MAX
See Also:
Constant Field Values
Constructor Detail

PageControl

public PageControl()

PageControl

public PageControl(int pageNumber,
                   int pageSize)

PageControl

public PageControl(int pageNumber,
                   int pageSize,
                   OrderingField... orderingFields)
Method Detail

getExplicitPageControl

public static PageControl getExplicitPageControl(int firstRecord,
                                                 int recordCount)

getUnlimitedInstance

public static PageControl getUnlimitedInstance()

getSingleRowInstance

public static PageControl getSingleRowInstance()

initDefaultOrderingField

public void initDefaultOrderingField(String defaultField)

addDefaultOrderingField

public void addDefaultOrderingField(String defaultField)

initDefaultOrderingField

public void initDefaultOrderingField(String defaultField,
                                     PageOrdering defaultPageOrdering)

addDefaultOrderingField

public void addDefaultOrderingField(String defaultField,
                                    PageOrdering defaultPageOrdering)

getPageNumber

public int getPageNumber()
Returns:
The current page number (0-based)

setPageNumber

public void setPageNumber(int pageNumber)

getPageSize

public int getPageSize()

setPageSize

public void setPageSize(int pageSize)

getFirstRecord

public Integer getFirstRecord()

setFirstRecord

public void setFirstRecord(Integer firstRecord)

getPrimarySortOrder

public PageOrdering getPrimarySortOrder()

setPrimarySortOrder

public void setPrimarySortOrder(PageOrdering sortOrder)

getPrimarySortColumn

public String getPrimarySortColumn()

setPrimarySort

public void setPrimarySort(String sortColumn,
                           PageOrdering sortOrder)

getOrderingFieldsAsArray

public OrderingField[] getOrderingFieldsAsArray()

getOrderingFields

public List<OrderingField> getOrderingFields()

truncateOrderingFields

public void truncateOrderingFields(int keepFieldCount)

removeOrderingField

public void removeOrderingField(String doomedField)

sortBy

public void sortBy(String sortField)

getStartRow

public int getStartRow()
Get the index of the first item on the page as dictated by the page size and page number.

Returns:
the index of the starting row for the page

reset

public void reset()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
Overrides:
clone in class Object


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.