public interface IListViewDelegate
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
IListDatasource
to manage the objects representing the contents of
the ListView
.
Modifier and Type | Field and Description |
---|---|
static int |
EDITING_STYLE_NONE
Editing style used as return value for
getEditingStyleForRow(ListView, int) indicating that now editing
will happen. |
static int |
EDITING_STYLE_SWIPE_EDIT_LEFT
Editing style used as return value for
getEditingStyleForRow(ListView, int) indicating that the user
can swipe the cell from right to left to edit the cell. |
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. |
java.lang.Object |
getCell(ListView listView,
java.lang.Object cachedCell,
int rowIndex)
This method enables Android users to reuse existing cells.
|
int |
getEditingStyleForRow(ListView listView,
int rowIndex)
Returns the editing style for a given row index.
|
java.lang.String |
getEditingText(ListView listView,
int rowIndex)
Returns the text used for the edit button provided by
EDITING_STYLE_SWIPE_EDIT_LEFT . |
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 . |
boolean |
isHeaderVisible(ListView listView)
This method is called to determine if a configured header should be added
to the ListView.
|
void |
onRowEdit(ListView listView,
int rowIndex)
Will be called after the user pressed the edit button provided by the
style
EDITING_STYLE_SWIPE_EDIT_LEFT . |
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 |
onRowMoved(ListView listView,
int sourceIndex,
int destinationIndex)
Will be called after the position of a cell was changed in the
ListView when ListView.setSortEnabled(boolean) is
set to true . |
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. |
static final int EDITING_STYLE_NONE
getEditingStyleForRow(ListView, int)
indicating that now editing
will happen.static final int EDITING_STYLE_SWIPE_EDIT_LEFT
getEditingStyleForRow(ListView, int)
indicating that the user
can swipe the cell from right to left to edit the cell.int getNumberOfRows(ListView listView)
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)
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)
ListView
. A separator can be any nUIElementDisplay
, but
typically you would use a nUISeparatorElement
.
This feature cannot be used in combination with native ListViews.
listView
- the calling ListView
objectrowIndex
- the index of the cell starting at 0boolean usesPagination(ListView listView)
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.
This feature cannot be used in combination with native ListViews.
int getMaxNumberPaginationRows(ListView listView)
ListView
.
You need to enable Pagination by returning true
in
usesPagination(ListView)
.
This feature cannot be used in combination with native ListViews.
listView
- the calling ListView
objectcom.softwareag.mobile.runtime.nui.nUIDisplayObject getPaginationNextPageCell(ListView listView, int pageIndex)
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.
This feature cannot be used in combination with native ListViews.
listView
- the calling ListView
objectpageIndex
- the index of the current pagecom.softwareag.mobile.runtime.nui.nUIDisplayObject getPaginationPreviousPageCell(ListView listView, int pageIndex)
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.
This feature cannot be used in combination with native ListViews.
listView
- the calling ListView
objectpageIndex
- the index of the current pagevoid onRowSelect(ListView listView, int rowIndex)
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 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 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 0void onRowMoved(ListView listView, int sourceIndex, int destinationIndex)
ListView
when ListView.setSortEnabled(boolean)
is
set to true
.
This method has only an effect by using the native
ListView
feature.
listView
- sourceIndex
- destinationIndex
- int getEditingStyleForRow(ListView listView, int rowIndex)
ListView
's
support the following styles:
EDITING_STYLE_NONE
, the default valueEDITING_STYLE_SWIPE_EDIT_LEFT
getEditingText(ListView, int)
.
Pressing the button forces onRowEdit(ListView, int)
to be
called. Implement onRowEdit(ListView, int)
to modify the cell.
This method has only an effect by using the native
ListView
feature.
listView
- rowIndex
- void onRowEdit(ListView listView, int rowIndex)
EDITING_STYLE_SWIPE_EDIT_LEFT
.
This method has only an effect by using the native
ListView
feature.
listView
- rowIndex
- java.lang.String getEditingText(ListView listView, int rowIndex)
EDITING_STYLE_SWIPE_EDIT_LEFT
.
This method has only an effect by using the native
ListView
feature.
listView
- rowIndex
- java.lang.Object getCell(ListView listView, java.lang.Object cachedCell, int rowIndex)
getCell(ListView, int)
.Users may use the delivered
cachedCell to reuse an existing cell:
Object cell = null;
if(cachedCell instanceof Type) {
final Type typedCell = (Type) cachedCell;
typedCell.update(); // update the cached cell based on the underlying data
return typedCell;
} else {
cell = getCell(listView, rowIndex);
}
return cell;
This method has only an effect by using the native ListView
feature for Android.
- Parameters:
listView
-
cachedCell
-
rowIndex
-
- Returns:
-
isHeaderVisible
boolean isHeaderVisible(ListView listView)
This method is called to determine if a configured header should be added
to the ListView. It's also called after a reload forced by a content
provider. Defaults to true.
This feature cannot be used in combination with native ListViews.
- Parameters:
listView
-
- Returns:
- See Also:
ListView#setHeaderElement(nUIObject)}