Quantcast
Channel: SCN : All Content - Web Dynpro Java
Viewing all articles
Browse latest Browse all 1288

How do I subscribe to Events from Component Interfaces?

$
0
0

Hello,

 

in brief words, here's the problem:

 

Let's say we have Components A, B and C.

A and B are used Components of C.

 

Components A and B both implement Interface X.

Interface X defines Event E, which can be fired by both A or B.

 

How can I subscribe an Event Handler Z of Component C to Event E of both components A and B?

I can cast the Component Usages of A and B to the type of Interface X, so I can access the Event ID of Event E.


But if I use method addEventHandler(EventId, EventHandlerId) of IWDComponent (via wdControllerAPI or wdComponentAPI) to subscribe Event Handler Z of Component C to Event E, it throws an IllegalArgumentException, because E does not belong to Component C.

 

The javadoc of IWDComponent.addEventHandler() tells about the limitation that both the Event and the Event Handler have to belong to the current Component of which the method is called.

 

So, at the moment, I have removed the Component Interface, explicitly declared the Events in both Interface Controllers of A and B and have an Event Handler in C for each Event. This works fine, but it's not very beautiful. Especially because I've got more than two used Components in my application which fire the (virtually) same Event.

 

I'm on Netweaver 7.3 SP 5. Does anybody see a way to implement this with a Component Interface and a single Event Handler?

 

Greetz,

Bernd


Viewing all articles
Browse latest Browse all 1288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>