Package org.eclipse.draw2d
Class SWTEventDispatcher
java.lang.Object
org.eclipse.draw2d.EventDispatcher
org.eclipse.draw2d.SWTEventDispatcher
The SWTEventDispatcher provides draw2d with the ability to dispatch SWT
Events. The
LightweightSystem
adds SWT event
listeners on its Canvas. When the Canvas receives an SWT event, it calls the
appropriate dispatcher method in SWTEventDispatcher.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
ImplementsEventDispatcher.AccessibilityDispatcher
but does nothing in the implementation.Nested classes/interfaces inherited from class org.eclipse.draw2d.EventDispatcher
EventDispatcher.AccessibilityDispatcher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
Deprecated.protected Control
The control this dispatcher is listening to. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Dispatches a focus gained event.void
Dispatches a focus lost event.void
Dispatches a key pressed event.void
Dispatches a key released event.void
Dispatches a key traversed event.void
Dispatches a mouse double clicked event.void
Dispatches a mouse entered event.void
Dispatches a mouse exited event.void
Dispatches a mouse hover event.void
Dispatches a moved event event.void
Dispatches a mouse pressed event.void
Dispatches a mouse released event.protected EventDispatcher.AccessibilityDispatcher
Returns the AccessibilityDispatcher.protected MouseEvent
Returns the current mouse event.protected IFigure
Returns the figure that the cursor is over.Returns the IFigure that currently has focus.protected final FocusTraverseManager
Returns the FocusTraverseManager which is used to determine which figure will get focus when a TAB or ALT+TAB key sequence occurs.protected IFigure
Returns the figure that is the target of mouse events.protected IFigure
getRoot()
Returns the root figure for this dispatcher.protected ToolTipHelper
Returns the ToolTipHelper used to display tooltips on hover events.boolean
protected void
Releases capture initiated byEventDispatcher.setCapture(IFigure)
.void
requestFocus
(IFigure fig) Requests focus for the given figure.void
Requests focus to be removed from the given figure.protected void
setCapture
(IFigure figure) Sets capture to the given figure.void
Sets the contol associated with this event dispatcher.protected void
Sets the mouse cursor.void
setEnableKeyTraversal
(boolean traverse) Enables key traversal via TAB and ALT+TAB if traverse istrue
.protected void
Sets the figure under the mouse cursor.protected void
Sets the focus figure.protected void
setHoverSource
(Figure figure, MouseEvent me) Sets the figure that the mouse cursor is hovering over.protected void
setMouseTarget
(IFigure figure) Sets the given figure to be the target of future mouse events.void
Sets the root figure for this dispatcher.protected void
Updates the cursor.protected void
Updates the figure under the cursor, unless the mouse is captured, in which case all mouse events will be routed to the figure that captured the mouse.protected void
Updates the figure that will receive hover events.Methods inherited from class org.eclipse.draw2d.EventDispatcher
dispatchMouseWheelScrolled
-
Field Details
-
ANY_BUTTON
Deprecated.UseSWT.BUTTON_MASK
instead.Used to tell if any button is pressed without regard to the specific button. -
control
The control this dispatcher is listening to.
-
-
Constructor Details
-
SWTEventDispatcher
public SWTEventDispatcher()
-
-
Method Details
-
dispatchFocusGained
Description copied from class:EventDispatcher
Dispatches a focus gained event.- Specified by:
dispatchFocusGained
in classEventDispatcher
- Parameters:
e
- the event- See Also:
-
dispatchFocusLost
Description copied from class:EventDispatcher
Dispatches a focus lost event.- Specified by:
dispatchFocusLost
in classEventDispatcher
- Parameters:
e
- the event- See Also:
-
dispatchKeyPressed
Description copied from class:EventDispatcher
Dispatches a key pressed event.- Specified by:
dispatchKeyPressed
in classEventDispatcher
- Parameters:
e
- the event- See Also:
-
dispatchKeyReleased
Description copied from class:EventDispatcher
Dispatches a key released event.- Specified by:
dispatchKeyReleased
in classEventDispatcher
- Parameters:
e
- the event- See Also:
-
dispatchKeyTraversed
Description copied from class:EventDispatcher
Dispatches a key traversed event.- Specified by:
dispatchKeyTraversed
in classEventDispatcher
- Parameters:
e
- the event- See Also:
-
dispatchMouseHover
Description copied from class:EventDispatcher
Dispatches a mouse hover event.- Specified by:
dispatchMouseHover
in classEventDispatcher
- Parameters:
me
- the event- See Also:
-
dispatchMouseDoubleClicked
Description copied from class:EventDispatcher
Dispatches a mouse double clicked event.- Specified by:
dispatchMouseDoubleClicked
in classEventDispatcher
- Parameters:
me
- the event- See Also:
-
dispatchMouseEntered
Description copied from class:EventDispatcher
Dispatches a mouse entered event.- Specified by:
dispatchMouseEntered
in classEventDispatcher
- Parameters:
me
- the event- See Also:
-
dispatchMouseExited
Description copied from class:EventDispatcher
Dispatches a mouse exited event.- Specified by:
dispatchMouseExited
in classEventDispatcher
- Parameters:
me
- the event- See Also:
-
dispatchMousePressed
Description copied from class:EventDispatcher
Dispatches a mouse pressed event.- Specified by:
dispatchMousePressed
in classEventDispatcher
- Parameters:
me
- the event- See Also:
-
dispatchMouseMoved
Description copied from class:EventDispatcher
Dispatches a moved event event.- Specified by:
dispatchMouseMoved
in classEventDispatcher
- Parameters:
me
- the event- See Also:
-
dispatchMouseReleased
Description copied from class:EventDispatcher
Dispatches a mouse released event.- Specified by:
dispatchMouseReleased
in classEventDispatcher
- Parameters:
me
- the event- See Also:
-
getAccessibilityDispatcher
Description copied from class:EventDispatcher
Returns the AccessibilityDispatcher.- Specified by:
getAccessibilityDispatcher
in classEventDispatcher
- Returns:
- the AccessibilityDispatcher
- See Also:
-
getCurrentEvent
Returns the current mouse event.- Returns:
- the current mouse event; can be
null
-
getCursorTarget
Returns the figure that the cursor is over.- Returns:
- the cursor target
-
getToolTipHelper
Returns the ToolTipHelper used to display tooltips on hover events.- Returns:
- the ToolTipHelper
-
getFocusTraverseManager
Returns the FocusTraverseManager which is used to determine which figure will get focus when a TAB or ALT+TAB key sequence occurs.- Returns:
- the FocusTraverseManager
-
getFocusOwner
Description copied from class:EventDispatcher
Returns the IFigure that currently has focus.- Specified by:
getFocusOwner
in classEventDispatcher
- Returns:
- the IFigure that currently has focus
- Since:
- 3.6
- See Also:
-
getMouseTarget
Returns the figure that is the target of mouse events. This may not be the figure beneath the cursor because another figure may have captured the mouse and will continue to get mouse events until capture is released.- Returns:
- the mouse target
-
getRoot
Returns the root figure for this dispatcher.- Returns:
- the root figure
-
isCaptured
public boolean isCaptured()- Specified by:
isCaptured
in classEventDispatcher
- Returns:
- whether events are captured by a figure
- See Also:
-
releaseCapture
protected void releaseCapture()Description copied from class:EventDispatcher
Releases capture initiated byEventDispatcher.setCapture(IFigure)
.- Specified by:
releaseCapture
in classEventDispatcher
- See Also:
-
requestFocus
Description copied from class:EventDispatcher
Requests focus for the given figure.- Specified by:
requestFocus
in classEventDispatcher
- Parameters:
fig
- the figure requesting focus- See Also:
-
requestRemoveFocus
Description copied from class:EventDispatcher
Requests focus to be removed from the given figure.- Specified by:
requestRemoveFocus
in classEventDispatcher
- Parameters:
fig
- the figure requesting focus be removed- See Also:
-
setCapture
Description copied from class:EventDispatcher
Sets capture to the given figure. All subsequent events will be sent to the given figure untilEventDispatcher.releaseCapture()
is called.- Specified by:
setCapture
in classEventDispatcher
- Parameters:
figure
- the figure capturing the events- See Also:
-
setControl
Description copied from class:EventDispatcher
Sets the contol associated with this event dispatcher.- Specified by:
setControl
in classEventDispatcher
- Parameters:
c
- the control- See Also:
-
setCursor
Sets the mouse cursor.- Parameters:
c
- the new cursor
-
setEnableKeyTraversal
public void setEnableKeyTraversal(boolean traverse) Enables key traversal via TAB and ALT+TAB if traverse istrue
. Disables it otherwise.- Parameters:
traverse
- whether key traversal should be enabled
-
setFigureUnderCursor
Sets the figure under the mouse cursor.- Parameters:
f
- the new figure under the cursor
-
setFocus
Sets the focus figure. If the figure currently with focus is notnull
,IFigure.handleFocusLost(FocusEvent)
is called on the current focused figure. If the new focus figure is notnull
, this will callIFigure.handleFocusGained(FocusEvent)
on the new focused figure.- Parameters:
fig
- the new focus figure
-
setHoverSource
Sets the figure that the mouse cursor is hovering over.- Parameters:
figure
- the new hover sourceme
- the mouse event
-
setMouseTarget
Sets the given figure to be the target of future mouse events.- Parameters:
figure
- the new mouse target
-
setRoot
Description copied from class:EventDispatcher
Sets the root figure for this dispatcher.- Specified by:
setRoot
in classEventDispatcher
- Parameters:
figure
- the root figure- See Also:
-
updateCursor
protected void updateCursor()Description copied from class:EventDispatcher
Updates the cursor.- Specified by:
updateCursor
in classEventDispatcher
- See Also:
-
updateFigureUnderCursor
Updates the figure under the cursor, unless the mouse is captured, in which case all mouse events will be routed to the figure that captured the mouse.- Parameters:
me
- the mouse event
-
updateHoverSource
Updates the figure that will receive hover events. The hover source must have a tooltip. If the figure under the mouse doesn't have a tooltip set, this method will walk up the ancestor hierarchy until either a figure with a tooltip is found or it gets to the root figure.- Parameters:
me
- the mouse event
-
SWT.BUTTON_MASK
instead.