How do you use GWT SimpleEventBus or EventBus?

I am working on the development of some simple graphical software that should be implemented in both swing and gwt. On the gwt side, I'm going to use gwt-g2d for the canvas. I was hoping to use eventbus for both versions to simplify some programs.

I understand that it should be something like this:

  • Creating EventBus Events
  • Activate parent widget, flood events you want for EventBus (mouse callback or rpc, for example)
  • Install EventBus to listen for events from the parent widget.
  • Create child widgets that must register with EventBus from listeners (do they need to register events that they can trigger?)
  • When the EventBus receives an event, it must decide on the event and then make a decision, regardless of whether it means ignoring it, changing the type of the event, or simply passing it to all the child widgets.

As usual, how does it work? SimpleEventBus is still new, and I cannot find much information on how to use it.

+5
source share
2 answers

SimpleEventBus event.dispatch() , . , " EventBus " . SimpleEventBus "". SimpleEventBus. " " SimpleEventBus.fireEvent. .

, SimpleEventBus.addHandler(). # 4 - addHandler , , fireEvent (- ), . , Event - , , EventBus! EventBus event.dispatch(theHandler), TheHandler. №5 , SimpleEventBus. SimpleEventBus , , . .

, , , EventBus - , ClickEvents. , , RegionSelectionEvent, EventBus, , RegionSelection , , - - . , eventbus .

, - "resize" , , , .

+2

GWT EventBus, , ( "Systemwide object x chanded y", , , ). .

, - : .

0

All Articles