The action Save is associated with the event handler onActionSave(). In this method the application logic for the action Save can be implemented.
SampleView.java |
//@@begin javadoc:onActionSave(ServerEvent) /** * Declared validating event handler. * * @param wdEvent generic event object provided by framework */ //@@end public void onActionSave( { //@@begin onActionSave(ServerEvent) ... //@@end } |
You can dynamically subsribe the view controller’s event handler onSomeEvent() to the event SomeEvent (exposed by the component controller) at runtime with the generic component controller API IWDComponent. For this purpose the generated event- and event handler constants must be used.
SampleView.java |
//@@begin javadoc:wdDoInit() /** Hook method called to initialize controller. */ //@@end public void wdDoInit() { //@@begin wdDoInit() IWDEventId eventId = IWDEventHandlerId eventHandlerId
=
wdComponentAPI.addEventHandler(eventId,eventHandlerId); //@@end } |
The object instance of the defined action Save can be accessed in the IPrivate-API of the view controller.
SampleView.java |
wdThis.wdGetSaveAction().setEnabled(false);
|
You can directly fire the suspend plug Suspend defined in the window controller SomeWin in a view controller. To invoke the IPublic-API of the window controller a corresponding controller usage relation must be defined.
SampleView.java |
IPublicSampleWin winPublicAPI = wdThis.wdGetSampleWinController(); winPublicAPI.wdFirePlugSuspend(someSuspendURL);
// direct access wdThis.wdGetSampleWinController().wdFirePlugSuspend(someSuspendURL);
|
Events which are defined in non-view controllers cannot be fired by other controllers because the IPublic-API does not expose a corresponding wdFireEventXY()-method by default. Consequently you must declare a public method fireSomeEvent() in the component controller which fires the event SomeEvent and which can be invoked by the view controller. To invoke the IPublic-API of the component controller a corresponding controller usage relation must be defined.
SampleView.java |
wdThis.wdGetSampleCompController().fireSomeEvent()
|
SampleComp.java |
//@@begin javadoc:fireSomeEvent() /** * Method declared by application. */ //@@end public void fireSomeEvent( ) { //@@begin fireSomeEvent() wdThis.wdFireEventSomeEvent(); //@@end }
|
Change the keyboard input focus to the UI element whose primary purpose is to raise an event bound to the action Save.
SampleView.java |
//Assumption: Only one single UI element is bound to action Save wdControllerAPI.requestFocus(wdThis.wdGetSaveAction());
|
The IWDMessageManager-API is exposed to all controllers in a Web Dynpro component via the generic component controller API IWDComponent. This interface can directly be accessed with the shortcut variable wdComponentAPI.
SampleView.java |
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
|
Invoke the generic IWDWindowController-API of the window controller instance which embeds this view you .
SampleView.java |
IWDWindowController wdwController = wdControllerAPI.getWindowController();
|