public class TransitionStackController extends AbstractViewController
TransitionStackController
to easily create workflows in your
application.
The TransitionStackController
manages a stack of
AbstractViewController
implementations and provides a set of methods
to automatically handle transitions between the view controllers in it's
stack hierarchy. To transition from one AbstractViewController
to another AbstractViewController
, just use
pushViewController(AbstractViewController)
or
popViewController()
, etc.
A TransitionStackController
itself is also an
AbstractViewController
subclass. This enables you to nest
TransitionStackController
s into another, for example to create
sub workflows. By using popToRootViewController()
you can always go
back to the first AbstractViewController
of the top
TransitionStackController
in your stack hierarchy.
Use AbstractViewController.getTransitionStackController()
to get the
TransitionStackController
managing the view controller. In an
AbstractViewController
implementation use this
TransitionStackController
to transition to another
AbstractViewController
.
When transitioning between two AbstractViewController
s,
TransitionStackController
uses the IViewController
interface to notify AbstractViewController
s about the current
state of it's transition. When transitioning a
AbstractViewController
on to the screen,
IViewController.onTransitionTo()
will be called on the
AbstractViewController
that is about to appear on screen. The
AbstractViewController
transitioned off the screen will get a
IViewController.onTransitionFrom()
notification. This way
AbstractViewController
implementations can execute whatever
logic needed before tranistion on or off the screen. Typically you customize
the view of an AbstractViewController
before displayed or save
the state of a view for later recovery.
Constructor and Description |
---|
TransitionStackController(AbstractViewController rootViewController)
Creates a new
TransitionStackController with the given
AbstractViewController as its root. |
TransitionStackController(AbstractViewController rootViewController,
int pane,
int transition)
Creates a new
TransitionStackController with the given
AbstractViewController as its root. |
Modifier and Type | Method and Description |
---|---|
void |
addBackButton()
This method is called to creat and add a back button as part of the
IViewController implementation. |
com.softwareag.mobile.runtime.nui.nUIViewDisplay |
createView()
Creates a new instance of the
nUIViewDisplay subclass managed by this
IViewController implementation. |
AbstractViewController |
getTopViewController()
Returns the top
AbstractViewController s of the stack hierarchy. |
java.util.Vector |
getViewControllers()
Returns the full stack hierarchy of
AbstractViewControllers |
com.softwareag.mobile.runtime.nui.nUIViewDisplay |
getViewDisplay()
Returns the
nUIViewDisplay instance managed by this
IViewController implementation. |
boolean |
hidesBackButton()
Returns
true if this IViewController implementation
hides the back button even if it is not the first view controller in the
TransitionStackController stack hierarchy. |
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 |
popToRootViewController()
Removes all
AbstractViewController from the stack hierarchy back to
the root (first) AbstractViewController in the stack. |
void |
popToRootViewController(boolean animated)
Removes all
AbstractViewController from the stack hierarchy back to
the root (first) AbstractViewController in the stack. |
void |
popToRootViewController(int transition)
Removes all
AbstractViewController from the stack hierarchy back to
the root (first) AbstractViewController in the stack. |
void |
popToViewController(AbstractViewController vc)
Removes all
AbstractViewController from the stack hierarchy back to
the AbstractViewController instance provided as argument. |
void |
popToViewController(AbstractViewController vc,
boolean animated)
Removes all
AbstractViewController from the stack hierarchy back to
the AbstractViewController instance provided as argument. |
void |
popToViewController(AbstractViewController vc,
int transition)
Removes all
AbstractViewController from the stack hierarchy back to
the AbstractViewController instance provided as argument. |
void |
popViewController()
Removes the top
AbstractViewController from the stack hierarchy. |
void |
popViewController(boolean animated)
Removes the top
AbstractViewController from the stack hierarchy. |
void |
popViewController(int transition)
Removes the top
AbstractViewController from the stack hierarchy. |
void |
pushViewController(AbstractViewController controller)
Pushes an
AbstractViewController on top of the stack hierarchy and
transitions it on the screen. |
void |
pushViewController(AbstractViewController controller,
boolean animated)
Pushes an
AbstractViewController on top of the stack hierarchy. |
void |
pushViewController(AbstractViewController controller,
int transition)
Pushes an
AbstractViewController on top of the stack hierarchy and
transitions it on the screen using a given transition type. |
void |
resetView()
Removes reference to the view and destroys it.
|
void |
setWindowPane(int pane)
The integer identifier of the pane will be set automatically using this
method by
TransitionStackController or by
AbstractApplicationController . |
bind, bind, bind, bind, bind, createNavButton, createNavButton, createSearchNavButton, getBackButtonText, getDefaultPlaceHolderImage, getMappedTransitionStackControllers, getTransitionStackController, getWindowPane, hasSideView, initBindings, loadImage, loadImage, loadImage, loadWWWResource, onBackButtonEvent, onDialogButtonPressed, onUISynced, resizeImage, setTransitionStackController, showDialogButton, stackTransition, transition
public TransitionStackController(AbstractViewController rootViewController)
TransitionStackController
with the given
AbstractViewController
as its root. When calling
popToRootViewController()
, TransitionStackController
will transition back to given root AbstractViewController.
@param rootViewController the root AbstractViewController of the
TransitionStackController
s stack hierarchy.
public TransitionStackController(AbstractViewController rootViewController, int pane, int transition)
TransitionStackController
with the given
AbstractViewController
as its root. By providing a pane ID, the
TransitionStackController
will be do all transitions on the pane
provided. By specifying a transition type you can also control how the
AbstractViewController
is transitioned on the pane provided.rootViewController
- the root AbstractViewController of the
TransitionStackController
s stack hierarchy.
pane
- the ID of the pane the
TransitionStackController
will use for
transitions.transition
- the transition type to use for the initial
transition on the panepublic void pushViewController(AbstractViewController controller)
AbstractViewController
on top of the stack hierarchy and
transitions it on the screen. If it is the first
AbstractViewController
on the stack, the
nUIController.TRANSITION_APPEAR
will be used for transitioning,
otherwise TransitionStackController
will automatically choose
the best transition based on platform and app directionality. The
AbstractViewController
currently on the screen will be
transitioned off.
After the AbstractViewController
and its view are created, but
before it is transitioned to the screen,
IViewController.onTransitionTo()
will be called. For the
AbstractViewController
transitioned off
IViewController.onTransitionFrom()
is called just before the
transition.
controller
- the new AbstractViewController
to transition
on screen.public void pushViewController(AbstractViewController controller, int transition)
AbstractViewController
on top of the stack hierarchy and
transitions it on the screen using a given transition type. Use this method
to overwrite the default transition style of
pushViewController(AbstractViewController)
.controller
- the new AbstractViewController
to transition
on screen.transition
- the ID of the transition to use. Check
nUIController
constants for supported transition
styles and it's IDs.pushViewController(AbstractViewController)
public void pushViewController(AbstractViewController controller, boolean animated)
AbstractViewController
on top of the stack hierarchy. By
setting the animated
argument to false, always
nUIController.TRANSITION_APPEAR
will be used, if true
TransitionStackController
will choose the transition type
automatically based on the platform and app directionality. This method
overwrites the default transition style of
pushViewController(AbstractViewController)
controller
- the new AbstractViewController
to transition
on screen.animated
- true
if the transition should animate,
false
if the
AbstractViewController
should just appear on
screen without any animationpushViewController(AbstractViewController)
public void popViewController()
AbstractViewController
from the stack hierarchy. The
top AbstractViewController
is most likely the one currently
visible on the screen. When removed from the stack hierarchy, the popped
AbstractViewController
will be automatically transitioned off
and the previous AbstractViewController
in the stack hierarchy
will be transitioned back on to the screen.
When popped from stack hierarchy and transitioned off the screen
IViewController
onTransitionFrom()
is called just before the
transition.
Using this method, the transition will be chosen automatically depending on the platform and the app directionality.
public void popViewController(int transition)
AbstractViewController
from the stack hierarchy. Use
this method to overwrite the default transition style used by
popViewController()
.transition
- the ID of the transition to use. Check
nUIController
constants for supported transition
styles and it's IDs.popViewController()
public void popViewController(boolean animated)
AbstractViewController
from the stack hierarchy.
Using this method, the transition will be chosen automatically depending on
the platform and the app directionality if the animated
argument
is true
. If not using animation,
nUIController.TRANSITION_APPEAR
will be used.animated
- true
if the transition should animate,
false
if the AbstractViewController
should just appear on screen without any animationpopViewController()
public void popToRootViewController()
AbstractViewController
from the stack hierarchy back to
the root (first) AbstractViewController
in the stack. When
removed from the stack hierarchy, the currently visible
AbstractViewController
will be automatically transitioned off
and the root AbstractViewController
in the stack hierarchy will
be transitioned back on to the screen. All
AbstractViewController
in between the current and root
AbstractViewController
will be removed from stack hierarchy.
When popped from stack hierarchy and transitioned off the screen
IViewController
onTransitionFrom()
is called for the current
top AbstractViewController
just before the transition. For the
root AbstractViewController
that will be transitioned back on to
the screen IViewController.onTransitionTo()
will be called.
Using this method, the transition will be chosen automatically depending on the platform and the app directionality.
public void popToRootViewController(int transition)
AbstractViewController
from the stack hierarchy back to
the root (first) AbstractViewController
in the stack. Use this
method to overwrite the default transition style of
popToRootViewController()
.transition
- the ID of the transition to use. Check
nUIController
constants for supported transition
styles and it's IDs.popToRootViewController()
public void popToRootViewController(boolean animated)
AbstractViewController
from the stack hierarchy back to
the root (first) AbstractViewController
in the stack. Using this
method, the transition will be chosen automatically depending on the platform
and the app directionality if the animated
argument is
true
. If not using animation,
nUIController.TRANSITION_APPEAR
will be used.animated
- true
if the transition should animate,
false
if the AbstractViewController
should just appear on screen without any animationpopToRootViewController()
public void popToViewController(AbstractViewController vc)
AbstractViewController
from the stack hierarchy back to
the AbstractViewController
instance provided as argument. If
vc
is not in the stack hierarchy,
TransitionStackController
will just skip and do nothing.
When removed from the stack hierarchy, the currently visible
AbstractViewController
will be automatically transitioned off
and the given AbstractViewController
will be transitioned back
on to the screen. All AbstractViewController
in between the
current and given AbstractViewController
will be removed from
stack hierarchy.
When popped from stack hierarchy and transitioned off the screen
IViewController
onTransitionFrom()
is called for the current
top AbstractViewController
just before the transition. For the
root AbstractViewController
that will be transitioned back on to
the screen IViewController.onTransitionTo()
will be called.
Using this method, the transition will be chosen automatically depending on the platform and the app directionality.
vc
- the AbstractViewController
instance of the stack
hierarchy to transition to.public void popToViewController(AbstractViewController vc, int transition)
AbstractViewController
from the stack hierarchy back to
the AbstractViewController
instance provided as argument. Use
this method to overwrite the default transition style of
popToViewController(AbstractViewController)
vc
- the AbstractViewController
instance of the
stack hierarchy to transition to.transition
- the ID of the transition to use. Check
nUIController
constants for supported transition
styles and it's IDs.popToViewController(AbstractViewController)
public void popToViewController(AbstractViewController vc, boolean animated)
AbstractViewController
from the stack hierarchy back to
the AbstractViewController
instance provided as argument. Using
this method, the transition will be chosen automatically depending on the
platform and the app directionality if the animated
argument is
true
. If not using animation,
nUIController.TRANSITION_APPEAR
will be used.vc
- the AbstractViewController
instance of the stack
hierarchy to transition to.animated
- true
if the transition should animate,
false
if the AbstractViewController
should just appear on screen without any animationpopToViewController(AbstractViewController)
public java.util.Vector getViewControllers()
AbstractViewControllers
AbstractViewController
in the stack hierarchypublic AbstractViewController getTopViewController()
AbstractViewController
s of the stack hierarchy. This
is the AbstractViewController
usually visible on the sreen.AbstractViewController
in the stack hierarchypublic com.softwareag.mobile.runtime.nui.nUIViewDisplay getViewDisplay()
IViewController
Returns the nUIViewDisplay
instance managed by this
IViewController
implementation.
nUIViewDisplay
instance associated with this
controller.#createView()}
public com.softwareag.mobile.runtime.nui.nUIViewDisplay createView()
IViewController
Creates a new instance of the nUIViewDisplay
subclass managed by this
IViewController
implementation. Overwrite this method if you
want to be notified when a view is created or if you need to do any changes
programmatically at runtime.
If you want to get the IViewController
managing a given view,
use AbstractApplicationController.getViewController(nUIViewDisplay)
IViewController
public void resetView()
IViewController
Removes reference to the view and destroys it.
resetView
in interface IViewController
resetView
in class AbstractViewController
#createView()}
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 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 onShowView()
IViewController
AbstractApplicationController.showPane(int)
triggers this call.onShowView
in interface IViewController
onShowView
in class AbstractViewController
public void onHideView()
IViewController
AbstractApplicationController.hidePane(int)
triggers this call.onHideView
in interface IViewController
onHideView
in class AbstractViewController
public boolean hidesBackButton()
IViewController
Returns true
if this IViewController
implementation
hides the back button even if it is not the first view controller in the
TransitionStackController
stack hierarchy.
Overwrite to change the default behavior of adding back buttons. To customize
the back button overwrite IViewController.addBackButton()
. If you are not using
TransitionStackController
, use IViewController.addBackButton()
to add
back buttons programmatically.
true
if the back button should not be addedTransitionStackController}
public void addBackButton()
IViewController
This method is called to creat and add a back button as part of the
IViewController
implementation. The default implementation in
AbstractViewController
, based on TransitionStackController
,
uses the header text of the previous AbstractViewController
in the
stack hierarchy. If there is no header text to be used, BACKBUTTON_DEFAULT
value from the language text resources will be loaded and used.
public void setWindowPane(int pane)
IViewController
TransitionStackController
or by
AbstractApplicationController
. This value is accessible by
IController.getWindowPane()
setWindowPane
in interface IViewController
setWindowPane
in class AbstractViewController
pane
- integer identifier of pane defined in Constants