public class ContainerEventServiceAction extends EventServiceAction
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.
EVENT_BUS_EVENT_CLASS_NAME, EVENT_SERVICE_TOPIC_NAME
changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
ContainerEventServiceAction() |
ContainerEventServiceAction(String actionName,
ImageIcon icon) |
Modifier and Type | Method and Description |
---|---|
protected EventService |
getEventService(ActionEvent event)
Override to return the EventService on which to publish.
|
actionPerformed, getEventServiceEvent, getName, getThrowsExceptionOnNullEventService, getTopicName, getTopicValue, isPublishesOnTopic, setPublishesOnTopic, setThrowsExceptionOnNullEventService, setTopicName
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
protected EventService getEventService(ActionEvent event)
EventServiceAction
getEventService
in class EventServiceAction
event
- the event passed to #execute(ActionEvent)EventBusAction
,
ContainerEventServiceAction
Copyright © 2013 Bushe Enterprises, Inc.. All rights reserved.