Top Description Fields Constructors Methods
com.sun.javafx.event

public Class EventRedirector

extends BasicEventDispatcher
Class Inheritance
Imports
java.util.List, java.util.concurrent.CopyOnWriteArrayList, javafx.event.Event, .EventDispatcher, .EventType

This event dispatcher redirects received events to the registered child dispatchers before dispatching them to the rest of the dispatch chain. The redirected events are wrapped in RedirectedEvent instances, so they can be easily recognized from normal direct events. If an original event wrapped in the RedirectedEvent is consumed by any of the child dispatchers, it won't be sent by the EventRedirector to the rest of the original dispatch chain.

The child dispatchers can also be instances of EventRedirector and might receive both, the normal events (from other sources) and the redirected events from the parent EventRedirector. If a RedirectedEvent is received, it is forwarded to the child event dispatchers without any additional wrapping.

For this hierarchical arrangement of EventRedirector instances the class defines the handleRedirectedEvent method, which is called with a received redirected event, after the event has been forwarded to the child dispatchers. By default this method is empty, but can be overridden in derived classes to define specific handling of these redirected events.

Field Summary

Modifier and TypeField and Description
private final EventDispatchChainImpl
private final List<EventDispatcher>
private final Object

Constructor Summary

AccessConstructor and Description
public
EventRedirector(final Object
the object for which to redirect the events (RedirectedEvent event source)
eventSource
)

Constructs a new EventRedirector.

Method Summary

Modifier and TypeMethod and Description
public final void
addEventDispatcher(final EventDispatcher eventDispatcher)

public final Event
protected void
handleRedirectedEvent(final Object
the object from which the event has been redirected
eventSource
,
final Event
the event which has been redirected
event
)

Called when a redirected event is received by this instance.

private void
redirectEvent(final Event event)

public final void
removeEventDispatcher(final EventDispatcher eventDispatcher)

Inherited from com.sun.javafx.event.BasicEventDispatcher:
dispatchBubblingEventdispatchEventgetNextDispatchergetPreviousDispatcherinsertNextDispatcher

Field Detail

eventDispatchChainback to summary
private final EventDispatchChainImpl eventDispatchChain
eventDispatchersback to summary
private final List<EventDispatcher> eventDispatchers
eventSourceback to summary
private final Object eventSource

Constructor Detail

EventRedirectorback to summary
public EventRedirector(final Object eventSource)

Constructs a new EventRedirector.

Parameters
eventSource:Object

the object for which to redirect the events (RedirectedEvent event source)

Method Detail

addEventDispatcherback to summary
public final void addEventDispatcher(final EventDispatcher eventDispatcher)
dispatchCapturingEventback to summary
public final Event dispatchCapturingEvent(Event event)

Overrides com.sun.javafx.event.BasicEventDispatcher.dispatchCapturingEvent.

Annotations
@Override
handleRedirectedEventback to summary
protected void handleRedirectedEvent(final Object eventSource, final Event event)

Called when a redirected event is received by this instance.

Parameters
eventSource:Object

the object from which the event has been redirected

event:Event

the event which has been redirected

redirectEventback to summary
private void redirectEvent(final Event event)
removeEventDispatcherback to summary
public final void removeEventDispatcher(final EventDispatcher eventDispatcher)