Package com.sun.javafx.event
Class EventRedirector
java.lang.Object
com.sun.javafx.event.BasicEventDispatcher
com.sun.javafx.event.EventRedirector
- All Implemented Interfaces:
EventDispatcher
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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addEventDispatcher
(EventDispatcher eventDispatcher) final Event
dispatchCapturingEvent
(Event event) protected void
handleRedirectedEvent
(Object eventSource, Event event) Called when a redirected event is received by this instance.final void
removeEventDispatcher
(EventDispatcher eventDispatcher) Methods inherited from class com.sun.javafx.event.BasicEventDispatcher
dispatchBubblingEvent, dispatchEvent, getNextDispatcher, getPreviousDispatcher, insertNextDispatcher
-
Constructor Details
-
EventRedirector
Constructs a newEventRedirector
.- Parameters:
eventSource
- the object for which to redirect the events (RedirectedEvent
event source)
-
-
Method Details
-
handleRedirectedEvent
Called when a redirected event is received by this instance.- Parameters:
eventSource
- the object from which the event has been redirectedevent
- the event which has been redirected
-
addEventDispatcher
-
removeEventDispatcher
-
dispatchCapturingEvent
- Overrides:
dispatchCapturingEvent
in classBasicEventDispatcher
-