org.bushe.swing.event
Class ContainerEventServiceAction
java.lang.Object
javax.swing.AbstractAction
org.bushe.swing.event.EventServiceAction
org.bushe.swing.event.ContainerEventServiceAction
- All Implemented Interfaces:
- ActionListener, Serializable, Cloneable, EventListener, Action
public class ContainerEventServiceAction
- extends EventServiceAction
When fired, this action publishes an ActionEvent on a Container EventService.
See EventServiceAction
for more information.
By default, the Container EventService is found by asking the ContainerEventServiceFinder to find the EventService
for the source of the fired ActionEvent, which must be a java.awt.Component and contained in a hierarchy (the source
must have been added to another Swing container). If the action was on a button, this means the container hierarchy
of the button is walked (up) until a ContainerEventServiceSupplier is found or until the top of the hierarchy is
reached, at which point a ContainerEventService is created automatically on the fly via the top container's
putClientProperty() method using the key ContainerEventServiceFinder.CLIENT_PROPERTY_KEY_TOP_LEVEL_EVENT_SERVICE
.
If the event is from a JPopupMenu then the popup menu's invoker's hierarchy is walked.
To exhibit other behavior, override the getSwingEventService() to return another EventService. For example, the
creator of a popup menu may pass itself to the ContainerEventServiceFinder to return a parent's EventService.
- See Also:
for further documentation
,
on how the service is found
,
Serialized Form
Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON |
ContainerEventServiceAction
public ContainerEventServiceAction()
ContainerEventServiceAction
public ContainerEventServiceAction(String actionName,
ImageIcon icon)
getEventService
protected EventService getEventService(ActionEvent event)
- Description copied from class:
EventServiceAction
- Override to return the EventService on which to publish.
- Specified by:
getEventService
in class EventServiceAction
- Parameters:
event
- the event passed to #execute(ActionEvent)
- Returns:
- the event service to publish on, if null and
getThrowsExceptionOnNullEventService() is true (default) an exception is thrown
- See Also:
EventBusAction
,
ContainerEventServiceAction
Copyright © 2011 Bushe Enterprises, Inc.. All Rights Reserved.