public abstract class AbstractViewController extends java.lang.Object implements IViewController, IResourceController, IDialogDelegate
Constructor and Description |
---|
AbstractViewController() |
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.
|
com.softwareag.mobile.runtime.nui.nUINavbuttonElement |
createNavButton(int nuiid,
java.lang.String text,
javax.microedition.lcdui.Image icon)
Creates a new instance of
nUINavButtonElement . |
com.softwareag.mobile.runtime.nui.nUINavbuttonElement |
createNavButton(int nuiid,
java.lang.String text,
int type,
javax.microedition.lcdui.Image icon)
Creates a new instance of
nUINavButtonElement . |
java.lang.String |
getBackButtonText()
Returns the default back button text.
|
javax.microedition.lcdui.Image |
getDefaultPlaceHolderImage()
Return the default place holder image that will be used if requested
image was not found.
|
java.util.Hashtable |
getMappedTransitionStackControllers()
Returns all
TransitionStackController , which were stored by
stackTransition(nUIObject, int, AbstractViewController, int, int)
method calls. |
TransitionStackController |
getTransitionStackController()
Returns the assigned
TransitionStackController or null if no
TransitionStackController is used for the observed element. |
int |
getWindowPane()
Returns the Integer representation of the pane, which displays the
observed UI element.
|
boolean |
hasSideView()
Returns a boolean value indicating if a SideView should be used in
combination with the underlying view.
|
void |
initBindings()
Iterates through all bindings all evaluates them.
|
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
|
void |
onAlertDialogButtonPressed(AbstractAlertDialog dialog,
int buttonId)
implement IDialogDelegate interface
|
void |
onBackButtonEvent(com.softwareag.mobile.runtime.nui.nUINavbuttonElement backButton)
This method is called when the back button is selected.
|
void |
onHideView()
This methods gets called when the view becomes hidden on a pane.
|
void |
onShowView()
This method is called when the view becomes visible on a pane.
|
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 |
onUISynced()
This method will be called to notify the controller that all UI
calculations made for the underlying
nUIViewDisplay are done. |
void |
resetView()
Removes reference to the view and destroys it.
|
javax.microedition.lcdui.Image |
resizeImage(javax.microedition.lcdui.Image image,
int width,
int height)
Resize the given image.
|
void |
setTransitionStackController(TransitionStackController transitionStackController) |
void |
setWindowPane(int pane)
The integer identifier of the pane will be set automatically using this
method by
TransitionStackController or by
AbstractApplicationController . |
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 . |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBackButton, createView, getViewDisplay, hidesBackButton
public void setTransitionStackController(TransitionStackController transitionStackController)
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 java.util.Hashtable getMappedTransitionStackControllers()
TransitionStackController
, which were stored by
stackTransition(nUIObject, int, AbstractViewController, int, int)
method calls.Hashtable
, whereby Key - NUIID, value -
TransitionStackController
public 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 void setWindowPane(int pane)
IViewController
TransitionStackController
or by
AbstractApplicationController
. This value is accessible by
IController.getWindowPane()
setWindowPane
in interface IViewController
pane
- integer identifier of pane defined in Constants
public int getWindowPane()
IController
Constants
interface.getWindowPane
in interface IController
public java.lang.String getBackButtonText()
Controller implementations may overwrite this method.
public void onBackButtonEvent(com.softwareag.mobile.runtime.nui.nUINavbuttonElement backButton)
IViewController
This method is called when the back button is selected. The default
implementation based on AbstractViewController
and
TransitionStackController
will just go back in the stack
hierarchy by calling
TransitionStackController.popViewController()
-
Overwrite this method to implement custom workflow or behavior.
onBackButtonEvent
in interface IViewController
backButton
- the nUINavbuttonElement
instance that was selectedpublic 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
TransitionStackController}
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
TransitionStackController}
public void onShowView()
IViewController
AbstractApplicationController.showPane(int)
triggers this call.onShowView
in interface IViewController
public void onHideView()
IViewController
AbstractApplicationController.hidePane(int)
triggers this call.onHideView
in interface IViewController
public void resetView()
IViewController
Removes reference to the view and destroys it.
resetView
in interface IViewController
#createView()}
public void onAlertDialogButtonPressed(AbstractAlertDialog dialog, int buttonId)
onAlertDialogButtonPressed
in interface IDialogDelegate
dialog
- The AbstractAlertDialog
containing the button.buttonId
- The id of the triggered button as modeled with the editor.public void onUISynced()
IViewController
nUIViewDisplay
are done.onUISynced
in interface IViewController
public boolean hasSideView()
This method will be overwritten by each specific view controller. The returned boolean value is true, if the modeled view contains a OpenSideView action.
public com.softwareag.mobile.runtime.nui.nUINavbuttonElement createNavButton(int nuiid, java.lang.String text, javax.microedition.lcdui.Image icon)
nUINavButtonElement
. Overwriting
this methods enable users to inject a custom implementation.
Delegates to createNavButton(int, String, int, Image)
and uses
nUINavbuttonElement.TYPE_DEFAULT
as type.
nuiid
- text
- icon
- public com.softwareag.mobile.runtime.nui.nUINavbuttonElement createNavButton(int nuiid, java.lang.String text, int type, javax.microedition.lcdui.Image icon)
nUINavButtonElement
. Overwriting
this methods enable users to inject a custom implementation.
Delegates to the AbstractApplicationController
.
nuiid
- text
- type
- icon
- public void initBindings()
onTransitionTo()
is called.
Make sure to invoke the method on your super class if you're going to overwrite it.
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 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