Accessing Generic Controller Interfaces With
Shortcut VariablesThe generic controller APIs IWDController, IWDComponent, IWDViewController and IWDWindowControllerare implemented by the Web Dynpro Runtime itself. These generic controller interfaces must be invoked by the application developer to fulfill special requirements:
● Accessing or modifying controller metadata: To access or dynamically modify the metadata information of a controller at runtime within your custom code you must invoke the corresponding IWD…Info-APIs. These APIs are exposed by getter methods of the generic controller APIs.
● Accessing or modifying metadata of associated objects: In some cases the metadata or the state of associated objects like windows, applications, actions or component usage groups have to be modified at runtime. The related generic IWD*-APIs are again accessible via the generic controller APIs. Examples for this sceanrio are: dynamic event subscription, dynamic view composition, addition or removal of plugs, requesting focus in view layouts.
● Accessing generic services: Many generic service APIs like IWDMessageManager,IWDWindowManager orIWDTextAccessor can only be invoked via the generic controller APIs. In contrast to other services they are not based on a standalone service class like WDURLGenerator, WDResourceHandler, WDWebResource WDSystemLandscape or WDProtocolAdapter.
The next diagram illustrates which Web Dynpro Runtime APIs are associated with the generic controller APIs IWDController, IWDComponent, IWDViewController and IWDWindowController:
To easily access the generic controller APIs within your custom application code every Web Dynpro controller class has two private member variables wdControllerAPI and wdComponentAPI.
●
wdControllerAPI =
wdThis.wdGetAPI()
Depending on the given controller type the variable wdControllerAPI is of
type …
○ IWDComponent within a component controller
○ IWDController within a custom controller
○ IWDWindowController within a window controller
○ IWDViewController within a view controller.
●
wdComponentAPI =
wdThis.wdGetAPI().getComponent()
The variable wdComponentAPI
is of type IWDComponent
within all controller
classes.
The following diagram shows the relationships between the self-implemented controller class, the internal controller class, the generated controller interfaces IPublic and IPrivate and the generic controller APIs. The name controller shortcut variables for wdControllerAPI (1) and wdComponentAPI (2) is based on the fact, that they replace the method calls wdGetAPI()and getComponent() on the variable wdThis.

●
Example:
Implementing a
Component with its Controllers and Interfaces