My current process for custom widgets is the following:
- Create my widget class - extending Composite;
- Create a listener interface for this widget;
- Create a listener collection interface - private inner class to the widget;
- Create add/removeListener methods on the widget;
- Inside the widget, fire the events on the listeners.
My listeners fire fine-grained events, such as onEntityDisplayRequested(Entity entity)
, so I can't use the stock listeners.
While this achieves low coupling for the widget and allows for re-use, it's quite verbose. Is there a better way of handling design of custom widgets?