public class EventBusManager extends Object
EventBus
which by default is
context unaware. This manager defines the context as a top level window
from which events originate. Each window's Object.hashCode()
is
used as context bus number, therefore guaranteeing every window will have
its own event bus. It is critical that all EventBus requests originate with
this manager if context management is required. Top level windows should
register with the manager first by letting it know immedialy after they
are constructed (setWindowInstantiated(MainWindow)
- best called
from inside the constructor, then each time when window gains focus
manager must be told so via switchContext(MainWindow)
. Also
all subscribers, rather than registering directly with the bus, must
register with this manager instead, via registerWithBus(Object)
.Modifier and Type | Method and Description |
---|---|
com.google.common.eventbus.EventBus |
getBus() |
static EventBusManager |
getInstance() |
void |
registerWithBus(Object subscriber) |
void |
setWindowInstantiated(MainWindow busOwner) |
void |
switchContext(MainWindow busOwner) |
public static EventBusManager getInstance()
public com.google.common.eventbus.EventBus getBus()
public void switchContext(MainWindow busOwner)
public void setWindowInstantiated(MainWindow busOwner)
public void registerWithBus(Object subscriber)
Copyright © 2012-2013 Bambi Software Foundation. All Rights Reserved.