public abstract class AbstractListViewTemplate extends com.softwareag.mobile.runtime.nui.nUIListElement implements IController, IResourceController, ITemplate, com.softwareag.mobile.runtime.nui.nUIEventListener, IDialogDelegate, Observer, com.softwareag.mobile.runtime.nui.IListActionListener, com.softwareag.mobile.runtime.nui.IListProvider, com.softwareag.mobile.runtime.nui.IListListener
AbstractListViewTemplate
acts as a default implementation
for IListListener
and IListProvider
and will be used as super
class for any RecordViewElement in the AML model.
Y_IDENTIFIER_PREV_BOTTOM
COLOR_BACKGROUND_NORMAL, COLOR_BLACK, COLOR_FOREGROUND_DARK, COLOR_FOREGROUND_LIGHT, COLOR_FOREGROUND_NORMAL, COLOR_TRANSPARENT, COLOR_WHITE, DIMENSIONS_IDENTIFIER_PARENT_DIMENSIONS
event_listener, event_listener_exclusive, first_child, last_child, next_sibling, nuiid, parent, prev_sibling, unlink_children_on_removal_from_parent
bottom, center, centre, CREATE, CUSTOM_EVENT_CODE0, EVT_BACK_BUTTON, EVT_COMPLETED_EDIT, EVT_DOUBLE_TAP, EVT_GAIN_FOCUS, EVT_LONG_PRESS, EVT_LOSE_FOCUS, EVT_ON_ADDITION, EVT_PICKER_CANCEL, EVT_PICKER_OK, EVT_POST_EDIT, EVT_PRE_EDIT, EVT_SWIPE_LEFT, EVT_SWIPE_RIGHT, EVT_TIMER_COMPLETE, EVT_TRANSITION_FROM_COMPLETE, EVT_TRIGGER, EVT_TRIGGER_HTTP_FAIL, EVT_TRIGGER_HTTP_SUCCESS, GESTURE_DOUBLE_TAP, GESTURE_LONG_PRESS, GESTURE_NONE, GESTURE_SWIPE, left, MAX_DY_FOR_SWIPE, MIN_DX_FOR_SWIPE, MIN_SCROLL_START_THRESHOLD, NO_YES, OFF_ON, POINTER_STATE_DRAGGED, POINTER_STATE_PRESSED, POINTER_STATE_PRESSED_AND_RELEASED, POINTER_STATE_RELEASED, REMOVE, right, size_absolute, size_huge, size_large, size_medium, size_relative, size_small, size_tiny, style_bold, style_default, style_italic, style_underlined, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, top
STATUS_CLOSED, STATUS_OPENED, STATUS_SWIPED, SWIPE_LEFT_TO_RIGHT, SWIPE_RIGHT_TO_LEFT
Constructor and Description |
---|
AbstractListViewTemplate() |
Modifier and Type | Method and Description |
---|---|
void |
bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control,
IDatasource ds,
IDataTransformer transformer,
java.lang.String expression)
Fetches the expression value and passes this value
bind(nUIDisplayObject, IDataTransformer, Object) . |
void |
bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control,
IDatasource ds,
java.lang.String expression)
Binds a given control to it's value defined within a datasource.
|
void |
bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control,
IListDatasource ds,
IDataTransformer transformer,
int rowIndex,
java.lang.String expression)
Binds a given control to it's value defined within a datasource.
|
void |
bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control,
IListDatasource ds,
IDataTransformer transformer,
java.lang.String expression)
Binds a given control to it's value defined within a datasource.
|
void |
bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control,
IListDatasource ds,
java.lang.String expression)
Binds a given control to it's value defined within a datasource.
|
int |
compare(java.lang.Object left,
java.lang.Object right) |
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) |
javax.microedition.lcdui.Image |
getDefaultPlaceHolderImage()
Return the default place holder image that will be used if requested image
was not found.
|
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.
|
AbstractViewController |
getParentController() |
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) |
TransitionStackController |
getTransitionStackController()
Returns the assigned
TransitionStackController or null if no
TransitionStackController is used for the observed element. |
int |
getTypeForCell(int rowIndex) |
int |
getWindowPane()
Returns the Integer representation of the pane, which displays the observed
UI element.
|
void |
initBindings() |
void |
loadAndScaleImages()
This method will be called after the template was created and added to a View
in order to load and scale images inside of the current template.
|
javax.microedition.lcdui.Image |
loadImage(java.lang.String imageName)
Loads an icon asset specified by it's name.
|
javax.microedition.lcdui.Image |
loadImage(java.lang.String imageName,
int viewBackGroundColor)
Deprecated.
Use the new asset management.
|
javax.microedition.lcdui.Image |
loadImage(java.lang.String imageName,
int viewBackGroundColor,
int parentsWidth)
Deprecated.
Use the new asset management.
|
java.lang.String |
loadWWWResource(com.softwareag.mobile.runtime.nui.nUIObject target,
java.lang.String fileName,
java.lang.String prefix,
java.lang.String encoding)
Loads the given html file to the string
|
boolean |
nUIEventCallback(com.softwareag.mobile.runtime.nui.nUIObject object,
int evtType) |
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 |
onDialogButtonPressed(AbstractDialog dialog,
int buttonId)
This method will be called if a event occurs in given
AbstractDialog . |
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 |
onRemoved() |
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 |
onTemplateCreated()
This method is called after the template has been created with all it's
elements and it's bindings have been initialized.
|
void |
reloadDatasources()
Reloads the assigned list datasource and removes all content beforehand.
|
void |
reloadDatasources(boolean keepExistingContent)
Reloads the assigned list datasource.
|
javax.microedition.lcdui.Image |
resizeImage(javax.microedition.lcdui.Image image,
int width,
int height)
Resize the given image.
|
void |
setParentController(AbstractViewController parentController) |
void |
setParentController(IResourceController controller) |
boolean |
showDialogButton(AbstractDialog dialog,
int buttonId)
This method is called for each button.
|
void |
stackTransition(com.softwareag.mobile.runtime.nui.nUIObject sender,
int evtType,
AbstractViewController controller,
int transition,
int pane)
This method creates a new
TransitionStackController (TSC) using
sender as identifier if it does not already exist and navigates
to the view created by the given controller into the given pane. |
void |
transition(com.softwareag.mobile.runtime.nui.nUIObject sender,
int evtType,
AbstractViewController controller,
int transition,
int pane)
Navigates to the view created by
controller . |
void |
update(Observable observable,
java.lang.Object object)
This method will be called if the underlying
Observable has been
changed. |
deleteRow, deleteRows, enablePullToRefresh, getBgimageScroll, getDelegate, getFirstVisibleRow, getHeader, getHscrollable, getLastVisibleRow, getListActionListener, getListListener, getScrollPosition, getVscrollable, hideSpinner, insertRow, insertRows, isSpinnerVisible, scrollTo, scrollToRow, setBgimageScroll, setCustomSpinner, setDelegate, setHeader, setHscrollable, setListActionListener, setListListener, setScrollThreshold, setVscrollable, showSpinner, update, updateRow, updateRows
applyBackground, applyBackground, applyBackground
getBackgroundDrawable, getBgcolor, getBottom, getElementIdentifier, getFocus, getFocusable, getGesturable, getHeight, getInnerHeight, getInnerWidth, getInnerX, getInnerY, getLeft, getMaxChildX, getMaxChildY, getProperties, getProperty, getRight, getScreenInnerX, getScreenInnerY, getScreenX, getScreenY, getTop, getTopLevelParentView, getTopLevelParentWindow, getTriggerable, getWidth, getX, getY, insertAtInternal, isEnabled, isVisible, remove, setBackgroundDrawable, setBgcolor, setBottom, setChildFocus, setElementIdentifier, setEnabled, setFocus, setFocusable, setGesturable, setHeight, setInnerHeight, setInnerWidth, setInnerX, setInnerY, setLeft, setProperties, setProperty, setRight, setTop, setTriggerable, setVisible, setWidth, setX, setY
public boolean nUIEventCallback(com.softwareag.mobile.runtime.nui.nUIObject object, int evtType)
nUIEventCallback
in interface com.softwareag.mobile.runtime.nui.nUIEventListener
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)
public 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 void onTemplateCreated()
public void initBindings()
public void bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control, IListDatasource ds, java.lang.String expression)
Just delegates to
bind(nUIDisplayObject, IListDatasource, IDataTransformer, String)
.
control
- ds
- expression
- public void bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control, IListDatasource ds, IDataTransformer transformer, java.lang.String expression)
Just delegates to
bind(nUIDisplayObject, IListDatasource, IDataTransformer, int, String)
.
control
- ds
- transformer
- expression
- public void bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control, IDatasource ds, java.lang.String expression)
Just delegates to
#bind(nUIDisplayObject, IDatasource, IDataTransformer, int, String)
.
control
- ds
- transformer
- expression
- public void bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control, IDatasource ds, IDataTransformer transformer, java.lang.String expression)
bind(nUIDisplayObject, IDataTransformer, Object)
.control
- ds
- transformer
- expression
- public void bind(com.softwareag.mobile.runtime.nui.nUIDisplayObject control, IListDatasource ds, IDataTransformer transformer, int rowIndex, java.lang.String expression)
Uses IListDatasource.getExpressionValue(String, int)
and passes this
value to the specific updateBinding methods.
control
- ds
- transformer
- rowIndex
- expression
- public void setParentController(AbstractViewController parentController)
public void setParentController(IResourceController controller)
public AbstractViewController getParentController()
public void transition(com.softwareag.mobile.runtime.nui.nUIObject sender, int evtType, AbstractViewController controller, int transition, int pane)
IController
controller
. The view with given
transition effect appears on the given pane. If there is a
StackTransitionController, which is associated with the pane, the
controller
will be pushed to it.transition
in interface IController
sender
- The nUIObject
which triggers the event.evtType
- The type of the event. Possible types are declared in
nUIConstants
.controller
- The controller which contains a View to push.transition
- The type of the transition. Transition types are defined in
nUIController
.pane
- The Integer representation of the pane to push the View on.IController.getTransitionStackController()
,
IController.getWindowPane()
public void stackTransition(com.softwareag.mobile.runtime.nui.nUIObject sender, int evtType, AbstractViewController controller, int transition, int pane)
IController
TransitionStackController
(TSC) using
sender
as identifier if it does not already exist and navigates
to the view created by the given controller
into the given pane.
The new created TSC will be mapped to sender
and saved in the
current controller.
If a TransitionStackController
exists, the
controller
will be ignored. Depending on which controller is
currently associated with the target pane, methods navigates either to
stackTransition
in interface IController
sender
- object that triggered this call. Its NUIID is used as key to
store/retrieve TSC.evtType
- type of the event that triggered the call.controller
- if TSC does not exist, controller
is used as root
controller for the TSCtransition
- transition effect.pane
- target panepublic TransitionStackController getTransitionStackController()
IController
TransitionStackController
or null if no
TransitionStackController is used for the observed element. TransitionStackController
assigned to the controller, which observes
a given View the Template is assigned to. TransitionStackController
assigned to the View's controller.getTransitionStackController
in interface IController
TransitionStackController
or null.public int getWindowPane()
IController
Constants
interface.getWindowPane
in interface IController
public void onDialogButtonPressed(AbstractDialog dialog, int buttonId)
IDialogDelegate
AbstractDialog
.onDialogButtonPressed
in interface IDialogDelegate
dialog
- The AbstractDialog
containing the button.buttonId
- The id of the triggered button as modeled with the editor.public boolean showDialogButton(AbstractDialog dialog, int buttonId)
IDialogDelegate
showDialogButton
in interface IDialogDelegate
dialog
- The AbstractDialog
containing the button.buttonId
- The id of the triggered button as modeled with the editor.true
if the button should be shown; false
otherwisepublic java.lang.String loadWWWResource(com.softwareag.mobile.runtime.nui.nUIObject target, java.lang.String fileName, java.lang.String prefix, java.lang.String encoding)
IResourceController
loadWWWResource
in interface IResourceController
target
- object that triggers the callfileName
- requested html fileprefix
- relative path, where the given file is supposed to be found.encoding
- this encoding will be used by reading the html file.public javax.microedition.lcdui.Image getDefaultPlaceHolderImage()
IResourceController
getDefaultPlaceHolderImage
in interface IResourceController
public javax.microedition.lcdui.Image loadImage(java.lang.String imageName)
IResourceController
There are two types of icon assets:
The loading of .asset icons depend on the target platform. Please see
AssetImageLoader
for more details.
To load .png assets, this method uses a search path according to:
AbstractApplicationController#getAndroidGraphicsFolder(int, int)
AbstractApplicationController#getIOSGraphicsFolders(int, int)
AbstractApplicationController#getWinPhoneGraphicFolder(int, int, int)
see also
AbstractApplicationController#getWinPhoneThemeFolder(int)
A default placeholder, configurable by overwriting
#defaultPlaceHolderImage
, will be returned if the asset could not be
found.
loadImage
in interface IResourceController
imageName
- filename to loadpublic javax.microedition.lcdui.Image loadImage(java.lang.String imageName, int viewBackGroundColor)
public javax.microedition.lcdui.Image loadImage(java.lang.String imageName, int viewBackGroundColor, int parentsWidth)
public javax.microedition.lcdui.Image resizeImage(javax.microedition.lcdui.Image image, int width, int height)
IResourceController
ImageHandler#resizeImage(Image, int, int, boolean)
for more details.resizeImage
in interface IResourceController
public void loadAndScaleImages()
ITemplate
loadAndScaleImages
in interface ITemplate
public void onRemoved()
onRemoved
in class com.softwareag.mobile.runtime.nui.nUIDisplayObject