public class TuioFX extends Object
The TUIOFX toolkit is designed to use the JavaFX's multi-touch event handling
infrastructure and its predefined gesture event types in order to send events about
the recognised gesture to the associated target Node
.
Therefore, TuioFX
creates platform-independent gesture recognizers for each
GestureEvent
type supported by the JavaFX event platform, that is
the RotateEvent
, the ScrollEvent
,
the SwipeEvent
and the ZoomEvent
.
A gesture recognizer detects a gesture by analysing a stream of
TUIO touch events of a specific target Node
and sends Event
s about the recognised gesture to this specific target Node
.
Each gesture recognizer has been implemented with respect to the gesture definition of JavaFX.
This includes primarily using and sending the correct gesture event type with the correct
parameters and in the correct order according to the JavaFX gesture documentation (see RotateEvent
, ScrollEvent
,
SwipeEvent
, ZoomEvent
and
TouchEvent
).
According to the JavaFX documentation (see
Working with Events from Touch-Enabled Devices) touch-enabled devices should also generate
JavaFX specific TouchEvent
to represent the states a touch point
can have during its contact with the touch device. Therefore, the TuioFX
also creates a
touch recognizer that generates touch event types of the TouchEvent
to describe the state of individual touch points.
While TUIO touch events are automatically and transparently dispatches to the target
Node
using JavaFX event architecture, TUIO object events (for
tangible interaction) are distributed to all registered classes that implement the TangibleListener
interface.
Note that TuioFX
must be initialized first – by calling the
enableJavaFXTouchProperties()
method – before launching
(Application.launch(java.lang.String...)
) the JavaFX application.
The following example illustrates the usage of TuioFX in a JavaFX application.
public class TuioFXApplication extends Application {
public static void main(String[] args) {
TuioFX.enableJavaFXTouchProperties();
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
Pane root = new StackPane();
Scene scene = new Scene(root);
stage.setScene(scene);
// start TuioFX
TuioFX tuioFX = new TuioFX(stage, Configuration.ioS());
tuioFX.enableMTWidgets(true);
tuioFX.start();
// display application window
stage.show();
}
}
Constructor and Description |
---|
TuioFX(Stage stage,
Configuration config)
Creates a new
TuioFX instance with the given configuration, in the given Stage . |
Modifier and Type | Method and Description |
---|---|
void |
addTangibleListener(TangibleListener listener)
Registers a new
TangibleListener to receive TUIO object/tangible events. |
static void |
enableJavaFXTouchProperties()
Enables JavaFX system properties reserved for touch devices, for example, the built-in
look-and-feel for touch devices.
|
void |
enableMTWidgets(boolean enable)
Enables or disables TUIOFX-Widget for the current JavaFX application.
|
void |
removeAllTangibleListener()
Removes all
TangibleListener s registered from the list of registered TUIO
object/tangible event listeners. |
void |
removeTangibleListener(TangibleListener listener)
Removes the given listener from the list of registered TUIO object/tangible event listeners.
|
void |
start()
Starts listen to touch/tangible events from TUIO-enabled trackers.
|
static void |
startFullDrag(EventTarget source)
Simulates the startFullDrag method of JavaFX nodes and scene.
|
void |
stop()
Stops TuioFX to listen to TUIO events from trackers and calls
removeAllTangibleListener() to remove all tangible event listeners. |
public TuioFX(Stage stage, Configuration config)
TuioFX
instance with the given configuration, in the given Stage
.stage
- JavaFX stage whose nodes receive TUIO input events.config
- configuration for this TuioFX
instance.public static void enableJavaFXTouchProperties()
The following properties are set:
public void start()
Node
into higher-level gestures.
Note to start this TuioFX
instance again it must prior be stopped via the
stop()
method.
stop()
public void enableMTWidgets(boolean enable)
The TUIOFX-Widget also extends both text input Skins
(TextField
andTextArea
) such that
touching them will open a soft keyboard that can be used as an input device for the text
entry.
By default, TUIOFX-Widget is disabled.
enable
- true
to enable, false
to disable TuioFX-MTWidgetpublic void addTangibleListener(TangibleListener listener)
TangibleListener
to receive TUIO object/tangible events.listener
- the listener to register.public void removeTangibleListener(TangibleListener listener)
listener
- the listener to remove.public void removeAllTangibleListener()
TangibleListener
s registered from the list of registered TUIO
object/tangible event listeners.public void stop()
removeAllTangibleListener()
to remove all tangible event listeners.
By calling stop()
this TuioFX instance can be started again.start()
public static void startFullDrag(EventTarget source)
source
-