Record Class ValueFacet

java.lang.Object
java.lang.Record
limn.accessibility.ValueFacet
Record Components:
value - the current value, or the minimum when empty
min - the smallest value the node accepts
max - the largest value the node accepts
step - one increment, or 0 when the node has no step
text - the value as the node displays it, or null when the number is the whole of it
readOnly - whether the value may be read and not set
empty - whether the node holds no number at all, its range and text standing

public record ValueFacet(double value, double min, double max, double step, @Nullable String text, boolean readOnly, boolean empty) extends Record
A node whose state is a number in a range: a slider, a spinner, a progress bar, a scroll bar, a split pane's divider, a date field's segment.

It carries the number and the text, because a value can have two forms and both are wanted at once: a spinner in time mode holds 450 and displays 07:30, and one platform asks the same element for both through two different interfaces. The text is already resolved under the node's own locale; nothing downstream formats anything.

A value can say it has no number: a date segment nobody has typed into has a range and a text and nothing in between. Such a facet is empty(), keeps its min, max, step and text, and carries the minimum as its value, because two platforms have no way to answer "no number" where a number is mandatory (UIA's RangeValue.Value, AT-SPI's CurrentValue) and the minimum is what they answer there; the text and the events are what say empty. A bridge that can say it, says it from this flag and not from the number.

A value that advances on its own — a playing video's position, a determinate progress bar — is published rounded to the resolution a user can act on, by the widget. The tree compares what it is given, so an unrounded position would make the comparison find a change on every frame of playback and copy the whole tree for an hour with nobody touching anything.

A value a user may read and not set — a progress bar — says so here, because the facet's presence is what advertises a set on every platform and nothing else could take it back: Accessible.State.READ_ONLY is derived from this field, never declared, so a widget that publishes a range it refuses to accept is a range a bridge reports writable.

The tree raises AccessibleEvent.Type.VALUE_CHANGED when the number, the text or the emptiness moved: a segment filled with a digit that happens to be its minimum changes only its text and its emptiness, and a reader has to hear it.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ValueFacet(double value, double min, double max, double step, @Nullable String text, boolean readOnly)
    A value that has a number: the shape every widget but a blank segment publishes.
    ValueFacet(double value, double min, double max, double step, @Nullable String text, boolean readOnly, boolean empty)
    Creates an instance of a ValueFacet record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the empty record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    max()
    Returns the value of the max record component.
    double
    min()
    Returns the value of the min record component.
    boolean
    Returns the value of the readOnly record component.
    double
    Returns the value of the step record component.
    @Nullable String
    Returns the value of the text record component.
    final String
    Returns a string representation of this record class.
    double
    Returns the value of the value record component.

    Methods inherited from class java.lang.Object

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

    • ValueFacet

      public ValueFacet(double value, double min, double max, double step, @Nullable String text, boolean readOnly)
      A value that has a number: the shape every widget but a blank segment publishes.
      Parameters:
      value - the current value
      min - the smallest value the node accepts
      max - the largest value the node accepts
      step - one increment, or 0 when the node has no step
      text - the value as displayed, or null
      readOnly - whether the value may be read and not set
    • ValueFacet

      public ValueFacet(double value, double min, double max, double step, @Nullable String text, boolean readOnly, boolean empty)
      Creates an instance of a ValueFacet record class.
      Parameters:
      value - the value for the value record component
      min - the value for the min record component
      max - the value for the max record component
      step - the value for the step record component
      text - the value for the text record component
      readOnly - the value for the readOnly record component
      empty - the value for the empty 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • value

      public double value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • min

      public double min()
      Returns the value of the min record component.
      Returns:
      the value of the min record component
    • max

      public double max()
      Returns the value of the max record component.
      Returns:
      the value of the max record component
    • step

      public double step()
      Returns the value of the step record component.
      Returns:
      the value of the step record component
    • text

      public @Nullable String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • readOnly

      public boolean readOnly()
      Returns the value of the readOnly record component.
      Returns:
      the value of the readOnly record component
    • empty

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