Show TOC Start of Content Area

Object documentation View Controller Class Reference  Locate the document in its SAP Library structure

This reference for view controller classes comprises specific additions to the Common Controller Class Reference.

Naming Convention

The name of a view controller class is based on the view name. View names should end with the suffix View.

Lifespan

Creation

A view controller instance is automatically created by the Web Dynpro Java Runtime as soon as the associated view is part of the current view assembly.

Destruction

When a component instance is destroyed all contained view controllers naturally get destroyed too.

In case the embedding component instance is not destroyed the destruction of a view controller depends on the Lifespan property definition:

      Lifespan = Framework controlled: When the view disappears from the view compostion based on a navigation step the Web Dynpro Runtime does not destroy the view controller. When the view afterwards reappears in the view assembly the view controller is still alive and gets not initialized again. Consequently the wdDoInit() hook method is not called by the Web Dynpro Runtime again.

      Lifespan = When visible: When the view disappears from the view compostion based on a navigation step the Web Dynpro Runtime automatically destroys the view controller. When the view afterwards reappears in the view assembly a new view controller instance is created and the wdDoInit() hook method is called by the Web Dynpro Runtime again.

Special Methods

Predefined Hook Methods

 

public void wdDoBeforeAction(
  com.sap.tc.webdynpro.progmodel.api.IWDBeforeAction validation)

Hook method called for additional validation of user input.  The parameter validation is an interface for reporting validation errors.

 

public static void wdDoModifyView(
  IPrivateSampleView wdThis,
  IPrivateSampleView.IContextNode wdContext,
  com.sap.tc.webdynpro.progmodel.api.IWDView view,
 
boolean firstTime)

Hook method called to modify a view layout just before rendering. It is designed for the creation of a UI tree or UI sub-tree at runtime in case it is not possible to declare the UI at design time.

This graphic is explained in the accompanying text 

The Web Dynpro programming model recommends that UI elements can only be accessed by code executed within the call to this hook method.

The method is neither intended for fine grain UI manipulations nor for context manipulations. Fine grained UI manipulations are achieve via data binding that means via setting context attributes. Context manipulations are done in wdDoInit, action event handlers or event handlers.

Predefined Context Menu Event Handler

 

public void wdOnContextMenu(
 
final IWDContextMenuManager contextMenuManager,
 
final IWDContextMenuEvent event)

Service event handler for context menu events. It is called by the Web Dynpro Runtime when the user triggers the event for opening a context menu.

The handler method has two input parameters for invoking the following Web Dynpro APIs:

The IWDContextMenuManager-API passed to the context menu event handler provides methods to create, destroy and access menus, to access the context menu provided for the current event and to create menu items without using the generic factory method createElement() from the IWDView-API.

The IWDContextMenuEvent-API provides information about the context of the menu: the menu originator of the event (view element where the user has clicked), the menu provider (view element that provides a context menu, if any) and the node element describing the scope of the originator e.g. inside a table row.

This graphic is explained in the accompanying text
The
IWDView-API is not passed into this service event handler method to discourage manipu-lation of the view layout inside this method.

Inbound Plug Event Handlers based on Declaration

 

public void onPlug<inbound plug name>( IWDCustomEvent wdEvent
 
["," parameter {"," parameter}])

Event handler for inbound plug.  Additional event parameters can be declared.

This graphic is explained in the accompanying text
An inbound plug event handler is invoked by the Web Dynpro Runtime when the associated inbound plug is the target of a navigation link.

In case an inbound plug is explicitly defined as the Default Plug of a view usage (defined in a window) the Web Dynpro Runtime invokes its event handler independent from a defined navigation link. By default the Default Plug property of a defined view usage is set none.

Action Event Handlers based on Declaration

 

public void onAction<action name>( IWDCustomEvent wdEvent
 
["," parameter {"," parameter}])

Action event handler.  Additional action parameters can be declared.

 

Sh     ortcut Variables

Predefined Shortcut Variables

 

private final IWDViewController wdControllerAPI

A shortcut for wdThis.wdGetAPI(). Represents the generic controller API IWDViewController of the generic Web Dynpro counterpart for this controller.

 

wdThis, wdComponentAPI, wdContext

See common controller class reference

 

End of Content Area