java.awt
Class SequencedEvent
java.lang.Object
java.util.EventObject
java.awt.AWTEvent
java.awt.SequencedEvent
- All Implemented Interfaces:
- ActiveEvent, Serializable
- class SequencedEvent
- extends AWTEvent
- implements ActiveEvent
A mechanism for ensuring that a series of AWTEvents are executed in a
precise order, even across multiple AppContexts. The nested events will be
dispatched in the order in which their wrapping SequencedEvents were
constructed. The only exception to this rule is if the peer of the target of
the nested event was destroyed (with a call to Component.removeNotify)
before the wrapping SequencedEvent was able to be dispatched. In this case,
the nested event is never dispatched.
- Author:
- David Mendenhall
Fields inherited from class java.awt.AWTEvent |
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, focusManagerIsDispatching, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INPUT_METHODS_ENABLED_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK |
Constructor Summary |
(package private) |
SequencedEvent(AWTEvent nested)
Constructs a new SequencedEvent which will dispatch the specified
nested event. |
ID
private static final int ID
- See Also:
- Constant Field Values
list
private static final LinkedList list
nested
private final AWTEvent nested
appContext
private sun.awt.AppContext appContext
disposed
private boolean disposed
SequencedEvent
SequencedEvent(AWTEvent nested)
- Constructs a new SequencedEvent which will dispatch the specified
nested event.
- Parameters:
nested
- the AWTEvent which this SequencedEvent's dispatch()
method will dispatch
dispatch
public final void dispatch()
- Dispatches the nested event after all previous nested events have been
dispatched or disposed. If this method is invoked before all previous nested events
have been dispatched, then this method blocks until such a point is
reached.
While waiting disposes nested events to disposed AppContext
NOTE: Locking protocol. Since dispose() can get EventQueue lock,
dispatch() shall never call dispose() while holding the lock on the list,
as EventQueue lock is held during dispatching. The locks should be acquired
in the same order.
- Specified by:
dispatch
in interface ActiveEvent
isOwnerAppContextDisposed
private static final boolean isOwnerAppContextDisposed(SequencedEvent se)
- true only if event exists and nested source appContext is disposed.
isFirstOrDisposed
public final boolean isFirstOrDisposed()
- Sequenced events are dispatched in order, so we cannot dispatch
until we are the first sequenced event in the queue (i.e. it's our
turn). But while we wait for our turn to dispatch, the event
could have been disposed for a number of reasons.
getFirst
private static final SequencedEvent getFirst()
getFirstWithContext
private static final SequencedEvent getFirstWithContext()
dispose
final void dispose()
- Disposes of this instance. This method is invoked once the nested event
has been dispatched and handled, or when the peer of the target of the
nested event has been disposed with a call to Component.removeNotify.
NOTE: Locking protocol. Since SunToolkit.postEvent can get EventQueue lock,
it shall never be called while holding the lock on the list,
as EventQueue lock is held during dispatching and dispatch() will get
lock on the list. The locks should be acquired in the same order.