Show TOC

Creating Actions and Implementing NavigationLocate this document in the navigation structure

Context

To navigate from one view to the next, you need an appropriate action, which you bind to a UI element event (such as a button's event onAction ). You then need to implement the event handler, which reacts to this action and triggers a view change by calling an outbound plug.

Procedure

  1. To navigate to the view editor for the first view, double-click the WelcomeCompView in the graphical tool or the corresponding node in project structure.
  2. In the Properties view, choose the Actions tab.
  3. Click on the "+" icon in the Actions tab.
  4. Choose the New... pushbutton.

    You can create a new action in the wizard that appears.

  5. Enter the name Go for this new action. In the field Text enter Go for the text to be displayed on all UI-elements with events bound to this action. Leave the Event Handler option unchanged. Assign the plug Out as a Fire Plug and choose Finish.

    The new action, Go, and its associated event handler onActionGo are displayed in the list of actions.

Results

You have created the Go action. The implementation of the navigation is automatically inserted into the associated event handler.

To check the generated source code for event handler onActionGo() , open the Java Editor for the Welcome Comp View.java class.

public void onActionGo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionGo(ServerEvent)

wdThis.wdFirePlugOut();

//@@end

}

To trigger navigation from the Welcome Comp View to the ResultView using the outbound plug Out , the application calls the outbound plug method wdFirePlugOut(). The predefined private variable wdThis is used for this method call. The wdThis variable is always required whenever you make method calls to the view controller's private interface IPrivate<Name_of_View>.

In a subsequent step, you must only assign these actions to the appropriate buttons in the view layout and the navigation part of your sample application will be completely defined.