How to get com.google.web.bindery.event.shared.EventBus instance in com.google.gwt.user.client.ui.Composite extending class?;
I've readed: How to use EventBus for non-Presenter class in GWTP?, but I am looking for answer like:
BEST APPROACHES TO GWT DEVELOPMENT
I have widget that I would like to fire an event IndicatorEvent. But in this widget I don't have a handler for this event.
The handler is in other class. So to fire it I will use:
fireEvent(new IndicatorEvent("Custom Widget Message"));
Method fireEvent is avalible in com.google.web.bindery.event.shared;EventBus
public abstract void fireEvent(Event<?> event);
So I need an instance of EventBus in view class that extends Composite. This view doesn't have MVP stuff (presenters, uihandlers, etc.) it is simple one class element/widget.
What approach should I pick up?
- Should I convert this to
Presenter/Viewpair? (In gwtp presenters is EventBus reference fromPresenterWidgetclass) And then using ui handlers, delegate execution from view to presenter? - Should I
injectinstance ofEventBusinto widget class?
Please help.