Show TOC Start of Content Area

Object documentation Common Controller Interface Reference  Locate the document in its SAP Library structure

The Common Controller Interface Reference comprises those parts all Web Dynpro controller interfaces have in common. Please note that there is no special Web Dynpro controller type called Common Controller. The adjective common refers to those parts all controllers have in common but not to a specific controller type.

The additional parts, which depend on a specific controller type, are documented within separate sections on the four Web Dynpro controller types Component, Custom, Window and View.

API Overview

This graphic is explained in the accompanying text

IPrivate API

The IPrivate interface extends the IPublic-API. It is only visible within the self-implemented controller class (application class) and can be invoked there with the shortcut variable wdThis. It is not visible for other controllers.

Additional Methods based on Declaration

 

public <type> <method name>([parameter { "," parameter }])

Controller method with arbitrary signature (parameters and return type). The return type depends on the declaration.




void wdFireEvent<event name>( [parameter { "," parameter }] )

Fires a serverside controller event and passes definded optional parameters to the event listeners.

Note Note that events can only be defined in non-view controllers.

Caution As the method wdFireEvent<event name>() is not exposed in the IPublic-API the event cannot directly be fired by another controller in the same component. You must explicitly declare a public method which itself fires the defined private event.




IPublic<controller name>
  wdGet<non-view controller name>Controller()

Gets IPublic interface of a controller belonging to the same component.




wdGet<component usage name>ComponentUsage()

Gets IWDComponentUsage API for the defined component usage. This is for example used to create and destroy component instances at runtime (lifecycle property of the component usage is defined as manual).




IExternal<component usage name>
  wdGet<component usage name>Interface()

Gets IExternal interface of the used component interface controller. 

Additional Constants for declared Event Handlers

 

public static IWDEventHandlerId
 
WD_EVENTHANDLER_<event handlername>

Constant for a declared event handler method. Can be used for dynamic event subscription and un-subscription. More information: IWDComponent-API.

IPublic API

The IPublic-API of non-view controllers is visible for other controllers as soon as a corresponding controller usage relation is defined.  It can be invoked there with the accessor method  wdThis.wdGet<non-view controller name>Controller().

Note
View Controllers do not expose an
IPublic-API to other controllers. The predefined methods wdGetAPI() and wdGetContext() and the declared methods are consequently added to the IPrivate-API.

 

Predefined Methods

 

<generic controller API> wdGetAPI()

More information: Controller interface reference of the four special Web Dynpro controller types.

 

IContextNode wdGetContext();

Returns the context root node. More information: Section Inner Context APIs below.

Additional public Methods based on Declaration

 

public <type> <method name>([parameter { "," parameter }])

Controller method with arbitrary signature (parameters and return type). The return type depends on the declaration.




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

Event handler method. The parameters must be compatible with the parameters of the subcribed event. The name of event handlers should start with the prefix on.

Additional Constants for declared Events

 

public static IWDEventId WD_EVENT_<event name>

Event constant for a declared event of a non-view controller. Can be used for dynamic event subscription and un-subscription. More information: IWDComponent-API.

Note  Events can only be defined in non-view controllers.

Inner Context APIs

Every Web Dynpro controller context comprises a root context node with no attributes by default:

      Name: Context

      Singleton: true

      Cardinality: 1..1

      Selection cardinality: 1..1

For this context node the two interfaces IContextNode and IContextElement are generated to allow context programming and dynamic context modification (adding attributes or inner nodes) in your application code.

IContextNode

 

Interface for the root node 'Context'.

 

public IPrivate<controller name>.IContextElement
  currentContextElement()

Returns the element at the lead selection. Returns null if the lead selection is not set.

 

public IWDContext wdGetAPI()

Provides access to the generic context API as described by IWDContext.

 

createContextElement()
createAndAddContextElement()
bind(IPrivate<controller name>.IContextElement element) 

As the root context node has the cardinality 1..1 these methods are not needed within your application code.

Caution You should never call these methods within your application code to avoid undesired effects. The method createAndAddContextElement() throws a runtime exception. Creating and binding a new context element to the root node deletes the whole context structure what is most probably not intended.

IContextElement

 

Interface for the elements of the root node 'Context'

Generic Controller API

IWDController

 

public interface IWDController

Generic API of all Web Dynpro controllers. All controllers created by the Web Dynpro toolset implement this interface. Unless explicitly stated, the methods listed for this interface are not available to parent components through the component usage interface.

Access within controller class:

Use the shortcut variable wdControllerAPI to invoke the generic IWDController-API within your application code.

Generic Controller API (Controller Type Specific)

 

public interface <generic controller API> extends IWDController

The generic controller API (IWDController,  IWDComponent, IWDViewController and IWDWindowController) depends on the concrete controller type (custom, component, view and window controller) and represents the generic Web Dynpro counterpart for this controller.

Access within controller class:

Use the shortcut variable wdControllerAPI to invoke the generic controller API within your application code.

IWDComponent

 

End of Content Area