I'm working with SmartGWT and OSGi in an existing application. The Server/UI we have can be extended based on "features" installed. To do this, the idea is to have a pluggable framework where the UI can be extended by having UI plugins installed on disk and loaded via OSGi. The plugins are a fragment bundle of the base UI module.
To get to this point, I separated the base UI module out into two SmartGWT modules -- one that contains the pieces of the UI that only the base UI module cares about, and a "common" UI module that can be compiled into the base UI module and the plugins so they can be shared.
When running the code, I can see all modules get loaded, and the entry points get called. The idea was to have the plugin modules register for events in the base UI module in order to extend the UI. For example: if the base module were about to show a menu, it could signal on the event to all plugins that it is about to display a menu and pass the menu object when it fires the event. The plugins could then modify the menu by adding any extra options to it and register for events when the menu item gets selected.
This is where I've hit a roadblock - the events don't seem to be getting received by the plugin modules. I think what is happening is that with it being separate modules, they each have their own copies of the "common" code in which the HandlerManager resides for registering and firing events. Therefore, the plugin registers for the event with its copy of the HandlerManager and the main UI doesn't have any listeners in its copy of the HandlerManager. What I need is a way to share this object.
I found this thread in which they are talking about this exact idea with GWT:
https://groups.google.com/forum/#!topic/Google-Web-Toolkit/cZrMJK8E4Hk
Before I go any further with this:
1. Is it possible to use this mechanism to "export" an API in order to have plugins call it with SmartGWT? Is there something built into SmartGWT to do this easily?
2. Is there some other mechanism to do this?
3. Is this idea possible at all with the SmartGWT framework?
To get to this point, I separated the base UI module out into two SmartGWT modules -- one that contains the pieces of the UI that only the base UI module cares about, and a "common" UI module that can be compiled into the base UI module and the plugins so they can be shared.
When running the code, I can see all modules get loaded, and the entry points get called. The idea was to have the plugin modules register for events in the base UI module in order to extend the UI. For example: if the base module were about to show a menu, it could signal on the event to all plugins that it is about to display a menu and pass the menu object when it fires the event. The plugins could then modify the menu by adding any extra options to it and register for events when the menu item gets selected.
This is where I've hit a roadblock - the events don't seem to be getting received by the plugin modules. I think what is happening is that with it being separate modules, they each have their own copies of the "common" code in which the HandlerManager resides for registering and firing events. Therefore, the plugin registers for the event with its copy of the HandlerManager and the main UI doesn't have any listeners in its copy of the HandlerManager. What I need is a way to share this object.
I found this thread in which they are talking about this exact idea with GWT:
https://groups.google.com/forum/#!topic/Google-Web-Toolkit/cZrMJK8E4Hk
Before I go any further with this:
1. Is it possible to use this mechanism to "export" an API in order to have plugins call it with SmartGWT? Is there something built into SmartGWT to do this easily?
2. Is there some other mechanism to do this?
3. Is this idea possible at all with the SmartGWT framework?
Comment