Class AccessibleEvent
An event carries its own values. It is handed to a bridge on the user-interface thread immediately after the tree it describes, and raised later, from a bounded queue on a thread of the bridge's own: raising inline would spend the frame budget in cross-process calls, which is exactly the stall that makes a window unreadable. By the time it is raised, the tree it came from may be two publishes old, so a bridge that raised the event and then read "the current value" would report the newest value under an older event. The values are therefore here.
The one thing an event may never carry is a widget, for the reason no node carries one.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne child of aAccessibleEvent.Type.STRUCTURE_CHANGED's node, and what happened to it.static enumWhat happened. -
Method Summary
Modifier and TypeMethodDescriptionstatic AccessibleEventannouncement(String text, Accessible.Politeness politeness) Something the application said out loud.intinserted()boolean@Nullable ObjectnewValue()longnodeId()static AccessibleEventof(AccessibleEvent.Type type, long nodeId) An event that names a node and carries nothing else: a focus move, a structure change, a destruction, a window opening.intoffset()@Nullable ObjectoldValue()@Nullable Accessible.Politenessstatic AccessibleEventproperty(AccessibleEvent.Type type, long nodeId, @Nullable Object oldValue, @Nullable Object newValue) A property that moved, carrying what it was and what it is.intremoved()static AccessibleEventselection(long containerId, boolean multiSelectable, long[] added, long[] removed) A container's selection moved.@Nullable Accessible.Statestate()static AccessibleEventstate(long nodeId, Accessible.State state, boolean now) One state bit that flipped.static AccessibleEventstructure(long parentId, List<AccessibleEvent.Child> added, List<AccessibleEvent.Child> removed, List<AccessibleEvent.Child> reordered) A parent's children moved.static AccessibleEventA text edit, with the range it replaced.toString()type()
-
Method Details
-
of
An event that names a node and carries nothing else: a focus move, a structure change, a destruction, a window opening.- Parameters:
type- what happenednodeId- the node it happened to, or0for a window-level event- Returns:
- the event
- Throws:
NullPointerException- iftypeisnull
-
property
public static AccessibleEvent property(AccessibleEvent.Type type, long nodeId, @Nullable Object oldValue, @Nullable Object newValue) A property that moved, carrying what it was and what it is.- Parameters:
type- which property; a name, a description, a value, a selection or a boxnodeId- the node it moved onoldValue- what it was, ornullwhen there was nothingnewValue- what it is now, ornull- Returns:
- the event
- Throws:
NullPointerException- iftypeisnull
-
state
One state bit that flipped.- Parameters:
nodeId- the node it flipped onstate- which bitnow- what it is now- Returns:
- the event
- Throws:
NullPointerException- ifstateisnull
-
text
public static AccessibleEvent text(long nodeId, int offset, int removed, int inserted, String oldText, String newText) A text edit, with the range it replaced.The offsets are computed by comparing the two published strings rather than reported by the editing model, so two edits landing in one frame yield one contiguous replaced range covering both — which every platform can carry and none can distinguish from the truth.
- Parameters:
nodeId- the node whose text changedoffset- where the replaced range begins, in UTF-16 code unitsremoved- how many units it removedinserted- how many it insertedoldText- the text as it wasnewText- the text as it is- Returns:
- the event
-
selection
public static AccessibleEvent selection(long containerId, boolean multiSelectable, long[] added, long[] removed) A container's selection moved.- Parameters:
containerId- the container the members belong tomultiSelectable- whether it selects more than one member at onceadded- the members that entered its selection in this publish, in reading order; a member new in this publish includedremoved- the members that left it, in the previous publish's reading order; a member that left the tree included- Returns:
- the event
- Throws:
NullPointerException- if either array isnull
-
structure
public static AccessibleEvent structure(long parentId, List<AccessibleEvent.Child> added, List<AccessibleEvent.Child> removed, List<AccessibleEvent.Child> reordered) A parent's children moved.- Parameters:
parentId- the surviving parent whose children changedadded- the children now under it that were not, in reading orderremoved- the children that were under it and are not, in their former orderreordered- the surviving children whose place among their surviving siblings moved, in reading order- Returns:
- the event
- Throws:
NullPointerException- if any list isnull
-
announcement
Something the application said out loud.- Parameters:
text- what to say, already resolved in the scene's languagepoliteness- whether it waits for the assistive technology to finish, or interrupts it- Returns:
- the event
- Throws:
NullPointerException- if either argument isnull
-
type
- Returns:
- what happened; never
null
-
nodeId
public long nodeId()- Returns:
- the node this happened to, or
0for an event whose subject is the window itself or the application speaking
-
state
- Returns:
- which state flipped, for a
AccessibleEvent.Type.STATE_CHANGED;nullfor every other kind
-
politeness
- Returns:
- whether an announcement interrupts, for a
AccessibleEvent.Type.ANNOUNCEMENT;nullfor every other kind
-
oldValue
-
newValue
- Returns:
- what the property is now, in the same types
oldValue()lists
-
offset
public int offset()- Returns:
- where a text change begins, in UTF-16 code units;
0for every other kind
-
removed
public int removed()- Returns:
- how many code units a text change removed
-
inserted
public int inserted()- Returns:
- how many it inserted
-
addedMembers
- Returns:
- for a
AccessibleEvent.Type.SELECTION_CHANGED, the members that entered the container's selection in this publish, in reading order; empty for every other kind. Never modifiable.
-
removedMembers
- Returns:
- for a
AccessibleEvent.Type.SELECTION_CHANGED, the members that left the container's selection in this publish, a member that left the tree included; empty for every other kind. Never modifiable.
-
multiSelectable
public boolean multiSelectable()- Returns:
- for a
AccessibleEvent.Type.SELECTION_CHANGED, whether the container selects more than one member at once, which is what decides between a platform's single-selection and add-to/remove-from-selection events;falsefor every other kind
-
addedChildren
- Returns:
- for a
AccessibleEvent.Type.STRUCTURE_CHANGED, the children now under the node that were not under it in the previous publish — new in the tree, or moved here from the parent each names — in reading order; empty for every other kind. Never modifiable.
-
removedChildren
- Returns:
- for a
AccessibleEvent.Type.STRUCTURE_CHANGED, the children that were under the node in the previous publish and are not now — gone from the tree, or moved to the parent each names — in their former order; empty for every other kind. Never modifiable.
-
reorderedChildren
- Returns:
- for a
AccessibleEvent.Type.STRUCTURE_CHANGED, the surviving children whose place among their surviving siblings moved, in reading order, each with its index now; empty for every other kind, and for a publish that only added or removed. Never modifiable.
-
toString
-