Package me.tamkungz.signals.geb
Class GebBridge
java.lang.Object
me.tamkungz.signals.geb.GebBridge
Direct access to the GEB bus behind a
SignalBus: custom
IEvents, @Listen listeners and sub-buses.
Obtain it with SignalBus.geb().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfoo.zaaarf.geb.api.IBusbus()Returns the underlying GEB bus.booleanisRegistered(foo.zaaarf.geb.api.IBus subBus) Tells whether a sub-bus is registered.booleanisRegistered(foo.zaaarf.geb.api.IListener listener) Tells whether a listener is registered.listen(foo.zaaarf.geb.api.IListener listener) Registers a listener and returns a connection that unregisters it.listen(ConnectionGroup group, foo.zaaarf.geb.api.IListener listener) Registers a listener and tracks its connection in a group.booleanpost(foo.zaaarf.geb.api.IEvent event) Posts an event to every registered listener.voidregisterListener(foo.zaaarf.geb.api.IListener listener) Registers a listener.voidregisterSubBus(foo.zaaarf.geb.api.IBus subBus, int priority) Registers a sub-bus.subBus(foo.zaaarf.geb.api.IBus subBus, int priority) Registers a sub-bus and returns a connection that unregisters it.subBus(ConnectionGroup group, foo.zaaarf.geb.api.IBus subBus, int priority) Registers a sub-bus and tracks its connection in a group.voidunregisterListener(foo.zaaarf.geb.api.IListener listener) Unregisters a listener.voidunregisterSubBus(foo.zaaarf.geb.api.IBus subBus) Unregisters a sub-bus.
-
Constructor Details
-
GebBridge
public GebBridge(foo.zaaarf.geb.api.IBus bus) Wraps a GEB bus.- Parameters:
bus- bus to expose
-
-
Method Details
-
bus
public foo.zaaarf.geb.api.IBus bus()Returns the underlying GEB bus.- Returns:
- the raw bus
-
post
public boolean post(foo.zaaarf.geb.api.IEvent event) Posts an event to every registered listener.- Parameters:
event- event to post- Returns:
falseif the event was cancelled,trueotherwise
-
listen
Registers a listener and returns a connection that unregisters it.- Parameters:
listener- listener to register- Returns:
- connection that unregisters the listener
-
listen
Registers a listener and tracks its connection in a group.- Parameters:
group- group that will disconnect the listenerlistener- listener to register- Returns:
- connection that unregisters the listener
-
registerListener
public void registerListener(foo.zaaarf.geb.api.IListener listener) Registers a listener.- Parameters:
listener- listener to register
-
unregisterListener
public void unregisterListener(foo.zaaarf.geb.api.IListener listener) Unregisters a listener.- Parameters:
listener- listener to unregister
-
isRegistered
public boolean isRegistered(foo.zaaarf.geb.api.IListener listener) Tells whether a listener is registered.- Parameters:
listener- listener to check- Returns:
trueif registered
-
subBus
Registers a sub-bus and returns a connection that unregisters it.- Parameters:
subBus- bus to forward events topriority- sub-bus priority- Returns:
- connection that unregisters the sub-bus
-
subBus
Registers a sub-bus and tracks its connection in a group.- Parameters:
group- group that will unregister the sub-bussubBus- bus to forward events topriority- sub-bus priority- Returns:
- connection that unregisters the sub-bus
-
registerSubBus
public void registerSubBus(foo.zaaarf.geb.api.IBus subBus, int priority) Registers a sub-bus.- Parameters:
subBus- bus to forward events topriority- sub-bus priority
-
unregisterSubBus
public void unregisterSubBus(foo.zaaarf.geb.api.IBus subBus) Unregisters a sub-bus.- Parameters:
subBus- bus to stop forwarding to
-
isRegistered
public boolean isRegistered(foo.zaaarf.geb.api.IBus subBus) Tells whether a sub-bus is registered.- Parameters:
subBus- bus to check- Returns:
trueif registered
-