org.bushe.swing.event
Interface ContainerEventServiceSupplier
public interface ContainerEventServiceSupplier
A interface implemented by a Swing Container to supply an EventService local to it's child components.
A Container EventService is, unlike the EventBus
, an EventService
that is container specific, in
other words it is shared only among components within a container. The only difference between a Container
EventService and any other EventService is that it's found and used by the children of a container. The API and
available implementations all work the same as any other EventService.
A good candidate for a ContainerEventServiceSupplier is a Form class. The components that the Form contains can
publish objects when they they change state - for example when their values change or when they become invalid or
valid. The Form may have a model that collects the user's entries by subscribing to events published on the Form's
EventService. A FormValidator may also listen to publications on the Form's EventService to subscribe to validation
errors. The Form's components don't have to know about the form, or the model or the validator. They just publish
events on their Container's EventService, which they can find by using a ContainerEventServiceFinder
.
This class does not ever have to be implemented. The ContainerEventServiceFinder will create a ContainerEventService
on JRootPanes by default. So each dialog and Frame will have their own automatically. You only want to implement
this interface when you want to limit events to subscribers in containers smaller than a JRootPane.
- Author:
- Michael Bushe michael@bushe.com
getContainerEventService
EventService getContainerEventService()