Class TLcdTouchEvent
- All Implemented Interfaces:
Serializable
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
- generate a new
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. - generate a new
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.
- Since:
- 10.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The type of aTLcdTouchEvent
.static final long
Long specifying an unknown device.static final String
String specifying an unknown user.Fields inherited from class java.awt.AWTEvent
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
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionTLcdTouchEvent
(long aTouchEventID, Object aSource, List<TLcdTouchPoint> aTouchPointList, long aTouchDeviceID, String aUserID, long aTimeStamp) Create a newTLcdTouchEvent
. -
Method Summary
Modifier and TypeMethodDescriptioncloneAs
(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
Use this method to retrieve a new ID for touch events.static TLcdTouchEvent
fromFXEvent
(TouchEvent aTouchEvent) Converts a native JavaFXTouchEvent
into aTLcdTouchEvent
.int
getID()
Returns theTLcdTouchPoint
instance which has been modified (the onlyTLcdTouchPoint
with a state different fromTLcdTouchPoint.State.STATIONARY
).Returns a list containing allTLcdTouchPoint
instances which describe a touch point that has remainedstationary
.long
Returns the time when the event occurred.long
Returns the unique ID of the touch device which created the touch point described by thisTLcdTouchEvent
.long
Returns the unique ID of this event.getTouchPoint
(long aTouchPointID) Returns an unmodifiable list of the associatedTLcdTouchPoint
instances.Returns the unique ID of the user of the touch device who created the touch point described by thisTLcdTouchEvent
.toString()
Methods inherited from class java.awt.AWTEvent
consume, isConsumed, paramString, setSource
Methods inherited from class java.util.EventObject
getSource
-
Field Details
-
TOUCH_EVENT_TYPE
public static final int TOUCH_EVENT_TYPEThe type of aTLcdTouchEvent
.- See Also:
-
UNKNOWN_TOUCH_DEVICE
public static final long UNKNOWN_TOUCH_DEVICELong 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.- See Also:
-
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.- See Also:
-
-
Constructor Details
-
TLcdTouchEvent
public TLcdTouchEvent(long aTouchEventID, Object aSource, List<TLcdTouchPoint> aTouchPointList, long aTouchDeviceID, String aUserID, long aTimeStamp) Create a new
TLcdTouchEvent
.- Parameters:
aTouchEventID
- the unique ID of this event.aSource
- the source component(an AWT Component or a JavaFX Node) that originated the event. Must not benull
.aTouchPointList
- the list of all touch points associated to this event. Must not benull
and must not be empty. Exactly one instance must have a state different fromTLcdTouchPoint.State.STATIONARY
.aTouchDeviceID
- the unique ID of the device which caused this event. In case the device cannot be identified, useUNKNOWN_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, useUNKNOWN_TOUCH_DEVICE_USER
aTimeStamp
- the time at which the event occurred. Expressed as the difference, measured in milliseconds, with midnight, January 1, 1970 UTC.- Since:
- 2020.0
- See Also:
-
-
Method Details
-
getID
public int getID()The type of this events will always be
.TOUCH_EVENT_TYPE
-
getTouchPoints
Returns an unmodifiable list of the associatedTLcdTouchPoint
instances.- Returns:
- an unmodifiable list of the associated
TLcdTouchPoint
instances
-
getModifiedTouchPoint
Returns theTLcdTouchPoint
instance which has been modified (the onlyTLcdTouchPoint
with a state different fromTLcdTouchPoint.State.STATIONARY
).- Returns:
- the
TLcdTouchPoint
instance which has been modified
-
getStationaryTouchPoints
Returns a list containing allTLcdTouchPoint
instances which describe a touch point that has remainedstationary
.- Returns:
- a list containing all
TLcdTouchPoint
instances which describe a touch point that has remainedstationary
-
getTouchDeviceID
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.- Returns:
- the unique ID of the touch device.
- See Also:
-
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.- Returns:
- the unique ID of the user of the touch device.
- See Also:
-
getTimeStamp
public long getTimeStamp()Returns the time when the event occurred. Expressed as the difference, measured in milliseconds, with midnight, January 1, 1970 UTC.
- Returns:
- the time when the event occurred
-
getTouchEventID
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 areremoved
. Once all touch points of a certain device and user are removed, the next created touch point will- generate a new
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. - generate a new
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.
- Returns:
- the unique ID of this event
- generate a new
-
toString
-
getTouchPoint
- Parameters:
aTouchPointID
- the touch point ID- Returns:
- the requested
TLcdTouchPoint
, ornull
when this event does not contain suchTLcdTouchPoint
- See Also:
-
cloneAs
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.
- Parameters:
aTouchEventID
- the ID for the newTLcdTouchEvent
aSource
- the source component for the newTLcdTouchEvent
aTouchPointList
- theList
withTLcdTouchPoints
for the newTLcdTouchEvent
aTouchDeviceID
- the device ID for the newTLcdTouchEvent
aUserID
- the user ID for the newTLcdTouchEvent
aTimeStamp
- the time stamp for the newTLcdTouchEvent
- Returns:
- a new
TLcdTouchEvent
- Since:
- 2020.0
- See Also:
-
createTouchEventID
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 subsequentTLcdTouchEvent
s describing a new input point sequence require a differenttouch 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.- Returns:
- an ID for a touch event
- See Also:
-
fromFXEvent
Converts a native JavaFXTouchEvent
into aTLcdTouchEvent
.- Parameters:
aTouchEvent
- the JavaFX touch event- Returns:
- a TLcdTouchEvent which is created using the actual JavaFX touch event,
or
null
when the event type isTouchEvent.TOUCH_STATIONARY
- Since:
- 2020.0
-