Creating Navigation Transitions
You have to define the runtime behavior of the application regarding navigation transitions between individual view assemblies in a separate step. The navigation transition occurs at runtime when an outbound plug in an action event handler of the view controller is triggered. There are two steps:
● Action event handler calls outbound plug (programmatic)
● Outbound plug traces navigation links (declarative)
This indirection during the trigger process of the navigation transition ensures that navigation transitions can be subsequently modified in a purely declarative way without having to change the source code. The method call that triggers the outbound plug remains unchanged in the source code.
1. You have declared the View composition in the Quiz window.
2. In the Component Interface View QuizInterfaceView, you have defined an exit plug called GotoUrl, together with parameter Url of type String.
A navigation transition is usually triggered when the user selects a button. You need to do the following:
...
1. Define an action event with a template assistant (already completed in the previous section)
2. Assign the action event to the onAction event of the Button UI element. This step is performed in the Properties view (already completed in the previous section)
3. Programmatically trigger the outbound plug (which has at least one navigation link) in an action event handler of the view controller.
The Web Dynpro generator automatically implements the event handler for the onAction event in the individual view controllers for triggering outbound plugs, because you previously selected the corresponding outbound plugs in the Fire Plug checkbox in the Action wizard.
A method call triggers the corresponding outbound plug, which contains the actual navigation link.
The implementation of the action event onActionStartPressed in the Welcome view for triggering the outbound plug StartQuizOut has been extended by the Web Dynpro generator, as follows:
/** declared validating event handler */ public void onActionStartPressed( com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ) { //@@begin onActionStartPressed(ServerEvent) wdThis.wdFirePlugStartQuizOut(); //@@end } |
The user should be able to terminate the Web Dynpro application in the Welcome view. This requires triggering of the exit plug that is defined in the interface view. To be able to trigger the exit plug, the controller of the interface view must be defined as the required controller in the Welcome view.
...
1. Open the Welcome view in View Designer and select the Properties tab. Choose the Add button next to the Required Controllers table and add the QuizInterfaceView controller.
2. Select the Implementation tab and add the following source code for the onActionExitPressed event handler:
/** declared validating event handler */ public void onActionExitPressed( com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ) { //@@begin onActionExitPressed(ServerEvent) wdThis.wdGetQuizInterfaceViewController() .wdFirePlugGotoUrl("http://www.sap.com"); //@@end } |

You can only call method wdFirePlugGotoUrl(String Url) in the controller coding if you have previously defined an exit plug called GotoUrl, together with the string parameter Url, as defined in the section Implementing the View Composition.
Once you have triggered the GotoUrl exit plug, the Web Dynpro application closes. This also ends the user session.
You have defined action events, bound them to buttons, and used the corresponding outbound plug methods for the programmatic triggering of the navigation transitions.
You can now observe the runtime behavior of the application at the current development state:
...
1. Choose Rebuild Project for your Web Dynpro project.
2. In context menu in Web Dynpro application QuizApp, choose Deploy new archive and run.
The next section is about controller contexts
and data binding.