public abstract class AbstractListViewController extends AbstractViewController implements com.softwareag.mobile.runtime.nui.IListListener, com.softwareag.mobile.runtime.nui.IListProvider, Observer, com.softwareag.mobile.runtime.nui.IListActionListener, IComparator
AbstractListViewController
acts as a default implementation
for IListListener
and IListProvider
and will be used as super
class for any RecordView in the AML model.
Constructor and Description |
---|
AbstractListViewController() |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object left,
java.lang.Object right)
Compares two objects and returns either -1, 0 or 1 to tell the caller if the
first argument object is less than, equal to, or greater than the second.
|
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
createEmptyListCell()
Creates the
nUIDisplayObject , which will be displayed when the list
datasource does not hold any elements. |
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
createOfflineListCell()
Creates a
nUIDisplayObject , which will be displayed when
isOnline() returns false. |
void |
doReload()
Call this method to trigger the reload process.
|
void |
doReload(boolean keepExistingContent)
Call this method to trigger the reload process.
|
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
getCell(int rowIndex,
com.softwareag.mobile.runtime.nui.nUIDisplayObject reusableObject) |
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
getEmptyListCell()
Returns a boolean value indicating if the list empty cell should be used if
the datasource does not contain any elements after reloading.
|
int |
getNumberOfRows() |
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
getOfflineListCell()
Returns the list offline cell.
|
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
getPlaceholder()
Is used to determine what should be displayed in the list if it is empty
(i.e.
|
com.softwareag.mobile.runtime.nui.nUIDisplayObject |
getSeparator() |
com.softwareag.mobile.runtime.nui.SwipeBehavior |
getSwipeBehavior(int cellType,
int swipeDirection) |
int |
getTypeForCell(int rowIndex) |
void |
onActionButtonClicked(int row,
com.softwareag.mobile.runtime.nui.nUIActionButton button) |
void |
onActionButtonsClosed(int row) |
void |
onActionButtonsOpened(int row,
int type) |
void |
onDatasourceError(IListDatasource datasource,
java.lang.Exception exception)
Will be called when reloading returns in an exception.
|
void |
onFocusGained(int rowIndex,
com.softwareag.mobile.runtime.nui.nUIDisplayObject element) |
void |
onFocusLost(int rowIndex,
com.softwareag.mobile.runtime.nui.nUIDisplayObject element) |
void |
onRefresh() |
void |
onRowSelected(int rowIndex,
com.softwareag.mobile.runtime.nui.nUIDisplayObject element) |
void |
onScrollBoundReached(int type) |
void |
onScrollStateChanged(int state) |
void |
onScrollThresholdReached() |
void |
onSwiped(int row,
int type) |
void |
onTransitionFrom()
This method is called right before the view is transitioned off the screen by
a
TransitionStackController . |
void |
onTransitionTo()
This method is called right after the view is created and before it is
transitioned on to the screen by a
TransitionStackController . |
void |
reloadDatasources()
Reloads the assigned list datasource and removes all content beforehand.
|
void |
reloadDatasources(boolean keepExistingContent)
Reloads the assigned list datasource.
|
boolean |
shouldSelect(int index) |
boolean |
shouldSelectInEditMode(int index) |
void |
update(Observable observable,
java.lang.Object object)
This method will be called if the underlying
Observable has been
changed. |
bind, bind, bind, bind, bind, createNavButton, createNavButton, createSearchNavButton, getBackButtonText, getDefaultPlaceHolderImage, getMappedTransitionStackControllers, getTransitionStackController, getWindowPane, hasSideView, initBindings, loadImage, loadImage, loadImage, loadWWWResource, onBackButtonEvent, onDialogButtonPressed, onHideView, onShowView, onUISynced, resetView, resizeImage, setTransitionStackController, setWindowPane, showDialogButton, stackTransition, transition
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBackButton, createView, getViewDisplay, hidesBackButton
public void onTransitionFrom()
IViewController
This method is called right before the view is transitioned off the screen by
a TransitionStackController
. Overwrite to save data or execute any
logic needed right before the view will be removed.
onTransitionFrom
in interface IViewController
onTransitionFrom
in class AbstractViewController
TransitionStackController}
public void onTransitionTo()
IViewController
This method is called right after the view is created and before it is
transitioned on to the screen by a TransitionStackController
.
Overwrite to add, remove or customize controls programmatically or load data
in the background. This is the entry point for all business logic that needs
to be executed for a view.
onTransitionTo
in interface IViewController
onTransitionTo
in class AbstractViewController
TransitionStackController}
public void update(Observable observable, java.lang.Object object)
Observer
Observable
has been
changed.update
in interface Observer
observable
- the changed Observable
object
- any passed data Object, can be nullpublic void reloadDatasources()
If no datasource is assigned to the RecordView, clients need to overwrite
this method to implement the reload themselves. Make sure to call the
update(Observable, Object)
method once the reload is completed.
public void reloadDatasources(boolean keepExistingContent)
If no datasource is assigned to the RecordView, clients need to overwrite
this method to implement the reload themselves. Make sure to call the
update(Observable, Object)
method once the reload is completed.
keepExistingContent
- if true
, the datasource content will
be retained; otherwise it will be removedpublic void onDatasourceError(IListDatasource datasource, java.lang.Exception exception)
Clients need to overwrite this method in order to properly react on exceptions. The default implementation only forces the underlying ListView to update.
datasource
- exception
- public void doReload(boolean keepExistingContent)
This method determines if an offline list cell needs to be displayed while
calling isOnline()
.
keepExistingContent
- if true
, the datasource content will
be retained; otherwise it will be removedpublic void doReload()
This method determines if an offline list cell needs to be displayed while
calling isOnline()
.
public com.softwareag.mobile.runtime.nui.nUIDisplayObject getPlaceholder()
getNumberOfRows()
returns 0). If null
is
returned, nothing will be displayed.getPlaceholder
in interface com.softwareag.mobile.runtime.nui.IListProvider
null
public com.softwareag.mobile.runtime.nui.nUIDisplayObject createOfflineListCell()
nUIDisplayObject
, which will be displayed when
isOnline()
returns false.public com.softwareag.mobile.runtime.nui.nUIDisplayObject getOfflineListCell()
Calls createOfflineListCell()
if the actual instance is null.
public com.softwareag.mobile.runtime.nui.nUIDisplayObject createEmptyListCell()
nUIDisplayObject
, which will be displayed when the list
datasource does not hold any elements.
If null is returned, the ListView will remain empty.
public com.softwareag.mobile.runtime.nui.nUIDisplayObject getEmptyListCell()
This method will be used internally. It's not recommended to overwrite it.
public int compare(java.lang.Object left, java.lang.Object right)
IComparator
compare
in interface IComparator
left
- the first object for comparingright
- the second object for comparingpublic int getNumberOfRows()
getNumberOfRows
in interface com.softwareag.mobile.runtime.nui.IListProvider
public int getTypeForCell(int rowIndex)
getTypeForCell
in interface com.softwareag.mobile.runtime.nui.IListProvider
public com.softwareag.mobile.runtime.nui.nUIDisplayObject getCell(int rowIndex, com.softwareag.mobile.runtime.nui.nUIDisplayObject reusableObject)
getCell
in interface com.softwareag.mobile.runtime.nui.IListProvider
public com.softwareag.mobile.runtime.nui.SwipeBehavior getSwipeBehavior(int cellType, int swipeDirection)
getSwipeBehavior
in interface com.softwareag.mobile.runtime.nui.IListProvider
public com.softwareag.mobile.runtime.nui.nUIDisplayObject getSeparator()
getSeparator
in interface com.softwareag.mobile.runtime.nui.IListProvider
public void onRowSelected(int rowIndex, com.softwareag.mobile.runtime.nui.nUIDisplayObject element)
onRowSelected
in interface com.softwareag.mobile.runtime.nui.IListListener
public void onFocusGained(int rowIndex, com.softwareag.mobile.runtime.nui.nUIDisplayObject element)
onFocusGained
in interface com.softwareag.mobile.runtime.nui.IListListener
public void onFocusLost(int rowIndex, com.softwareag.mobile.runtime.nui.nUIDisplayObject element)
onFocusLost
in interface com.softwareag.mobile.runtime.nui.IListListener
public void onScrollBoundReached(int type)
onScrollBoundReached
in interface com.softwareag.mobile.runtime.nui.IListListener
public void onScrollThresholdReached()
onScrollThresholdReached
in interface com.softwareag.mobile.runtime.nui.IListListener
public void onScrollStateChanged(int state)
onScrollStateChanged
in interface com.softwareag.mobile.runtime.nui.IListListener
public void onActionButtonClicked(int row, com.softwareag.mobile.runtime.nui.nUIActionButton button)
onActionButtonClicked
in interface com.softwareag.mobile.runtime.nui.IListActionListener
public void onActionButtonsOpened(int row, int type)
onActionButtonsOpened
in interface com.softwareag.mobile.runtime.nui.IListActionListener
public void onActionButtonsClosed(int row)
onActionButtonsClosed
in interface com.softwareag.mobile.runtime.nui.IListActionListener
public void onSwiped(int row, int type)
onSwiped
in interface com.softwareag.mobile.runtime.nui.IListActionListener
public void onRefresh()
onRefresh
in interface com.softwareag.mobile.runtime.nui.IListListener
public boolean shouldSelectInEditMode(int index)
shouldSelectInEditMode
in interface com.softwareag.mobile.runtime.nui.IListProvider
public boolean shouldSelect(int index)
shouldSelect
in interface com.softwareag.mobile.runtime.nui.IListProvider