Mobile Development 10.11 | webMethods Mobile SuiteWeb Help | webMethods Mobile Designer Native User Interface Reference | Mobile Designer Native User Interface | Transitioning Between Windows and Views
 
Transitioning Between Windows and Views
An application initially displays a window. Once a window is displayed, to display a view within a window or display another window, the application needs to perform a transition to the new location. Mobile Development handles this automatically. But it can also be coded using the following methods and classes.
*To transition to a new view within a window, use the transitionTo and transitionFrom methods in the nUIWindowDisplay class.
*To transition to a new window, use the nUIController class.
For more information about the nUIWindowDisplay and nUIController classes, see webMethods Mobile Designer Java API Reference.
The following code sample shows how to use the transitionTo and transitionFrom methods in an application:
private void transitionToView(nUIViewDisplay new_view, int pane)
{
int transition = nUIController.TRANSITION_APPEAR;
nUIViewDisplay old_view = main_view;
if (old_view != null)
{
if(old_view.nuiid < new_view.nuiid)
transition = nUIController.TRANSITION_LEFT;
else if(old_view.nuiid > new_view.nuiid)
transition = nUIController.TRANSITION_RIGHT;
main_window.transitionFrom(old_view,transition, pane);
}  
main_window.add(new_view);
main_window.transitionTo(new_view, transition, pane);
main_view = new_view;
}
The code sample illustrates how to replace a window’s current view with a new one by:
1. Using the transitionFrom method to transition away from the current view.
2. Using the add method to add the new view to the window.
3. Using the transitionTo method to transition to the newly added view.
The code sample uses a view’s unique identifier to determine the transition direction (either TRANSITION_LEFT or TRANSITION_RIGHT). If the new view has a lower unique identifier, the code transitions one way. If the new view has a higher unique identifier, it transitions the other way. This transition logic represents only one approach. There are other transition logic approaches that you can use to meet the requirements of your mobile application.
The NativeUI systems supports the following transition properties that are defined in the com.softwareag.mobile.runtime.nui.nUIController class:
*TRANSITION_APPEAR
*TRANSITION_FADE
*TRANSITION_LEFT
*TRANSITION_RIGHT
*TRANSITION_UP
*TRANSITION_DOWN
All platforms support the TRANSITION_APPEAR property. However, platforms might substitute alternative solutions for the other nUIController class transition properties.