Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class java.awt.LightweightDispatcher

java.lang.Object
  |
  +--java.awt.LightweightDispatcher

class LightweightDispatcher
extends Object
implements java.io.Serializable
Class to manage the dispatching of events to the lightweight components contained by a native container.

See Also:
Serialized Form

Field Summary
boolean dragging
          Indicates if the mouse pointer is currently being dragged... this is needed because we may receive exit events while dragging and need to keep the current mouse target in this case.
long eventMask
          The event mask for contained lightweight components.
Component focus
          The current lightweight component that has focus that is being hosted by this container.
static long MOUSE_MASK
           
Component mouseEventTarget
          The current lightweight component being hosted by this windowed component that has mouse events being forwarded to it.
Container nativeContainer
          The windowed container that might be hosting events for lightweight components.
java.awt.Cursor nativeCursor
          The cursor used by the native container that is hosting the lightweight components.
static long PROXY_EVENT_MASK
          The kind of events routed to lightweight components from windowed hosts.
static long serialVersionUID
           
 
Constructor Summary
LightweightDispatcher(Container nativeContainer)
           
 
Method Summary
boolean dispatchEvent(AWTEvent e)
          Dispatches an event to a lightweight sub-component if necessary, and returns whether or not the event was forwarded to a lightweight sub-component.
void enableEvents(long events)
          Enables events to lightweight components.
boolean processFocusEvent(java.awt.event.FocusEvent e)
           
boolean processKeyEvent(java.awt.event.KeyEvent e)
           
boolean processMouseEvent(java.awt.event.MouseEvent e)
          This method attempts to distribute a mouse event to a lightweight component.
void retargetMouseEvent(int id, java.awt.event.MouseEvent e)
          Sends a mouse event to the current mouse event recipient using the given event (sent to the windowed host) as a prototype.
boolean setFocusRequest(Component c)
          This is called by the hosting native container on behalf of lightweight components that have requested focus.
void setMouseTarget(Component target, java.awt.event.MouseEvent e)
          Change the current target of mouse events.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notifyAll, notify, registerNatives, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID

nativeContainer

private Container nativeContainer
The windowed container that might be hosting events for lightweight components.

focus

private Component focus
The current lightweight component that has focus that is being hosted by this container. If this is a null reference then there is currently no focus on a lightweight component being hosted by this container

mouseEventTarget

private transient Component mouseEventTarget
The current lightweight component being hosted by this windowed component that has mouse events being forwarded to it. If this is null, there are currently no mouse events being forwarded to a lightweight component.

dragging

private boolean dragging
Indicates if the mouse pointer is currently being dragged... this is needed because we may receive exit events while dragging and need to keep the current mouse target in this case.

nativeCursor

private java.awt.Cursor nativeCursor
The cursor used by the native container that is hosting the lightweight components. Since the Cursor used by the lightweight components overwrites the Cursor set in the native container we need to stash the native cursor so we can restore it after the lightweight components are done having their cursor shown.

eventMask

private long eventMask
The event mask for contained lightweight components. Lightweight components need a windowed container to host window-related events. This seperate mask indicates events that have been requested by contained lightweight components without effecting the mask of the windowed component itself.

PROXY_EVENT_MASK

private static final long PROXY_EVENT_MASK
The kind of events routed to lightweight components from windowed hosts.

MOUSE_MASK

private static final long MOUSE_MASK
Constructor Detail

LightweightDispatcher

LightweightDispatcher(Container nativeContainer)
Method Detail

enableEvents

void enableEvents(long events)
Enables events to lightweight components.

setFocusRequest

boolean setFocusRequest(Component c)
This is called by the hosting native container on behalf of lightweight components that have requested focus. The focus request is propagated upward from the requesting lightweight component until a windowed host is found, at which point the windowed host calls this method. This method returns whether or not the peer associated with the native component needs to request focus from the native window system. If a lightweight component already has focus the focus events are synthesized since there will be no native events to drive the focus. If the native host already has focus, the focus gained is synthesized for the lightweight component requesting focus since it will receive no native focus requests.

dispatchEvent

boolean dispatchEvent(AWTEvent e)
Dispatches an event to a lightweight sub-component if necessary, and returns whether or not the event was forwarded to a lightweight sub-component.
Parameters:
e - the event

processKeyEvent

private boolean processKeyEvent(java.awt.event.KeyEvent e)

processFocusEvent

private boolean processFocusEvent(java.awt.event.FocusEvent e)

processMouseEvent

private boolean processMouseEvent(java.awt.event.MouseEvent e)
This method attempts to distribute a mouse event to a lightweight component. It tries to avoid doing any unnecessary probes down into the component tree to minimize the overhead of determining where to route the event, since mouse movement events tend to come in large and frequent amounts.

setMouseTarget

void setMouseTarget(Component target,
                    java.awt.event.MouseEvent e)
Change the current target of mouse events. This sends the appropriate MOUSE_EXITED and MOUSE_ENTERED events.

retargetMouseEvent

void retargetMouseEvent(int id,
                        java.awt.event.MouseEvent e)
Sends a mouse event to the current mouse event recipient using the given event (sent to the windowed host) as a prototype. If the mouse event target is still in the component tree, the coordinates of the event are translated to those of the target. If the target has been removed, we don't bother to send the message.

Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD