public abstract class AbstractApplicationController extends java.lang.Object implements IResourceController, IPaneConfigDelegate, IDialogDelegate
getInstance()
method.
The AbstractApplicationController contains a lot of important methods which
allow you to perform following operations:
setView(nUIViewDisplay, int, int)
and
setViewController(AbstractViewController, int, int)
)
changePaneConfiguration(nUIObject, PaneConfiguration, IPaneConfigDelegate, Hashtable)
)
showPane(int)
, hidePane(int)
and isPaneVisible(int)
)
openDialog(AbstractAlertDialog)
and
closeDialog()
)
openProgressWindow()
and
closeProgressWindow()
)
loadImage(String, int, int)
and
loadWWWResource(nUIObject, String, String, String)
)
final AbstractApplicationController controller = AbstractApplicationController.getInstance(); controller.changePangeConfiguration(null, myPaneConfiguration, controller new Hashtable());It's also possible to set a new view controller without the
TransitionStackController
, for that use
final AbstractViewController avc = ...; final int transitionStyle = nUIController.TRANSITION_FADE; final int paneId = 0; final AbstractApplicationController controller = AbstractApplicationController.getInstance(); controller.setViewController(avc, transitionStyle, paneId);
Modifier and Type | Field and Description |
---|---|
static int |
TRANSITION_STYLE_NOT_DEFINED |
Constructor and Description |
---|
AbstractApplicationController() |
Modifier and Type | Method and Description |
---|---|
void |
changePaneConfiguration(com.softwareag.mobile.runtime.nui.nUIObject sender,
PaneConfiguration pc,
IPaneConfigDelegate delegate,
java.util.Hashtable viewControllers)
Changes pane configuration of the application.
|
void |
closeDialog()
Closes the current opened dialog.
|
void |
closeProgressWindow()
Closes the current progress window.
|
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 . |
boolean |
createTransitionStackController(com.softwareag.mobile.runtime.nui.nUIObject sender,
PaneConfiguration pc,
PaneDefinition pane,
AbstractViewController assignedAVC)
Override this method to disable the automatically creation of a
TransitionStackController.
|
boolean |
expandPaneToFullScreen(int paneId)
Expands the delivered pane to full screen and hides all other panes.
|
java.util.Hashtable |
getActiveViewAndControllerFromType(java.lang.String viewClassName)
Tries to find all
nUIViewDisplay 's which class names matches the
delivered String and returns a Hashtable containing the view as
key and the correspondent controller as value. |
PaneConfiguration |
getCurrentPaneConfig()
Returns the current used
PaneConfiguration . |
javax.microedition.lcdui.Image |
getDefaultPlaceHolderImage()
Return the default place holder image that will be used if requested
image was not found.
|
static AbstractApplicationController |
getInstance() |
com.softwareag.mobile.runtime.nui.nUIWindowDisplay |
getMainWindow()
Creates the main window if it does not exist and configures the window
with the start PaneConfiguration.
|
PaneDefinition |
getPaneDefinition(int paneId)
Returns the PaneDefinition which is correspondent to the delivered pane
id.
|
java.util.Hashtable |
getPaneToViewControllerMap()
By transition to a view, information about it's controller and target
pane is storing in this class.
|
com.softwareag.mobile.runtime.nui.nUIWindowDisplay |
getProgressWindow()
Returns the overlay window used to display progress indicators and making
sure the user can not interact with the main window.
|
SideViewControllerImpl |
getSideViewController()
Returns the
SideViewController for this application. |
abstract PaneConfiguration |
getStartPaneConiguration() |
int |
getTransitionFromStyle(com.softwareag.mobile.runtime.nui.nUIObject sender,
PaneConfiguration pc,
int pane)
Use this method to change transition effect by transition from the given
pane.
|
int |
getTransitionToStyle(com.softwareag.mobile.runtime.nui.nUIObject sender,
PaneConfiguration pc,
int pane)
Use this method to change transition effect by transition to the given
pane.
|
com.softwareag.mobile.runtime.nui.nUIViewDisplay |
getView(int pane) |
AbstractViewController |
getViewController(int pane) |
AbstractViewController |
getViewController(com.softwareag.mobile.runtime.nui.nUIViewDisplay view) |
boolean |
hidePane(int paneId)
Hides the delivered pane if it exists.
|
boolean |
isPaneVisible(int paneId)
Returns a boolean indicating if the delivered pane is existing and
visible.
|
javax.microedition.lcdui.Image |
loadImage(java.lang.String name)
Tries to find and load image with the given name.
|
javax.microedition.lcdui.Image |
loadImage(java.lang.String name,
int viewBackGroundcolor)
Tries to find and load image with the given name.
|
javax.microedition.lcdui.Image |
loadImage(java.lang.String name,
int viewBackGroundcolor,
int containerWidth)
Tries to find and load image with the given name.
|
java.lang.String |
loadWWWResource(com.softwareag.mobile.runtime.nui.nUIObject target,
java.lang.String fileName,
java.lang.String prefix,
java.lang.String encoding)
Deprecated.
use
loadWWWResource(String) or
loadWWWResource(String, String) Might be removed
with the next release. |
java.lang.String |
loadWWWResource(java.lang.String fileName)
Loads a resource from the default folder (resources/www) with the default
encoding (UTF-8) and returns the content of the given resource as String.
|
java.lang.String |
loadWWWResource(java.lang.String fileName,
java.lang.String encoding)
Loads a resource from the default folder (resources/www) with the given
encoding and returns the content of the given resource as String.
|
void |
onAlertDialogButtonPressed(AbstractAlertDialog dialog,
int buttonId)
This method will be called if a event occurs in given
AbstractAlertDialog . |
AbstractViewController |
onAssignView(com.softwareag.mobile.runtime.nui.nUIObject sender,
PaneConfiguration pc,
PaneDefinition pane,
AbstractViewController avcToAssign)
This callback can be used to change a view controller that will be used
to create a view for the given pane.
|
void |
onCreateWindow(com.softwareag.mobile.runtime.nui.nUIWindowDisplay window)
Delegate method to notify that the main window is created.
|
void |
onDeviceRegistered(java.lang.String newPushUID)
Will be called after the device is successfully registered to the
platform's push notification service.
|
void |
onOrientationChange()
Will be called after the user decides to change the device orientation.
|
void |
onPushNotification(java.lang.String message)
Deprecated.
Please implement #onPushNotification(String, Hashtable). Both
#onPushNotification() methods will be called if a push
notification receives.
|
void |
onPushNotification(java.lang.String message,
java.util.Hashtable extraParams)
Will be called when a push notification is received by the application.
|
void |
onPushNotificationError(java.lang.String errorMessage)
Will be called when a push notification results in an error.
|
void |
onSetupPaneDimension(com.softwareag.mobile.runtime.nui.nUIObject sender,
PaneConfiguration pc,
PaneDefinition pane)
This callback will be called after dimensions for the current pane are
calculated.
|
void |
onStartAppFromFile(java.lang.String mimeType,
java.lang.String absolutePath)
Will be called when the application is started by passing a file into the
application.
|
void |
onStartAppFromURL(java.lang.String scheme,
java.lang.String url)
Will be called when the application is started from an URI scheme it is
registered for.
|
void |
onViewCreated(com.softwareag.mobile.runtime.nui.nUIViewDisplay view,
AbstractViewController avc)
Each view controller calls this method immediately after it has created a
new view.
|
void |
onViewRemoved(com.softwareag.mobile.runtime.nui.nUIViewDisplay view)
If view was reset or a new view was created, the related view controller
calls this method.
|
void |
openDialog(AbstractAlertDialog dialog)
Shows the delivered dialog of no one is actually shown.
|
void |
openProgressWindow()
Opens the default progress window if no progress window is currently
shown.
|
void |
openProgressWindow(com.softwareag.mobile.runtime.nui.nUIViewDisplay view)
Opens the delivered view as a progress window if no progress window is
currently shown.
|
javax.microedition.lcdui.Image |
resizeImage(javax.microedition.lcdui.Image image,
int width,
int height)
Resize the given image.
|
boolean |
runningOnAndroid()
Returns a boolean value indicating if we are currently running on an
Android device.
|
boolean |
runningOnIOS()
Returns a boolean value indicating if we are currently running on an
iOS device.
|
boolean |
runningOnWin8()
Returns a boolean value indicating if we are currently running on an
Windows 8 device.
|
boolean |
runningOnWinPhone()
Returns a boolean value indicating if we are currently running on an
Windows Phone device.
|
void |
setDefaultPlaceHolderImage(javax.microedition.lcdui.Image defaultImage)
Sets the default
Image used as placeholder. |
void |
setView(com.softwareag.mobile.runtime.nui.nUIViewDisplay requestedView)
Sets the delivered
nUIViewDisplay by using
nUIController.TRANSITION_APPEAR as transition style. |
void |
setView(com.softwareag.mobile.runtime.nui.nUIViewDisplay requestedView,
int transition)
Sets the delivered
nUIViewDisplay and uses 0 as pane
id. |
void |
setView(com.softwareag.mobile.runtime.nui.nUIViewDisplay requestedView,
int transition,
int pane)
Initializes the transition to the delivered
nUIViewDisplay . |
void |
setViewController(AbstractViewController controller)
Sets the new AbstractViewController by using
nUIController.TRANSITION_APPEAR as transition style.
|
void |
setViewController(AbstractViewController controller,
int transition)
Sets the new AbstractViewController.
|
void |
setViewController(AbstractViewController controller,
int transition,
int pane)
Sets the new AbstractViewController and assigns the pane to the delivered
controller.
|
boolean |
showPane(int paneId)
Displays the delivered pane if it is existing.
|
void |
updatePaneDimensions()
Updates the dimension for all panes.
|
public static final int TRANSITION_STYLE_NOT_DEFINED
public static AbstractApplicationController getInstance()
public SideViewControllerImpl getSideViewController()
SideViewController
for this application.
It is a singleton and only created, if this method is called. Clients
need to overwrite createSideViewController()
to pass a custom
instance.
public void onAlertDialogButtonPressed(AbstractAlertDialog dialog, int buttonId)
IDialogDelegate
AbstractAlertDialog
.onAlertDialogButtonPressed
in interface IDialogDelegate
dialog
- The AbstractAlertDialog
containing the button.buttonId
- The id of the triggered button as modeled with the editor.public java.util.Hashtable getPaneToViewControllerMap()
Returns all active controllers.
Hashtable
with pane id as key and
AbstractViewController
as value.public PaneConfiguration getCurrentPaneConfig()
PaneConfiguration
.public void onViewCreated(com.softwareag.mobile.runtime.nui.nUIViewDisplay view, AbstractViewController avc)
view
- just created viewavc
- AbstractViewController
, which created the view.public void onViewRemoved(com.softwareag.mobile.runtime.nui.nUIViewDisplay view)
view
- obsolete viewpublic AbstractViewController getViewController(com.softwareag.mobile.runtime.nui.nUIViewDisplay view)
view
- the given viewAbstractViewController
for the given view if it exists or
null if the view was created not with a controller.public AbstractViewController getViewController(int pane)
pane
- pane idAbstractViewController
for the given pane or null if
there is no view created by a controller was assigned to the
given panepublic com.softwareag.mobile.runtime.nui.nUIViewDisplay getView(int pane)
pane
- pane idnUIViewDisplay
assigned to the given pane or null.public abstract PaneConfiguration getStartPaneConiguration()
public com.softwareag.mobile.runtime.nui.nUIWindowDisplay getMainWindow()
createMainWindow()
or
onCreateWindow(nUIWindowDisplay)
to adapt the window to their
needs.getStartPaneConiguration()
,
changePaneConfiguration(nUIObject, PaneConfiguration,
IPaneConfigDelegate, Hashtable)
public com.softwareag.mobile.runtime.nui.nUIWindowDisplay getProgressWindow()
openProgressWindow()
,
openProgressWindow(nUIViewDisplay)
,
closeProgressWindow()
public void changePaneConfiguration(com.softwareag.mobile.runtime.nui.nUIObject sender, PaneConfiguration pc, IPaneConfigDelegate delegate, java.util.Hashtable viewControllers)
sender
- This parameter is optional. The native UI object that caused
the callpc
- a new pane configurationdelegate
- This parameter is optional. Use this delegate
to
change default behavior.viewControllers
- This parameter is optional. Pass a Hashtable
with
controllers to alternate settings in the model. Expected keys
are pane ids, values - abstract view controllers.public void setViewController(AbstractViewController controller)
setViewController(AbstractViewController, int)
.controller
- setViewController(AbstractViewController, int)
public void setViewController(AbstractViewController controller, int transition)
setViewController(AbstractViewController, int, int)
. Uses as
AbstractViewController.getWindowPane()
as pane id.controller
- transition
- setViewController(AbstractViewController, int, int)
public void setViewController(AbstractViewController controller, int transition, int pane)
setView(nUIViewDisplay, int, int)
to do
the transition.controller
- transition
- pane
- setView(nUIViewDisplay, int, int)
public void setView(com.softwareag.mobile.runtime.nui.nUIViewDisplay requestedView)
nUIViewDisplay
by using
nUIController.TRANSITION_APPEAR as transition style. Delegates to
setView(nUIViewDisplay, int)
.requestedView
- setView(nUIViewDisplay, int)
public void setView(com.softwareag.mobile.runtime.nui.nUIViewDisplay requestedView, int transition)
nUIViewDisplay
and uses 0
as pane
id. Delegates to setView(nUIViewDisplay, int, int)
.requestedView
- transition
- setView(nUIViewDisplay, int, int)
public void setView(com.softwareag.mobile.runtime.nui.nUIViewDisplay requestedView, int transition, int pane)
nUIViewDisplay
. Calls
AbstractViewController.onTransitionFrom()
and
AbstractViewController.onTransitionTo()
as delegates. Uses
getViewController(nUIViewDisplay)
to fetch the views controller.
If not set, the default transition style is
nUIController.TRANSITION_APPEAR.
Calls nUIWindowDisplay.transitionFrom(nUIViewDisplay)
and
nUIWindowDisplay.transitionTo(nUIViewDisplay)
under the hood.
For Android devices, checks if the views header must be added.
After performing the transition, we'll iterate about all panes to check if a SideView should be displayed or not.
requestedView
- transition
- pane
- public boolean expandPaneToFullScreen(int paneId)
paneId
- public boolean isPaneVisible(int paneId)
paneId
- public boolean showPane(int paneId)
paneId
- updatePaneDimensions()
public boolean hidePane(int paneId)
paneId
- updatePaneDimensions()
public PaneDefinition getPaneDefinition(int paneId)
paneId
- public void updatePaneDimensions()
public void onOrientationChange()
updatePaneDimensions()
public void onPushNotification(java.lang.String message)
This delegate will only be called if you enabled push notifications for your application.
message
- public void onPushNotification(java.lang.String message, java.util.Hashtable extraParams)
This delegate will only be called if you enabled push notifications for your application.
message
- extraParams
- public void onPushNotificationError(java.lang.String errorMessage)
This delegate will only be called if you enabled push notifications for your application.
errorMessage
- public void onDeviceRegistered(java.lang.String newPushUID)
Depending on the platform, the newPushUID
represents the
following id:
Overwrite this method to do a further registration, e.g. to register the
newPushUID
to Mobile Administrator.
This delegate will only be called if you enabled push notifications for your application.
newPushUID
- public void onStartAppFromFile(java.lang.String mimeType, java.lang.String absolutePath)
mimeType
- the mime type of the fileabsolutePath
- the absolute path to the filepublic void onStartAppFromURL(java.lang.String scheme, java.lang.String url)
scheme
- the custom URI scheme the application is usingurl
- the complete URL the application was started withpublic void onCreateWindow(com.softwareag.mobile.runtime.nui.nUIWindowDisplay window)
window
- public void openDialog(AbstractAlertDialog dialog)
nUIController.transitionTo(nUIWindowDisplay)
.dialog
- nUIController.transitionTo(nUIWindowDisplay)
public void closeDialog()
nUIController.transitionFrom(nUIWindowDisplay)
.nUIController.transitionFrom(nUIWindowDisplay)
public void openProgressWindow(com.softwareag.mobile.runtime.nui.nUIViewDisplay view)
nUIWindowDisplay
and assigns the delivered view
to it. Uses -1
as NUIID for the created window. Also calls
AbstractViewController.onTransitionTo()
if the view has a
registered controller.view
- getViewController(nUIViewDisplay)
,
nUIController.transitionTo(nUIWindowDisplay)
public void openProgressWindow()
nUIViewDisplay
with a nUIProgressanimElement
assigned.
-1
as NUIID for all created elements.nUIController.transitionTo(nUIWindowDisplay)
public void closeProgressWindow()
nUIViewDisplay
, tries
to find the correspondent AbstractViewController
and calls
AbstractViewController.onTransitionFrom()
and
AbstractViewController.resetView()
if the controller exists.AbstractViewController.onTransitionTo()
,
AbstractViewController.resetView()
,
nUIController.transitionFrom(nUIWindowDisplay)
public java.util.Hashtable getActiveViewAndControllerFromType(java.lang.String viewClassName)
nUIViewDisplay
's which class names matches the
delivered String and returns a Hashtable
containing the view as
key and the correspondent controller as value.viewClassName
- public AbstractViewController onAssignView(com.softwareag.mobile.runtime.nui.nUIObject sender, PaneConfiguration pc, PaneDefinition pane, AbstractViewController avcToAssign)
IPaneConfigDelegate
PaneDefinition#getStartView()
controller will be applied.onAssignView
in interface IPaneConfigDelegate
sender
- object that caused the PaneConfiguration
changing.pc
- a PaneConfiguration
, which is being activated.pane
- current PaneDefinition
. (The most important
information for this callback is paneId).avcToAssign
- AbstractViewController
, that will be used to create a
view for current pane.new MasterViewControllerImpl()
public void onSetupPaneDimension(com.softwareag.mobile.runtime.nui.nUIObject sender, PaneConfiguration pc, PaneDefinition pane)
IPaneConfigDelegate
AbstractPane.getPaneRect()
method. However it can cause pane
overlapping.onSetupPaneDimension
in interface IPaneConfigDelegate
public boolean createTransitionStackController(com.softwareag.mobile.runtime.nui.nUIObject sender, PaneConfiguration pc, PaneDefinition pane, AbstractViewController assignedAVC)
IPaneConfigDelegate
createTransitionStackController
in interface IPaneConfigDelegate
assignedAVC
- view controller that was assigned for this pane.TransitionStackController
for
this pane and false otherwise.public int getTransitionFromStyle(com.softwareag.mobile.runtime.nui.nUIObject sender, PaneConfiguration pc, int pane)
IPaneConfigDelegate
getTransitionFromStyle
in interface IPaneConfigDelegate
nUIController#TRANSITION_*
public int getTransitionToStyle(com.softwareag.mobile.runtime.nui.nUIObject sender, PaneConfiguration pc, int pane)
IPaneConfigDelegate
getTransitionToStyle
in interface IPaneConfigDelegate
nUIController#TRANSITION_*
public java.lang.String loadWWWResource(java.lang.String fileName) throws FileNotFoundException, java.io.UnsupportedEncodingException
fileName
- the file to load. Must not contain any subfolders!FileNotFoundException
- if the resource can not be foundjava.io.UnsupportedEncodingException
- if the given encoding does not exist/workpublic java.lang.String loadWWWResource(java.lang.String fileName, java.lang.String encoding) throws FileNotFoundException, java.io.UnsupportedEncodingException
fileName
- the file to load. Must not contain any subfolders!encoding
- the encoding that should be used to read the content.FileNotFoundException
- if the resource can not be foundjava.io.UnsupportedEncodingException
- if the given encoding does not exist/workpublic java.lang.String loadWWWResource(com.softwareag.mobile.runtime.nui.nUIObject target, java.lang.String fileName, java.lang.String prefix, java.lang.String encoding)
loadWWWResource(String)
or
loadWWWResource(String, String)
Might be removed
with the next release.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 void setDefaultPlaceHolderImage(javax.microedition.lcdui.Image defaultImage)
Image
used as placeholder.defaultImage
- 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 javax.microedition.lcdui.Image loadImage(java.lang.String name)
IResourceController
IResourceController.loadImage(String, int, int)
for more details.loadImage
in interface IResourceController
public javax.microedition.lcdui.Image loadImage(java.lang.String name, int viewBackGroundcolor)
IResourceController
IResourceController.loadImage(String, int, int)
for more details.loadImage
in interface IResourceController
public javax.microedition.lcdui.Image loadImage(java.lang.String name, int viewBackGroundcolor, int containerWidth)
IResourceController
#defaultPlaceHolderImage
will be returned. Following paths
are used for searching in the given ordering:
AbstractApplicationController#getAndroidGraphicsFolder(int, int)
AbstractApplicationController#getBlackBerryGraphicsFolder(int, int, int)
AbstractApplicationController#getIOSGraphicsFolders(int, int)
AbstractApplicationController#getWinPhoneGraphicFolder(int, int, int)
see also
AbstractApplicationController#getWinPhoneThemeFolder(int)
AbstractApplicationController#getGeneralGraphicsFolder(int, int)
loadImage
in interface IResourceController
name
- filename to loadviewBackGroundcolor
- background color of view, where image will be showncontainerWidth
- width of container, where image will be shown. if value is -1,
then the smallest side of screen will used as containerWidthpublic boolean runningOnAndroid()
public boolean runningOnIOS()
public boolean runningOnWinPhone()
public boolean runningOnWin8()
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.nuiid
- text
- type
- icon
-