com.ekuefler.supereventbus
Class EventBusAdapter

java.lang.Object
  extended by com.google.web.bindery.event.shared.EventBus
      extended by com.ekuefler.supereventbus.EventBusAdapter

public class EventBusAdapter
extends EventBus

An adapter allowing SuperEventBus to be referenced via GWT's built-in EventBus interface. Calls to methods on this class are forwarded to an underlying EventBus, effectively allowing an EventBus to be passed to existing methods that expect a legacy EventBus. Since only a small subset of EventBus's functionality is exposed here, this should only be used for existing/legacy code that can't be refactored to use EventBus directly.

Author:
ekuefler@gmail.com (Erik Kuefler)

Constructor Summary
EventBusAdapter(EventBus eventBus)
          Creates a new adapter wrapping the given event bus.
 
Method Summary
<H> HandlerRegistration
addHandler(Event.Type<H> type, H handler)
          Emulates the behavior of registering a single handler method on the underlying event bus.
<H> HandlerRegistration
addHandlerToSource(Event.Type<H> type, Object source, H handler)
          Not supported.
 void fireEvent(Event<?> event)
          Invokes EventBus.post(T) on the underlying event bus with the given event.
 void fireEventFromSource(Event<?> event, Object source)
          Not supported.
 
Methods inherited from class com.google.web.bindery.event.shared.EventBus
dispatchEvent, setSourceOfEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventBusAdapter

public EventBusAdapter(EventBus eventBus)
Creates a new adapter wrapping the given event bus.

Method Detail

fireEvent

public void fireEvent(Event<?> event)
Invokes EventBus.post(T) on the underlying event bus with the given event.

Specified by:
fireEvent in class EventBus

addHandler

public <H> HandlerRegistration addHandler(Event.Type<H> type,
                                          H handler)
Emulates the behavior of registering a single handler method on the underlying event bus. The handler is unfiltered and behaves as if it has priority zero.

Specified by:
addHandler in class EventBus

addHandlerToSource

public <H> HandlerRegistration addHandlerToSource(Event.Type<H> type,
                                                  Object source,
                                                  H handler)
Not supported.

Specified by:
addHandlerToSource in class EventBus

fireEventFromSource

public void fireEventFromSource(Event<?> event,
                                Object source)
Not supported.

Specified by:
fireEventFromSource in class EventBus


Copyright © 2013. All Rights Reserved.