public class TLcdTouchEvent extends TLcdAWTEvent
An extension of TLcdAWTEvent
designed for input originating from a
touch device. Where a TLcdTouchPoint
describes changes in the state of a single
touch point, this event describes changes in any of the currently tracked touch points of a touch
device, and also contains the state of all unchanged touch points.
There exists a one-to-one mapping between changes in the touch points and these
TLcdTouchEvent
instances: every time the state or location of a touch point changes,
an TLcdTouchEvent
is generated. This means all TLcdTouchEvent
instances
contain exactly one TLcdTouchPoint
with a State not equal to TLcdTouchPoint.State.STATIONARY
. This specific
TLcdTouchPoint
can be retrieved with the getModifiedTouchPoint()
method.
The associated component of the event is the component on which the first touch point occurred. Note that this does not mean that all touch points should be located within the bounds of that component. The event should be dispatched to this component.
It is possible that touch points of multiple users and/or touch input devices are available at
the same time. However, an TLcdTouchEvent
only describes the state of touch points
related to a specific user and touch
device.
All TLcdTouchEvent
instances have a unique ID, similar to the TLcdTouchPoint instances. This ID is assigned when the first touch point is created and will remain the
same until all touch points are removed
. Once all touch points of a certain device and user are removed, the next created touch
point will
TLcdTouchEvent
with the same ID as the current event if and only
if the new touch point increases the tap count of one of the previous removed touch
points.TLcdTouchEvent
with an ID different from the one of the current
event. The ID of the current event may be reused later on.Note: the ID is only unique for a certain device and user combination. Other combinations may reuse the IDs.
TLcdTouchPoint
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
TOUCH_EVENT_TYPE
The type of a
TLcdTouchEvent . |
static long |
UNKNOWN_TOUCH_DEVICE
Long specifying an unknown device.
|
static String |
UNKNOWN_TOUCH_DEVICE_USER
String specifying an unknown user.
|
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK
source
Constructor and Description |
---|
TLcdTouchEvent(long aTouchEventID,
Object aSource,
List<TLcdTouchPoint> aTouchPointList,
long aTouchDeviceID,
String aUserID,
long aTimeStamp)
Create a new
TLcdTouchEvent . |
Modifier and Type | Method and Description |
---|---|
TLcdTouchEvent |
cloneAs(long aTouchEventID,
Object aSource,
List<TLcdTouchPoint> aTouchPointList,
long aTouchDeviceID,
String aUserID,
long aTimeStamp)
Create a new instance of this class based on the information passed as parameters to this
method.
|
static long |
createTouchEventID()
Use this method to retrieve a new ID for touch events.
|
static TLcdTouchEvent |
fromFXEvent(javafx.scene.input.TouchEvent aTouchEvent)
Converts a native JavaFX
TouchEvent into a TLcdTouchEvent . |
int |
getID() |
TLcdTouchPoint |
getModifiedTouchPoint()
Returns the
TLcdTouchPoint instance which has been modified (the only
TLcdTouchPoint with a state different from
TLcdTouchPoint.State.STATIONARY ). |
List<TLcdTouchPoint> |
getStationaryTouchPoints()
Returns a list containing all
TLcdTouchPoint instances which describe a
touch point that has remained stationary . |
long |
getTimeStamp()
Returns the time when the event occurred.
|
long |
getTouchDeviceID()
Returns the unique ID of the touch device which created the touch point described by this
TLcdTouchEvent . |
long |
getTouchEventID()
Returns the unique ID of this event.
|
TLcdTouchPoint |
getTouchPoint(long aTouchPointID)
|
List<TLcdTouchPoint> |
getTouchPoints()
Returns an unmodifiable list of the associated
TLcdTouchPoint
instances. |
String |
getUserID()
Returns the unique ID of the user of the touch device who created the touch point described
by this
TLcdTouchEvent . |
String |
toString() |
consume, isConsumed, paramString, setSource
getSource
public static final int TOUCH_EVENT_TYPE
TLcdTouchEvent
.getID()
,
Constant Field Valuespublic static final long UNKNOWN_TOUCH_DEVICE
Long specifying an unknown device. TLcdTouchEvent
instances should use this
value as getTouchDeviceID() device ID} when they are unable to identify the
source device of the touch point.
Note that all TLcdTouchEvent
instances which use this value as device ID will
be handled as if they originated from the same touch device.
public static final String UNKNOWN_TOUCH_DEVICE_USER
String specifying an unknown user. TLcdTouchEvent
instances should use this
value as getUserID() user ID} when they are unable to identify the user of the
event.
Note that all TLcdTouchEvent
instances originating from the same touch device which use this value as user ID will be handled as if they
were caused by the same user.
public TLcdTouchEvent(long aTouchEventID, Object aSource, List<TLcdTouchPoint> aTouchPointList, long aTouchDeviceID, String aUserID, long aTimeStamp)
Create a new TLcdTouchEvent
.
aTouchEventID
- the unique ID of this event.aSource
- the source component(an AWT Component or a JavaFX Node) that originated the event.
Must not be null
.aTouchPointList
- the list of all touch points associated to this event. Must not
be null
and must not be empty. Exactly one
instance must have a state different from TLcdTouchPoint.State.STATIONARY
.aTouchDeviceID
- the unique ID of the device which caused this event. In case
the device cannot be identified, use UNKNOWN_TOUCH_DEVICE
.aUserID
- the unique ID of the user of the device which caused this
event. In case the user of the device cannot be identified,
use UNKNOWN_TOUCH_DEVICE_USER
aTimeStamp
- the time at which the event occurred. Expressed as the difference,
measured in milliseconds, with midnight, January 1, 1970 UTC.createTouchEventID()
public int getID()
The type of this events will always be TOUCH_EVENT_TYPE
public List<TLcdTouchPoint> getTouchPoints()
TLcdTouchPoint
instances.TLcdTouchPoint
instancespublic TLcdTouchPoint getModifiedTouchPoint()
TLcdTouchPoint
instance which has been modified (the only
TLcdTouchPoint
with a state different from
TLcdTouchPoint.State.STATIONARY
).TLcdTouchPoint
instance which has been modifiedpublic List<TLcdTouchPoint> getStationaryTouchPoints()
TLcdTouchPoint
instances which describe a
touch point that has remained stationary
.TLcdTouchPoint
instances which describe a
touch point that has remained stationary
public long getTouchDeviceID()
Returns the unique ID of the touch device which created the touch point described by this
TLcdTouchEvent
.
All TLcdTouchEvent
instances originating from the same input device should have
the same device ID throughout the lifetime of the application.
getUserID()
,
UNKNOWN_TOUCH_DEVICE_USER
public String getUserID()
Returns the unique ID of the user of the touch device who created the touch point described
by this TLcdTouchEvent
.
All TLcdTouchEvent
instances originating from the same user on a specific
touch device should have the same user ID throughout the
lifetime of the application. This ID must not be used by another user on the same device. It may
be reused by a user on another device.
()
,
UNKNOWN_TOUCH_DEVICE_USER
public long getTimeStamp()
Returns the time when the event occurred. Expressed as the difference, measured in milliseconds, with midnight, January 1, 1970 UTC.
public long getTouchEventID()
Returns the unique ID of this event.
All TLcdTouchEvent
instances have a unique ID, similar to the TLcdTouchPoint instances. This ID is
assigned when the first touch point is created and will remain the same until all touch points are removed
. Once all touch
points of a certain device and user are removed, the next created touch point will
TLcdTouchEvent
with the same ID as the current event only if
the new touch point increases the tap count of one of the previous removed touch points.TLcdTouchEvent
with an ID different as the one of the current
event. The ID of the current event may be reused later on.Note: the ID is only unique for a certain device and user combination. Other combinations may reuse the IDs.
public TLcdTouchPoint getTouchPoint(long aTouchPointID)
aTouchPointID
- the touch point IDTLcdTouchPoint
, or null
when
this event does not contain such TLcdTouchPoint
getTouchPoints()
public TLcdTouchEvent cloneAs(long aTouchEventID, Object aSource, List<TLcdTouchPoint> aTouchPointList, long aTouchDeviceID, String aUserID, long aTimeStamp)
Create a new instance of this class based on the information passed as parameters to this method.
This method should be overridden by extensions of this class if they want to include their info in the newly created event.
aTouchEventID
- the ID for the new TLcdTouchEvent
aSource
- the source component for the new TLcdTouchEvent
aTouchPointList
- the List
with TLcdTouchPoints
for the new TLcdTouchEvent
aTouchDeviceID
- the device ID for the new TLcdTouchEvent
aUserID
- the user ID for the new TLcdTouchEvent
aTimeStamp
- the time stamp for the new TLcdTouchEvent
TLcdTouchEvent
TLcdTouchPoint.cloneAs(com.luciad.input.touch.TLcdTouchPoint.State, long, java.awt.Point, int, String, boolean, long, long)
public static long createTouchEventID()
Use this method to retrieve a new ID for touch events.
This method allows to create TLcdTouchEvent
instances through the whole
application. Since subsequent TLcdTouchEvent
s describing a new input point
sequence require a different touch event ID
, a central
access point for obtaining IDs is required. This method provides such an access point.
This method should only be called when a new touch event ID is required. Subsequent
TLcdTouchEvent
instances describing changes in the same input sequence must re-use
their ID, hence they must not call this method.
getTouchEventID()
public static TLcdTouchEvent fromFXEvent(javafx.scene.input.TouchEvent aTouchEvent)
TouchEvent
into a TLcdTouchEvent
.aTouchEvent
- the JavaFX touch eventnull
when the event type is TouchEvent.TOUCH_STATIONARY