public interface IListViewDelegate
The IListViewDelegate
is used by a ListView
to create
it's content and handle events. One IListViewDelegate
can
be used by multiple ListView
s
You might use the IListViewDelegate
in combination with an
IListViewDatasource
to manage the objects representing the contents
of the ListView
.
Modifier and Type | Method and Description |
---|---|
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
getCell(ListView listView,
int rowIndex)
For every row in the
ListView this method is called to return the
actual cell object to be displayed at the given index. |
int |
getMaxNumberPaginationRows(ListView listView)
Returns the maximum number of cells on one page of a
ListView . |
int |
getNumberOfRows(ListView listView)
Use to return the number of cells (rows) the
ListView needs to display. |
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
getPaginationNextPageCell(ListView listView,
int pageIndex)
Use to provide a cell that is displayed to navigate to the next page, if
pagination is enabled for the calling
ListView . |
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
getPaginationPreviousPageCell(ListView listView,
int pageIndex)
Use to provide a cell that is displayed to navigate to the previous page, if
pagination is enabled for the calling
ListView . |
com.softwareag.mobile.runtime.nui.nUIElementDisplay |
getSeparator(ListView listView,
int rowIndex)
Use to return the separator for a given index of cell in a
ListView . |
void |
onRowGainFocus(ListView listView,
int rowIndex)
Use this method to handle focusing of the cell.
|
void |
onRowLoseFocus(ListView listView,
int rowIndex)
Use this method to handle defocusing of the cell.
|
void |
onRowSelect(ListView listView,
int rowIndex)
Use this method to handle selection of the cell.
|
boolean |
usesPagination(ListView listView)
Use to make the
ListView automatically use pagination to display
only a maximum number of rows at once. |
int getNumberOfRows(ListView listView)
Use to return the number of cells (rows) the ListView
needs to display.
For every row getCell(ListView, int)
will be called to get the cell
object at the given index.
Make sure this is as performant as possible.
listView
- the calling ListView
objectcom.softwareag.mobile.runtime.nui.nUIDisplayObject getCell(ListView listView, int rowIndex)
For every row in the ListView
this method is called to return the
actual cell object to be displayed at the given index. A cell is typically
a nUITableButton
(or subclass), but could by any nUIDisplayObject
.
For every cell, the ListView
will also call getSeparator(ListView, int)
.
listView
- the calling ListView
objectrowIndex
- the index of the cell starting at 0rowIndex
com.softwareag.mobile.runtime.nui.nUIElementDisplay getSeparator(ListView listView, int rowIndex)
Use to return the separator for a given index of cell in a ListView
. A separator
can be any nUIElementDisplay
, but typically you would use a
listView
- the calling ListView
objectrowIndex
- the index of the cell starting at 0boolean usesPagination(ListView listView)
Use to make the ListView
automatically use pagination to display
only a maximum number of rows at once. The total number of rows in the
ListView
is split into pages that contain two additional cells
to navigate back and forward between the pages.
Pagination might be really useful if you have a large number of cells or complex cells that take a long time to render.
int getMaxNumberPaginationRows(ListView listView)
Returns the maximum number of cells on one page of a ListView
. You
need to enable Pagination by returning true
in
usesPagination(ListView)
.
listView
- the calling ListView
objectcom.softwareag.mobile.runtime.nui.nUIDisplayObject getPaginationNextPageCell(ListView listView, int pageIndex)
Use to provide a cell that is displayed to navigate to the next page, if
pagination is enabled for the calling ListView
. The event is handled
automatically to reload the ListView
with the new increased pagination index.
This method is not called on the last page.
listView
- the calling ListView
objectpageIndex
- the index of the current pagecom.softwareag.mobile.runtime.nui.nUIDisplayObject getPaginationPreviousPageCell(ListView listView, int pageIndex)
Use to provide a cell that is displayed to navigate to the previous page, if
pagination is enabled for the calling ListView
. The event is handled
automatically to reload the ListView
with the new decreased pagination index.
This method is not called on the first page.
listView
- the calling ListView
objectpageIndex
- the index of the current pagevoid onRowSelect(ListView listView, int rowIndex)
Use this method to handle selection of the cell. It is called for trigger events on the cell at the given index of the selected row. In this method you typically navigate to a new view.
Use ListView.cellForRowIndex(int)
to get the cell from the ListView
.
listView
- the calling ListView
objectrowIndex
- the index of the cell that was selected starting at 0void onRowGainFocus(ListView listView, int rowIndex)
Use this method to handle focusing of the cell. It is called for gain focus events on the cell at the given index. In this method you typically change UI attributes of a cell if the automatic behaviour is not sufficient for you.
Use ListView.cellForRowIndex(int)
to get the cell from the ListView
.
listView
- the calling ListView
objectrowIndex
- the index of the cell that was focused starting at 0void onRowLoseFocus(ListView listView, int rowIndex)
Use this method to handle defocusing of the cell. It is called for lose focus events on the cell at the given index. In this method you typically change UI attributes of a cell if the automatic behaviour is not sufficient for you.
Use ListView.cellForRowIndex(int)
to get the cell from the ListView
.
listView
- the calling ListView
objectrowIndex
- the index of the cell that was defocused starting at 0