|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.bushe.swing.event.EventServiceLocator
public class EventServiceLocator
A central registry of EventServices. Used by the EventBus
.
SERVICE_NAME_SWING_EVENT_SERVICE
and
returned by getSwingEventService()
. Also by default this same instance is returned by getEventBusService()
,
is mapped to SERVICE_NAME_EVENT_BUS
and wrapped by the EventBus.
Since the default EventService implementation is thread safe, and since it's not good to have lots of events on the
EventDispatchThread you may want multiple EventServices running on multiple threads, perhaps pulling events from a
server and coalescing them into one or more events that are pushed onto the EDT.
To change the default implementation class for the EventBus' EventService, use the API:
EventServiceLocator.setEventService(EventServiceLocator.SERVICE_NAME_EVENT_BUS, new SomeEventServiceImpl());Or use system properties by:
System.setProperty(EventServiceLocator.SERVICE_NAME_EVENT_BUS, YourEventServiceImpl.class.getName());Likewise, you can set this on the command line via -Dorg.bushe.swing.event.swingEventServiceClass=foo.YourEventServiceImpl To change the default implementation class for the SwingEventService, use the API:
EventServiceLocator.setEventService(EventServiceLocator.SERVICE_NAME_SWING_EVENT_SERVICE, new SomeSwingEventServiceImpl());Or use system properties by:
System.setProperty(EventServiceLocator.SWING_EVENT_SERVICE_CLASS, YourEventServiceImpl.class.getName());Likewise, you can set this on the command line via -Dorg.bushe.swing.event.swingEventServiceClass=foo.YourEventServiceImpl
Field Summary | |
---|---|
static String |
EVENT_BUS_CLASS
Set this Java property to a Class that implements EventService to use an instance of that class instead of the instance returned by getSwingEventService() . |
static String |
SERVICE_NAME_EVENT_BUS
The name "EventBus" is reserved for the service that the EventBus wraps and is returned by getEventBusService() . |
static String |
SERVICE_NAME_SWING_EVENT_SERVICE
The name "SwingEventService" is reserved for the service that is returned by getSwingEventService() . |
static String |
SWING_EVENT_SERVICE_CLASS
Set this Java property to a Class that implements EventService to use an instance of that class instead of SwingEventService as service returned by getSwingEventService() . |
Constructor Summary | |
---|---|
EventServiceLocator()
|
Method Summary | |
---|---|
static EventService |
getEventBusService()
|
static EventService |
getEventService(String serviceName)
|
static EventService |
getSwingEventService()
|
static void |
setEventService(String serviceName,
EventService es)
Registers a named EventService to the locator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SERVICE_NAME_EVENT_BUS
getEventBusService()
.
public static final String SERVICE_NAME_SWING_EVENT_SERVICE
getSwingEventService()
.
public static final String EVENT_BUS_CLASS
getSwingEventService()
. Must be set before getEventBusService()
is called.
public static final String SWING_EVENT_SERVICE_CLASS
SwingEventService
as service returned by getSwingEventService()
. Must be set on startup or
before the method getSwingEventService()
is called.
Constructor Detail |
---|
public EventServiceLocator()
Method Detail |
---|
public static EventService getEventBusService()
public static EventService getSwingEventService()
public static EventService getEventService(String serviceName)
serviceName
- the service name of the EventService, as registered by #setEventService(String, EventService),
or SERVICE_NAME_EVENT_BUS
or SERVICE_NAME_SWING_EVENT_SERVICE
.
public static void setEventService(String serviceName, EventService es) throws EventServiceExistsException
serviceName
- a named event service instancees
- the EventService to attach to the service name
EventServiceExistsException
- if a service by this name already exists and the new service is non-null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |