Top Description Inners Fields Constructors Methods
com.sun.glass.ui.monocle

pack-priv Class TouchState

extends Object
Class Inheritance
Imports
java.util.Arrays, .Comparator

TouchState is a snapshot of touch points and their coordinates. TouchState is used both to store the current state of touch input and to describe changes to that state. A TouchState contains a number of Points. Each point has a unique ID, which is either assigned by a touch driver, or by JavaFX's input processing code. One touch point is defined as the primary touch point; it is this touch point's coordinates that are used to determine the coordinates of synthesized mouse events.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
TouchState.Point

Describes a single touch point

Field Summary

Modifier and TypeField and Description
private int
private static Comparator<TouchState.Point>
private TouchState.Point[]
private int
private MonocleWindow

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv TouchState.Point

Returns:

the Point with the data for the new touch point. The fields of this Point may be modified directly to change the data for the new touch point.
addPoint
(TouchState.Point
the Point describing the data to add, or null if no data is available yet for this point. p is not modified, but its contents are copied to the object describing the new Point.
p
)

Adds a Point to this state object.

pack-priv void
assignPrimaryID()

Updates the primary point ID

pack-priv boolean
canBeFoldedWith(TouchState
the TouchState to compare to
ts
,
boolean
if true, ignore IDs when comparing points
ignoreIDs
)

Finds out whether two non-null states are identical in everything but their touch point coordinates

pack-priv void
clear()

Removes all touch points from this state.

pack-priv void
clearWindow()

Clears the cached window.

pack-priv void
copyTo(TouchState
The TouchState to which to copy this state's data.
target
)

Copies the contents of this state object to another.

pack-priv boolean
equalsSorted(TouchState ts)

Compare two non-null states whose points are sorted by ID

pack-priv TouchState.Point

Returns:

A touch point.
getPoint
(int
The index of the point point to return. index should be less than the value returned by getPointCount().
index
)

Returns the nth point in the toich point list, for index n

pack-priv int

Returns:

the number of touch points
getPointCount
()

Returns the number of touch points pressed.

pack-priv TouchState.Point

Returns:

a matching Point, or null if there is no point with that ID.
getPointForID
(int
The Point ID to match. A value of -1 matches any Point.
id
)

Gets the Point matching the given ID. if available

pack-priv int
getPrimaryID()

Returns the touch point ID of the primary point.

pack-priv MonocleWindow
getWindow(boolean
true if the cached value should be discarded and recomputed
recalculateCache
,
MonocleWindow
the window to use if no primary ID is available
fallback
)

Returns the Glass window on which this event state is located.

pack-priv void
removePointForID(int
The ID of the touch point which is to be removed.
id
)

Removes the point with the given ID

pack-priv void
setPoint(int
the index at which to change the touch point data
index
,
TouchState.Point
the data to copy to the given index.
p
)

Replaces the touch point data at the given index with the given touch point data

pack-priv void
sortPointsByID()

Modifies the ordering touch points in this state object so that the points are sorted in increasing order of ID.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

pointCountback to summary
private int pointCount
pointIdComparatorback to summary
private static Comparator<TouchState.Point> pointIdComparator
pointsback to summary
private TouchState.Point[] points
primaryIDback to summary
private int primaryID
windowback to summary
private MonocleWindow window

Constructor Detail

TouchStateback to summary
pack-priv TouchState()

Method Detail

addPointback to summary
pack-priv TouchState.Point addPoint(TouchState.Point p)

Adds a Point to this state object.

Parameters
p:TouchState.Point

the Point describing the data to add, or null if no data is available yet for this point. p is not modified, but its contents are copied to the object describing the new Point.

Returns:TouchState.Point

the Point with the data for the new touch point. The fields of this Point may be modified directly to change the data for the new touch point.

assignPrimaryIDback to summary
pack-priv void assignPrimaryID()

Updates the primary point ID

canBeFoldedWithback to summary
pack-priv boolean canBeFoldedWith(TouchState ts, boolean ignoreIDs)

Finds out whether two non-null states are identical in everything but their touch point coordinates

Parameters
ts:TouchState

the TouchState to compare to

ignoreIDs:boolean

if true, ignore IDs when comparing points

clearback to summary
pack-priv void clear()

Removes all touch points from this state.

clearWindowback to summary
pack-priv void clearWindow()

Clears the cached window.

copyToback to summary
pack-priv void copyTo(TouchState target)

Copies the contents of this state object to another.

Parameters
target:TouchState

The TouchState to which to copy this state's data.

equalsSortedback to summary
pack-priv boolean equalsSorted(TouchState ts)

Compare two non-null states whose points are sorted by ID

getPointback to summary
pack-priv TouchState.Point getPoint(int index)

Returns the nth point in the toich point list, for index n

Parameters
index:int

The index of the point point to return. index should be less than the value returned by getPointCount().

Returns:TouchState.Point

A touch point.

getPointCountback to summary
pack-priv int getPointCount()

Returns the number of touch points pressed.

Returns:int

the number of touch points

getPointForIDback to summary
pack-priv TouchState.Point getPointForID(int id)

Gets the Point matching the given ID. if available

Parameters
id:int

The Point ID to match. A value of -1 matches any Point.

Returns:TouchState.Point

a matching Point, or null if there is no point with that ID.

getPrimaryIDback to summary
pack-priv int getPrimaryID()

Returns the touch point ID of the primary point.

getWindowback to summary
pack-priv MonocleWindow getWindow(boolean recalculateCache, MonocleWindow fallback)

Returns the Glass window on which this event state is located. assignPrimaryID() should be called before this method.

Parameters
recalculateCache:boolean

true if the cached value should be discarded and recomputed

fallback:MonocleWindow

the window to use if no primary ID is available

removePointForIDback to summary
pack-priv void removePointForID(int id)

Removes the point with the given ID

Parameters
id:int

The ID of the touch point which is to be removed.

setPointback to summary
pack-priv void setPoint(int index, TouchState.Point p)

Replaces the touch point data at the given index with the given touch point data

Parameters
index:int

the index at which to change the touch point data

p:TouchState.Point

the data to copy to the given index.

sortPointsByIDback to summary
pack-priv void sortPointsByID()

Modifies the ordering touch points in this state object so that the points are sorted in increasing order of ID.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
com.sun.glass.ui.monocle back to summary

pack-priv Class TouchState.Point

extends Object
Class Inheritance

Describes a single touch point

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
x

pack-priv int
y

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
copyTo(TouchState.Point
the Point object to which to copy this object's data
target
)

Copies a touch point's data to a target Point

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

idback to summary
pack-priv int id
xback to summary
pack-priv int x
yback to summary
pack-priv int y

Constructor Detail

Pointback to summary
pack-priv Point()

Method Detail

copyToback to summary
pack-priv void copyTo(TouchState.Point target)

Copies a touch point's data to a target Point

Parameters
target:TouchState.Point

the Point object to which to copy this object's data

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override