Class StateNames

java.lang.Object
limn.accessibility.StateNames

public final class StateNames extends Object
What a state is called, in the user's language, for the one platform field that carries a state as words rather than as a bit.

That field is UI Automation's ItemStatus, and today the only state spoken through it is Accessible.State.BUSY. AT-SPI2 has a busy bit, and a reader there translates it itself. AppKit has a boolean attribute. UI Automation has neither: an item that is working says so in a status string the client reads out, so the toolkit has to supply the word, just as RoleNames supplies the eight role phrases UI Automation has no word for. A state with no phrase here is one no platform needs in words, and answers null.

Resolved under the node's own locale, not the ambient one, and registered from the walk for RoleNames's reason: a bridge answers from the platform's threads, and registering a bundle has to happen on the user-interface thread.

  • Method Details

    • ofToggle

      public static String ofToggle(ToggleFacet.State toggle, boolean isSwitch, Locale locale)
      The word a toggle's state is spoken as, where a bridge has to say it in a sentence of its own: a switch is on or off, anything else that toggles is checked, not checked or mixed. VoiceOver says it itself for a focused toggle; this is for the one sentence the macOS bridge speaks for a table cell the user moved onto while the table keeps the focus, as a native table does.
      Parameters:
      toggle - the toggle's state
      isSwitch - whether the node is a switch, which is on or off rather than checked
      locale - the node's own locale
      Returns:
      the word, or the English when nothing translates it
    • keyFor

      public static String keyFor(Accessible.State state)
      Parameters:
      state - a state
      Returns:
      the key its phrase lives under, limn.state.<lower-case-name>
    • of

      public static @Nullable String of(Accessible.State state, Locale locale)
      Parameters:
      state - a state
      locale - the locale to speak in, which is the node's own and not the process's
      Returns:
      the phrase, or the English when nothing translates it, or null for a state no platform carries as words
    • englishOf

      public static @Nullable String englishOf(Accessible.State state)
      Parameters:
      state - a state
      Returns:
      the English phrase without consulting any bundle, or null when there is none