|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bowstreet.builders.webapp.methods.PagingAssistant
public class PagingAssistant
Linked Java Object to aid paged access to tabular data. Created by the Paging Assistant builder.
Note: if you have model actions or custom LJO code that calls one or more of the methods defined below, then you
need to call the setWebAppAccess
method first with the non-null WebAppAccess
instance
for the current request. This will ensure that the Paging Assistant methods you are calling have access to the
current webApp instance of your model. You only need to call setWebAppAccess
once per request; you
may call it multiple times per request with the same WebAppAccess
instance, but it must be done
at least once, typically from an action or LJO code that is executed before any calls are made the methods below.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_COLUMN_TAG
|
static java.lang.String |
DEFAULT_ROW_TAG
|
static java.lang.String |
DEFAULT_TOP_LEVEL_TAG
|
static int |
SHOW_ALL_ROWS
If this value is passed to setRowsPerPage(), it will cause the assistant to show all pages unless the DataRetriever doesn't know how many total rows there are, in which case it will show a reasonable subset. |
static java.lang.String |
USE_REQUEST_DATA_CACHE_PROPERTY
if this is set on variable, clear cached data on each request |
Constructor Summary | |
---|---|
PagingAssistant()
Default constructor - need to call setDataRetriever() to complete initialization. |
|
PagingAssistant(DataRetriever retriever)
Create a paging assistant which will use the given data retriever. |
Method Summary | |
---|---|
boolean |
canSort()
|
void |
disableLookaheadCaching()
Prevent the LJO from caching data fetched by hasNextPage when it probes the data retriever to detect additional pages of data. |
void |
enableLookaheadCaching()
Allow the LJO to cache data fetched by hasNextPage when it probes the data retriever to detect additional pages of data. |
static DataRetriever |
findDataRetriever(WebAppAccess webAppAccess,
java.lang.Object ref,
boolean doInit)
Given the name of a variable, find/construct a DataRetriever for it. |
static DataRetriever |
findDataRetriever(WebAppAccess webAppAccess,
java.lang.Object ref,
boolean doInit,
boolean checkForNewData)
Given the name of a variable, find/construct a DataRetriever for it. |
void |
firstPage()
Go to the first page. |
java.lang.String |
formatRangeText(java.lang.String formatString)
Insert the current page/record/count values into a string with the placeholders {start} = first displayed record, {end} = last displayed record, {count} = total records, {page} = current page, {page_count} = total pages. |
java.lang.String |
formatRangeTextForLocale(java.lang.String formatString,
java.util.Locale locale)
Insert the current page/record/count values into a string with the placeholders {start} = first displayed record, {end} = last displayed record, {count} = total records, {page} = current page, {page_count} = total pages. |
java.util.Collection |
getCollection()
|
int |
getCurrentPage()
Get the zero-based number of the current page. |
int |
getCurrentRow()
Return the zero-based index of the current row. |
IXml |
getData()
Get the current data. |
DataRetriever |
getDataRetriever()
Return the current DataRetriever. |
int |
getDisplayPage()
Return the one-based page number of the current page. |
java.lang.String |
getDisplayRange()
Return indication of current records for display. |
int |
getFirstDisplayRow()
Get the one-based number of the first row to be displayed. |
int |
getLastDisplayPage()
Return one-based indication of last page available for display. |
int |
getLastDisplayRow()
Get the one-based number of the last row currently available for display. |
int |
getLastPage()
Get the zero-based index of the last page. |
java.lang.String |
getName()
Get the name of this LJO. |
java.lang.String |
getPageDisplayRange()
Return one-based indication of pages available for display. |
java.lang.String |
getRangeFormat()
Get the format of the range specifier used in getDisplayRange(). |
int |
getRowCount()
Get total rows. |
int |
getRowsPerPage()
Get the number of rows per page. |
java.lang.String |
getTopLevelTagName()
Return the toplevel tag name |
java.util.Collection |
getUpdatedCollection(WebAppAccess webAppAccess)
Get the current collection, checking for changes in underlying collection first - if changes found, a reset is done. |
IXml |
getUpdatedData(WebAppAccess webAppAccess)
Get the current data, checking for changes in underlying data source first - if changes found, a reset is done. |
boolean |
hasNextPage()
Is there a next page? |
boolean |
hasPreviousPage()
Is there a previous page? |
boolean |
hasSorted()
|
static boolean |
isPagingVariable(WebAppAccess webAppAccess,
java.lang.String ref)
Return true if this variable is under the control of a Paging Assistant. |
boolean |
isRowCountKnown()
|
void |
lastPage()
Go to the last page. |
void |
nextPage()
Advance to the next page. |
void |
notifyRequestComplete()
RequestCompleteListener implementation: this is called automatically by the runtime when the overall request is finished. |
void |
preserveLocation(boolean preserve)
Set whether the reset() method should set the current page to 0. |
void |
previousPage()
Go back to the previous page |
void |
reset(WebAppAccess webAppAccess)
Reset the connection with the retriever: go to the first page and free any cached data. |
void |
setCurrentPage(int pg)
Set the zero-based number of the current page. |
void |
setDataRetriever(DataRetriever retriever)
Set the current DataRetriever. |
void |
setName(java.lang.String name)
Tell this LJO the name of its corresponding Variable. |
void |
setRangeFormat(java.lang.String fmt)
Set the format of the range specifier used in getDisplayRange(). |
void |
setRowsPerPage(int rows)
Set the rows per page. |
void |
setTopLevelTagName(java.lang.String tagName)
Specify a tag name to use for the data's top-level element. |
void |
setWebAppAccess(WebAppAccess webAppAccess)
Specify the WebAppAccess implementation to use. |
boolean |
sort(java.lang.String sortBy,
java.lang.String sortType)
Sort data according to the text of the given column. |
boolean |
sort(java.lang.String sortBy,
java.lang.String sortType,
boolean bAscending)
Sort data according to the text of the given column. |
static boolean |
sortPagingVariable(WebAppAccess webAppAccess,
java.lang.String dataRef,
java.lang.String sortBy,
java.lang.String sortType,
java.lang.String dateFormat)
Sort data according to the text of the given column. |
static boolean |
sortPagingVariable(WebAppAccess webAppAccess,
java.lang.String dataRef,
java.lang.String sortBy,
java.lang.String sortType,
java.lang.String dateFormat,
boolean bAscending)
Sort data according to the text of the given column. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_COLUMN_TAG
public static final java.lang.String DEFAULT_ROW_TAG
public static final java.lang.String DEFAULT_TOP_LEVEL_TAG
public static final int SHOW_ALL_ROWS
public static final java.lang.String USE_REQUEST_DATA_CACHE_PROPERTY
Constructor Detail |
---|
public PagingAssistant()
public PagingAssistant(DataRetriever retriever)
Method Detail |
---|
public boolean canSort()
public void disableLookaheadCaching()
public void enableLookaheadCaching()
public static DataRetriever findDataRetriever(WebAppAccess webAppAccess, java.lang.Object ref, boolean doInit)
public static DataRetriever findDataRetriever(WebAppAccess webAppAccess, java.lang.Object ref, boolean doInit, boolean checkForNewData)
public void firstPage()
public java.lang.String formatRangeText(java.lang.String formatString)
formatString
- The range text format.public java.lang.String formatRangeTextForLocale(java.lang.String formatString, java.util.Locale locale)
formatString
- The range text format.locale
- The locale to be used when formatting the range
text. The default locale will be used if null
.public java.util.Collection getCollection()
public int getCurrentPage()
public int getCurrentRow()
public IXml getData()
public DataRetriever getDataRetriever()
public int getDisplayPage()
public java.lang.String getDisplayRange()
public int getFirstDisplayRow()
public int getLastDisplayPage()
public int getLastDisplayRow()
public int getLastPage()
public java.lang.String getName()
public java.lang.String getPageDisplayRange()
public java.lang.String getRangeFormat()
public int getRowCount()
public int getRowsPerPage()
public java.lang.String getTopLevelTagName()
public java.util.Collection getUpdatedCollection(WebAppAccess webAppAccess)
public IXml getUpdatedData(WebAppAccess webAppAccess)
public boolean hasNextPage()
public boolean hasPreviousPage()
public boolean hasSorted()
public static boolean isPagingVariable(WebAppAccess webAppAccess, java.lang.String ref)
public boolean isRowCountKnown()
public void lastPage()
public void nextPage()
public void notifyRequestComplete()
notifyRequestComplete
in interface com.bowstreet.webapp.RequestCompleteListener
public void preserveLocation(boolean preserve)
public void previousPage()
public void reset(WebAppAccess webAppAccess)
public void setCurrentPage(int pg)
public void setDataRetriever(DataRetriever retriever)
public void setName(java.lang.String name)
public void setRangeFormat(java.lang.String fmt)
public void setRowsPerPage(int rows)
public void setTopLevelTagName(java.lang.String tagName)
public void setWebAppAccess(WebAppAccess webAppAccess)
public boolean sort(java.lang.String sortBy, java.lang.String sortType)
sortBy
- name of the column whose data controls sort ordersortType
- how to interpret and compare the data - NUMBERS, DATES, CASE_INSENSITIVE or DEFAULT_TYPEpublic boolean sort(java.lang.String sortBy, java.lang.String sortType, boolean bAscending)
sortBy
- name of the column whose data controls sort ordersortType
- how to interpret and compare the data - NUMBERS, DATES, CASE_INSENSITIVE or DEFAULT_TYPEbAscending
- do you want to sort ascendingpublic static boolean sortPagingVariable(WebAppAccess webAppAccess, java.lang.String dataRef, java.lang.String sortBy, java.lang.String sortType, java.lang.String dateFormat)
dataRef
- the name of the Variable or the indirect reference holding the potentially paged datasortBy
- name of the column whose data controls sort ordersortType
- how to interpret and compare the data - NUMBERS, DATES, CASE_INSENSITIVE or DEFAULT_TYPEdateFormat
- if sorting as dates, use this pattern to parse the date strings, as in SimpleDateFormatpublic static boolean sortPagingVariable(WebAppAccess webAppAccess, java.lang.String dataRef, java.lang.String sortBy, java.lang.String sortType, java.lang.String dateFormat, boolean bAscending)
dataRef
- the name of the Variable or the indirect reference holding the potentially paged datasortBy
- name of the column whose data controls sort ordersortType
- how to interpret and compare the data - NUMBERS, DATES, CASE_INSENSITIVE or DEFAULT_TYPEdateFormat
- if sorting as dates, use this pattern to parse the date strings, as in SimpleDateFormatbAscending
- do you want to sort ascending
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |