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 classImplementsEventDispatcher.AccessibilityDispatcherbut does nothing in the implementation.Nested classes/interfaces inherited from class org.eclipse.draw2d.EventDispatcher
EventDispatcher.AccessibilityDispatcher -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intDeprecated.protected ControlThe control this dispatcher is listening to. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDispatches a focus gained event.voidDispatches a focus lost event.voidDispatches a key pressed event.voidDispatches a key released event.voidDispatches a key traversed event.voidDispatches a mouse double clicked event.voidDispatches a mouse entered event.voidDispatches a mouse exited event.voidDispatches a mouse hover event.voidDispatches a moved event event.voidDispatches a mouse pressed event.voidDispatches a mouse released event.voidDispatches a MouseWheel event.protected EventDispatcher.AccessibilityDispatcherReturns the AccessibilityDispatcher.protected MouseEventReturns the current mouse event.protected IFigureReturns the figure that the cursor is over.Returns the IFigure that currently has focus.protected final FocusTraverseManagerReturns the FocusTraverseManager which is used to determine which figure will get focus when a TAB or ALT+TAB key sequence occurs.protected IFigureReturns the figure that is the target of mouse events.protected IFiguregetRoot()Returns the root figure for this dispatcher.protected ToolTipHelperReturns the ToolTipHelper used to display tooltips on hover events.booleanprotected voidReleases capture initiated byEventDispatcher.setCapture(IFigure).voidrequestFocus(IFigure fig) Requests focus for the given figure.voidRequests focus to be removed from the given figure.protected voidsetCapture(IFigure figure) Sets capture to the given figure.voidSets the contol associated with this event dispatcher.protected voidSets the mouse cursor.voidsetEnableKeyTraversal(boolean traverse) Enables key traversal via TAB and ALT+TAB if traverse istrue.protected voidSets the figure under the mouse cursor.protected voidSets the focus figure.protected voidsetHoverSource(Figure figure, MouseEvent me) Sets the figure that the mouse cursor is hovering over.protected voidsetMouseTarget(IFigure figure) Sets the given figure to be the target of future mouse events.voidSets the root figure for this dispatcher.protected voidUpdates the cursor.protected voidUpdates 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 voidUpdates the figure that will receive hover events.
-
Field Details
-
ANY_BUTTON
Deprecated.UseSWT.BUTTON_MASKinstead.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:EventDispatcherDispatches a focus gained event.- Specified by:
dispatchFocusGainedin classEventDispatcher- Parameters:
e- the event- See Also:
-
dispatchFocusLost
Description copied from class:EventDispatcherDispatches a focus lost event.- Specified by:
dispatchFocusLostin classEventDispatcher- Parameters:
e- the event- See Also:
-
dispatchKeyPressed
Description copied from class:EventDispatcherDispatches a key pressed event.- Specified by:
dispatchKeyPressedin classEventDispatcher- Parameters:
e- the event- See Also:
-
dispatchKeyReleased
Description copied from class:EventDispatcherDispatches a key released event.- Specified by:
dispatchKeyReleasedin classEventDispatcher- Parameters:
e- the event- See Also:
-
dispatchKeyTraversed
Description copied from class:EventDispatcherDispatches a key traversed event.- Specified by:
dispatchKeyTraversedin classEventDispatcher- Parameters:
e- the event- See Also:
-
dispatchMouseHover
Description copied from class:EventDispatcherDispatches a mouse hover event.- Specified by:
dispatchMouseHoverin classEventDispatcher- Parameters:
me- the event- See Also:
-
dispatchMouseDoubleClicked
Description copied from class:EventDispatcherDispatches a mouse double clicked event.- Specified by:
dispatchMouseDoubleClickedin classEventDispatcher- Parameters:
me- the event- See Also:
-
dispatchMouseEntered
Description copied from class:EventDispatcherDispatches a mouse entered event.- Specified by:
dispatchMouseEnteredin classEventDispatcher- Parameters:
me- the event- See Also:
-
dispatchMouseExited
Description copied from class:EventDispatcherDispatches a mouse exited event.- Specified by:
dispatchMouseExitedin classEventDispatcher- Parameters:
me- the event- See Also:
-
dispatchMousePressed
Description copied from class:EventDispatcherDispatches a mouse pressed event.- Specified by:
dispatchMousePressedin classEventDispatcher- Parameters:
me- the event- See Also:
-
dispatchMouseMoved
Description copied from class:EventDispatcherDispatches a moved event event.- Specified by:
dispatchMouseMovedin classEventDispatcher- Parameters:
me- the event- See Also:
-
dispatchMouseReleased
Description copied from class:EventDispatcherDispatches a mouse released event.- Specified by:
dispatchMouseReleasedin classEventDispatcher- Parameters:
me- the event- See Also:
-
dispatchMouseWheelScrolled
Description copied from class:EventDispatcherDispatches a MouseWheel event. Does nothing by default.- Overrides:
dispatchMouseWheelScrolledin classEventDispatcher- Parameters:
e- the SWT event- See Also:
-
getAccessibilityDispatcher
Description copied from class:EventDispatcherReturns the AccessibilityDispatcher.- Specified by:
getAccessibilityDispatcherin 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:EventDispatcherReturns the IFigure that currently has focus.- Specified by:
getFocusOwnerin 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:
isCapturedin classEventDispatcher- Returns:
- whether events are captured by a figure
- See Also:
-
releaseCapture
protected void releaseCapture()Description copied from class:EventDispatcherReleases capture initiated byEventDispatcher.setCapture(IFigure).- Specified by:
releaseCapturein classEventDispatcher- See Also:
-
requestFocus
Description copied from class:EventDispatcherRequests focus for the given figure.- Specified by:
requestFocusin classEventDispatcher- Parameters:
fig- the figure requesting focus- See Also:
-
requestRemoveFocus
Description copied from class:EventDispatcherRequests focus to be removed from the given figure.- Specified by:
requestRemoveFocusin classEventDispatcher- Parameters:
fig- the figure requesting focus be removed- See Also:
-
setCapture
Description copied from class:EventDispatcherSets capture to the given figure. All subsequent events will be sent to the given figure untilEventDispatcher.releaseCapture()is called.- Specified by:
setCapturein classEventDispatcher- Parameters:
figure- the figure capturing the events- See Also:
-
setControl
Description copied from class:EventDispatcherSets the contol associated with this event dispatcher.- Specified by:
setControlin 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:EventDispatcherSets the root figure for this dispatcher.- Specified by:
setRootin classEventDispatcher- Parameters:
figure- the root figure- See Also:
-
updateCursor
protected void updateCursor()Description copied from class:EventDispatcherUpdates the cursor.- Specified by:
updateCursorin 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_MASKinstead.