Record Class SelectionItemFacet

java.lang.Object
java.lang.Record
limn.accessibility.SelectionItemFacet
Record Components:
selected - whether this member is selected
positionInSet - this member's one-based position, or 0 when it has none
sizeOfSet - how many members the set holds, or 0 when that is unknown
containerless - whether this member belongs to no container node at all

public record SelectionItemFacet(boolean selected, int positionInSet, int sizeOfSet, boolean containerless) extends Record
One member of a selection: a list row, a menu row, a tab, a radio button, a combo option.

The position and the size of the set are the numbers a screen reader speaks as "3 of 12", and nothing else: they are the model's numbers rather than the tree's, so a list that publishes only its realized rows still reports the true row count and a user is told where they are in the data and not where they are in the fraction of it that happens to be mounted. Which set they count is each widget's to say, and three say it differently: a list row, a tab, a menu row or a radio counts the container's members; a tree row counts its siblings, the rows at its own level under its own parent, its place in the whole outline being HierarchyFacet's; a calendar day counts the days of its own month, "15 of 30". A bridge that needs a row's index in a grid reads CellFacet, never these numbers.

A zero says there is no number: a bridge publishes nothing for it on every platform rather than "0 of 0", which is what a radio outside any group carries.

A member belongs to a container, or says it does not. The container is the nearest ancestor with a SelectionFacet, climbing from the published parent only through synthetic ancestors that lack one; it is what a selection change is raised on and what a platform's "selection container" answers. A radio button has none — a ButtonGroup is not a node — and says so with containerless(), so its selection change is never laid on whatever layout node happens to be its published parent, and a bridge asked for its container answers none rather than guessing.

  • Constructor Summary

    Constructors
    Constructor
    Description
    SelectionItemFacet(boolean selected, int positionInSet, int sizeOfSet)
    A member of a container: the shape every widget but a radio button publishes.
    SelectionItemFacet(boolean selected, int positionInSet, int sizeOfSet, boolean containerless)
    Creates an instance of a SelectionItemFacet record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the containerless record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the positionInSet record component.
    boolean
    Returns the value of the selected record component.
    int
    Returns the value of the sizeOfSet record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SelectionItemFacet

      public SelectionItemFacet(boolean selected, int positionInSet, int sizeOfSet)
      A member of a container: the shape every widget but a radio button publishes.
      Parameters:
      selected - whether this member is selected
      positionInSet - this member's one-based position, or 0 when it has none
      sizeOfSet - how many members the set holds, or 0 when that is unknown
    • SelectionItemFacet

      public SelectionItemFacet(boolean selected, int positionInSet, int sizeOfSet, boolean containerless)
      Creates an instance of a SelectionItemFacet record class.
      Parameters:
      selected - the value for the selected record component
      positionInSet - the value for the positionInSet record component
      sizeOfSet - the value for the sizeOfSet record component
      containerless - the value for the containerless record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • selected

      public boolean selected()
      Returns the value of the selected record component.
      Returns:
      the value of the selected record component
    • positionInSet

      public int positionInSet()
      Returns the value of the positionInSet record component.
      Returns:
      the value of the positionInSet record component
    • sizeOfSet

      public int sizeOfSet()
      Returns the value of the sizeOfSet record component.
      Returns:
      the value of the sizeOfSet record component
    • containerless

      public boolean containerless()
      Returns the value of the containerless record component.
      Returns:
      the value of the containerless record component