Interface RowsSubject


public interface RowsSubject
A widget of the ROWS shape as the rows contract sees it: something that publishes a selection and members of it, which the contract can build fresh, read the selection and the cursor of through the widget's own API, and ask three things about that the published tree cannot say. Those three are the variants of the shape: whether the cursor is the selection or separate from it, how rows beyond the box are reached, and whether there is a multiple selection to enter.

A subject builds its rows as plain cells that cannot take the keyboard, so that what the contract reads on a row is the row's and not the walk's free verbs on a focusable child. The rows are named, uniquely, in tree order; "row i" everywhere below is the ith name of rowNames(), which is also the ith member the tree publishes while nothing has scrolled.

  • Method Details

    • build

      Widget<?> build()
      Builds a fresh widget with the rows rowNames() names, nothing selected, and returns the root to bind: the widget itself, or a box around it that makes the box smaller than the rows when scrolling() is not RowsSubject.Scrolling.NONE. Called once per case.
    • widget

      Widget<?> widget()
      Returns:
      the widget build() made last: the container whose rows these are
    • rowNames

      List<String> rowNames()
      Returns:
      the rows' names, unique, in tree order
    • cursorIsTheSelection

      boolean cursorIsTheSelection()
      Returns:
      true where the cursor is the selection (a list, a segmented control, a tab strip); false where a row can be the cursor without being selected (a tree, a table, a calendar)
    • scrolling

      Returns:
      how a row beyond the box is reached
    • rowsActivate

      boolean rowsActivate()
      Returns:
      true where a row has an activation of its own that PRESS performs (a tree's row opens, a table's row is activated, a tab dives into its panel); false where it has none (a list, whose PRESS is the container's and acts on the selection; a segment; a calendar's day, which is only picked)
    • enterMultipleSelection

      boolean enterMultipleSelection()
      Puts the widget into multiple selection through its API.
      Returns:
      false when the widget has no multiple selection, in which case nothing changed
    • select

      void select(int row)
      Selects row row through the widget's API, as an application would.
    • selectedRows

      List<Integer> selectedRows()
      Returns:
      the rows the widget's API says are selected, ascending
    • cursorRow

      int cursorRow()
      Returns:
      the row the widget's API says is the cursor, or -1 when there is none; where the cursor is the selection, the selected row
    • lastActivated

      int lastActivated()
      Returns:
      the row last activated through the widget's own callback, or -1
    • containerless

      default boolean containerless()
      Returns:
      whether the members have no container node of their own — a radio group, whose rows are widgets and whose group is not: the contract then reads the members' common parent as the box, expects the cursor to be the selection, and hears the selection change on the members that moved rather than on a container
    • empty

      default boolean empty(Widget<?> content, Label message)
      Takes every row away through the widget's API and gives it content as what it shows while it holds none, with message, a label inside the content, as what describes it then. Called on a bound widget; the contract publishes a frame after it.
      Parameters:
      content - what shows while there are no rows
      message - the label inside it that says why
      Returns:
      false where the widget has no empty content (a segmented control, a tab strip, a radio group, a calendar), in which case nothing changed
    • selectionAspect

      default Change.Aspect selectionAspect()
      Returns:
      the aspect the subject announces a selection change under: SELECTION for a container's; a radio group spells its one change as VALUE on each member