Class HeadlessWindow.CapturingBridge
- All Implemented Interfaces:
AccessibilityBridge
- Enclosing class:
HeadlessWindow
-
Nested Class Summary
Nested classes/interfaces inherited from interface limn.backend.AccessibilityBridge
AccessibilityBridge.Host -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List<AccessibleEvent> Every event handed over, in order, across every publish.@Nullable AccessibilityBridge.HostThe scene-side half this bridge holds, through which a test performs a verb.intHow many trees were handed over.Fields inherited from interface limn.backend.AccessibilityBridge
NONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidattach(AccessibilityBridge.Host newHost) Hands the bridge the scene-side half, replacing any host it already held.voiddetach()The window is going away: raises a window-closed, then empties whatever it was holding.voidemit(AccessibleEvent event) One coalesced event, naming a node in the tree just published.eventsOf(AccessibleEvent.Type type) booleanWhether any assistive technology is listening.voidpublish(AccessibleTree published, boolean reentrant) Hands over a fresh whole-window snapshot.tree()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface limn.backend.AccessibilityBridge
frameEnded, needsPrimingPublish, needsRootBeforeTheFirstFrame
-
Field Details
-
events
Every event handed over, in order, across every publish. -
publishes
public int publishesHow many trees were handed over. -
host
The scene-side half this bridge holds, through which a test performs a verb.
-
-
Constructor Details
-
CapturingBridge
public CapturingBridge()
-
-
Method Details
-
attach
Description copied from interface:AccessibilityBridgeHands the bridge the scene-side half, replacing any host it already held.A scene can be bound over a live window and the outgoing one never learns it was, so the bridge is the only object that knows there was a tree to close. That is why the window pair is raised here rather than by the caller: an implementation empties its element registry and raises a window-closed for the host it is replacing, if there was one, then raises a window-opened for the incoming one. On a first attach only the second is raised.
It builds and pushes no tree, on any platform. At this moment the scene has never laid out, so every box in it would be a zero-size rectangle at the origin.
- Specified by:
attachin interfaceAccessibilityBridge- Parameters:
newHost- what the scene answers with
-
detach
public void detach()Description copied from interface:AccessibilityBridgeThe window is going away: raises a window-closed, then empties whatever it was holding.- Specified by:
detachin interfaceAccessibilityBridge
-
isListening
public boolean isListening()Description copied from interface:AccessibilityBridgeWhether any assistive technology is listening.Asked once per frame on the publish path, and on the two rare paths that have to know whether spending a frame is worth it at all. It must therefore be cheap: one platform call, or a flag the bridge already keeps.
It is never "did a client ask us something recently." A gate of that shape inverts the contract on all three platforms, because a platform event is a push a client waits on: one of the three screen readers registers for a focus change and then calls nothing at all until it fires. Tab twice quickly with such a gate and the toolkit goes silent — the client only asks after an event, and the event only fires after the client asks.
- Specified by:
isListeningin interfaceAccessibilityBridge- Returns:
- whether anything is reading this window
-
publish
Description copied from interface:AccessibilityBridgeHands over a fresh whole-window snapshot. User-interface thread.reentrantis true when the scene built this tree from inside the platform's own callback, with the platform on the stack holding elements this bridge vended. A reentrant publish stores the tree and answers from it, and does nothing else: it must not destroy or release anything in its element registry, must not re-push the top of its tree, and must not drain its event queue — each of those would act on the objects the caller is standing on. Everything it defers is owed by the next ordinary frame, which the scene has already asked for.- Specified by:
publishin interfaceAccessibilityBridge- Parameters:
published- the window as it now standsreentrant- whether the platform is on the stack
-
emit
Description copied from interface:AccessibilityBridgeOne coalesced event, naming a node in the tree just published. User-interface thread.Enqueue it; do not raise it. A difference between two frames of a scrolling list or a dragged slider can be hundreds of nodes wide, and every raise is a cross-process call: a bridge that raised them here would spend the frame budget inside the platform, which is precisely the stall that makes a window unreadable to the user it is being read to.
- Specified by:
emitin interfaceAccessibilityBridge- Parameters:
event- what happened
-
tree
- Returns:
- the newest tree the scene published, or the empty one
-
eventsOf
- Parameters:
type- the kind to look for- Returns:
- every event of that kind handed over so far, in order
-