public class SWT2FXEventConverter
extends java.lang.Object
SWT2FXEventConverter
forwards SWT events to JavaFX. It is
necessary because the FXCanvas
does not forward gesture events and
horizontal mouse wheel events.Modifier and Type | Class and Description |
---|---|
protected class |
SWT2FXEventConverter.GestureState
Represents the current
SWT2FXEventConverter.GestureState of touch gesture interaction. |
protected static interface |
SWT2FXEventConverter.ISceneRunnable
The
SWT2FXEventConverter.ISceneRunnable interface provides a callback method that is
invoked in a privileged runnable on the JavaFX application thread. |
Constructor and Description |
---|
SWT2FXEventConverter(javafx.embed.swt.FXCanvas canvas)
Registers event forwarding for the given
FXCanvas . |
Modifier and Type | Method and Description |
---|---|
protected boolean |
changeState(org.eclipse.gef4.fx.swt.gestures.SWT2FXEventConverter.GestureStateType newStateType,
GestureEvent event,
com.sun.javafx.tk.TKSceneListener sceneListener)
Changes the internal
SWT2FXEventConverter.GestureState of the currently performed
touch gesture and sends the appropriate events to JavaFX. |
void |
dispose()
Unregisters event forwarding from the
FXCanvas for which this
SWT2FXEventConverter was created. |
protected void |
scheduleSceneRunnable(SWT2FXEventConverter.ISceneRunnable sr)
Schedules the given
SWT2FXEventConverter.ISceneRunnable for execution in a privileged
runnable on the JavaFX application thread. |
protected void |
sendGestureEventToFx(GestureEvent event)
Converts the given
GestureEvent to a corresponding JavaFX event
and sends it to the JavaFX scene graph of the FXCanvas which is
associated with this SWT2FXEventConverter . |
protected void |
sendMouseHorizontalWheelEventToFx(Event event)
Forwards a given
SWT.MouseHorizontalWheel event to JavaFX. |
public SWT2FXEventConverter(javafx.embed.swt.FXCanvas canvas)
FXCanvas
.canvas
- The FXCanvas
for which event forwarding is registered.protected boolean changeState(org.eclipse.gef4.fx.swt.gestures.SWT2FXEventConverter.GestureStateType newStateType, GestureEvent event, com.sun.javafx.tk.TKSceneListener sceneListener)
SWT2FXEventConverter.GestureState
of the currently performed
touch gesture and sends the appropriate events to JavaFX.newStateType
- The new GestureStateType
.event
- The GestureEvent
which was performed.sceneListener
- The TKSceneListener
to which the corresponding JavaFX
event is send.true
when the GestureStateType
is changed,
otherwise false
.public void dispose()
FXCanvas
for which this
SWT2FXEventConverter
was created.protected void scheduleSceneRunnable(SWT2FXEventConverter.ISceneRunnable sr)
SWT2FXEventConverter.ISceneRunnable
for execution in a privileged
runnable on the JavaFX application thread.sr
- The SWT2FXEventConverter.ISceneRunnable
that will be executed in a
privileged runnable on the JavaFX application thread.protected void sendGestureEventToFx(GestureEvent event)
GestureEvent
to a corresponding JavaFX event
and sends it to the JavaFX scene graph of the FXCanvas
which is
associated with this SWT2FXEventConverter
.event
- The GestureEvent
to send to JavaFX.protected void sendMouseHorizontalWheelEventToFx(Event event)
SWT.MouseHorizontalWheel
event to JavaFX.event
- The SWT.MouseHorizontalWheel
event that is forwarded
to JavaFX.Copyright (c) 2014 itemis AG and others. All rights reserved.