Building Mobile Enterprise Applications : webMethods Mobile Development Help : Creating Application Logic : About the TransitionStackController
About the TransitionStackController
Mobile Development provides a Java class named TransitionStackController.java in the gen.api-src/com.softwareag.mobile.runtime.toolkit.ui.controller package. Unless you override the use of TransitionStackController.java, applications you create using Mobile Development use the logic in TransitionStackController.java at run time to:
*Add Back buttons to views when the application creates a view.
*Set the text that displays on Back buttons to display the header text from the previous view.
*Transition to the previous view when a user presses the Back button.
A TransitionStackController keeps track of the view displayed in each pane of the application’s window and each NavButton object in a NavView object. It keeps track by pushing view controllers on to a controller stack. For example, as an application transitions the views in a pane from one view to the next, the TransitionStackController pushes the new controller onto the controller stack. As a result, when the user presses the Back button, it pops the controller for a view from the controller stack and transitions to that view.
In the Java sources that Mobile Development generates, TransitionStackController.java is imported into the abstract controller for each view. For example, if you have a view named DetailView, TransitionStackController.java is imported into AbstractDetailViewController.java. As a result, you can use the methods of TransitionStackController.java to customize the use of the TransitionStackController in the logic that you code for a view. For example you can push new controllers on to the controller stack, remove the last controller from the controller stack, or force the controller stack to go to the first controller pushed on the stack. For more information about Java sources generated for your Mobile Project, see Java Sources that Mobile Development Generates.
If you do not want to use the TransitionStackController for a mobile application, you can disable it. However, if you disable the TransitionStackController you will need to add application logic to handle transitions back to previous views. To prevent the use of the TransitionStackController, override the createTransitionStackController() method, which is in AbstractApplicationController.java in the gen.api-src.com.softwareag.mobile.runtime.toolkit package. To override this method, add the createTransitionStackController() method to the application_nameControllerImpl.java file that Mobile Development generates in the src.package_name.ui.controller.impl package. For example, for a Mobile Project if you assigned the application the name “MyApp” and the package name “com.mycompany”, you add the createTransitionStackController() method to MyAppControllerImpl.java in the src.com.mycompany.ui.controller.impl package. The following shows sample code. Note that this code sample assumes a view named “MyView” exists.
public boolean createTransitionStackController(nUIObject sender,
PaneConfiguration pc,
PaneDefinition pane,
AbstractViewController assignedAVC) {
if (assignedAVC instanceof MyViewControllerImpl) {
return false;
}
return true;
}
Copyright © 2007-2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback