|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.commons.scaffold.util.Scroller
Scroller tracks the coordinates needed to manage flipping through a result list using LIMIT and OFFSET clauses (or the equivalent). Scrolls through entries using a range (10 to 20 of 50) but does not support paging per se goto page 3 (or entry 30)), though that would be an easy enhancement.
| Field Summary | |
protected int |
count
The maximum number of entries available (the SQL count). |
protected int |
entries
The actual number of entries to fetch (eg length or limit). |
protected int |
from
The starting point for the current query [FROM]. |
static int |
FROM
The default starting point [1]. |
protected int |
limit
The maximum number of entries to fetch at a time [Integer.MAX_VALUE]. |
protected int |
next
The starting point to use with a "forward" query. |
protected java.util.Map |
parameters
Field for the parameters property [java.util.HashMap]. |
protected int |
prev
The starting point to use for a "backward" query. |
static int |
SCROLL_ROWS
The maximum to return with a scrolling list. |
protected int |
thru
The ending point for the current query [1]. |
| Constructor Summary | |
Scroller()
|
|
Scroller(int entries,
int from,
int limit,
int count)
|
|
| Method Summary | |
void |
calculate()
Calculate the new property values using a bean that has already had count and limit set. |
void |
calculate(int entries)
Calculate the new property values using a bean that has already had count and limit set. |
void |
calculate(int entries,
int from,
int count,
int limit)
Calculate the new property values. |
int |
getCount()
Return count. |
int |
getEntries()
Return entries. |
int |
getFrom()
Return from. |
java.lang.String |
getHiddenFields()
Return parameters as a series of hidden HTML fields. |
int |
getLimit()
Return limit. |
int |
getNext()
Return next. |
int |
getOffset()
The database offset for the current query [0]. |
int |
getOffsetForPage(int page)
Return first entry for given page. |
int |
getPage()
Return current page number |
int |
getPage(int thru)
Return page number for given entry. |
int |
getPages()
Return number of pages. |
java.util.Map |
getParameters()
Return parameters. |
int |
getPrev()
Return prev. |
java.lang.String |
getQueryString(java.lang.String uri)
Return parameters as a query string for use with a URI. |
int |
getThru()
Return thru. |
boolean |
isParameters()
Set a parameter |
void |
putParameter(java.lang.String key,
java.lang.String value)
Set a parameter |
void |
setCount(int count)
Set count |
void |
setEntries(int entries)
Set entries |
void |
setFrom(int from)
Set from. |
void |
setLimit(int limit)
Set limit. |
void |
setNext(int next)
Set next. |
void |
setParameters(java.util.Map parameters)
Set parameters |
void |
setPrev(int prev)
Set prev. |
void |
setThru(int thru)
Set thru. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int SCROLL_ROWS
public static int FROM
protected int from
protected int thru
protected int prev
protected int next
protected int limit
protected int entries
protected int count
protected java.util.Map parameters
| Constructor Detail |
public Scroller(int entries,
int from,
int limit,
int count)
public Scroller()
| Method Detail |
public void setFrom(int from)
from - The new from value.public int getFrom()
public void setThru(int thru)
thru - The new thru value.public int getThru()
public void setPrev(int prev)
prev - The new prev value.public int getPrev()
public void setNext(int next)
next - The new next value.public int getNext()
public void setLimit(int limit)
limit - The new limit value.public int getLimit()
public void setEntries(int entries)
entries - The new entries value.public int getEntries()
public void setCount(int count)
count - The new count value.public int getCount()
public void setParameters(java.util.Map parameters)
parameters - The new parameters value.public java.util.Map getParameters()
public void putParameter(java.lang.String key,
java.lang.String value)
key - The parameter namevalue - The parameter valuepublic boolean isParameters()
public java.lang.String getQueryString(java.lang.String uri)
public java.lang.String getHiddenFields()
public int getOffset()
public int getPage(int thru)
public int getPage()
public int getPages()
public int getOffsetForPage(int page)
public void calculate()
public void calculate(int entries)
public void calculate(int entries,
int from,
int count,
int limit)
entries - The number of matches in this setfrom - The first absolute row in this setcount - How many rows in the complete setlimit - The maximum rows in a subset page
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||