Enum Class Shape

java.lang.Object
java.lang.Enum<Shape>
limn.accessibility.Shape
All Implemented Interfaces:
Serializable, Comparable<Shape>, Constable

public enum Shape extends Enum<Shape>
What a published node is, read off its role and its facets and never declared: a menu row, a grid cell, a row of a selection, the owner of a popup, a toggle, a value, a text, a pressable leaf, a sentence, or a surface. A widget publishes facts through the builder as it always did; this is the one place that says which of the ten shapes those facts add up to, and it is the name a widget-side helper, a per-shape contract and a bridge adapter all refer to. A node that is none of them is UNCLASSIFIED, which the gallery's ratchet refuses, so that a new widget cannot publish a combination nothing downstream has a name for.

Why derived and not a field. A field on the node would be one more thing for three platform tables to translate and for a reader on a guest to be shown, and it could disagree with the facets beside it. A derivation costs the bridges nothing, is exact by construction, and is tested in the model; what a field would have caught — a widget that declares one shape and publishes another — the shape's contract catches instead.

The order below is the rule. Each shape is claimed by a facet or by the closed family of roles that implies that facet, and a node with two candidates takes the first that matches, reading the constants top to bottom. The role families are there so that a shape does not change with state: a disabled button loses its verbs to the walk and an indeterminate progress bar has no value, and each is still what it was. Where a facet and a role disagree the earlier shape wins, which is how:

  1. a check menu item carrying a toggle, and a menu title carrying a popup, are MENU rows (the family comes before any facet);
  2. a table's row, a selection member without a cell, is a ROWS member under a GRID container, and a calendar's week row, which is in no selection, is a GRID row;
  3. a widget hung under a synthetic row keeps its own shape: the CellFacet the table writes onto it is its position, which a grid adapter reads on any node, and not its shape — a switch in a cell is a TOGGLE;
  4. a combo box, which carries a value (its index in its options), is the POPUP_OWNER of its list, because the popup is decided ahead of the value;
  5. a search field, which offers PRESS, is a TEXT, because the text is decided ahead of the leaf.
The role enum stays closed and nothing here adds to it. Nothing here reads a widget: the classification is over the published node alone, so the same function serves the toolkit's tests, the demo's gallery ratchet and every bridge.

A 1.x minor release may add constants to this enum: a switch over it needs a default branch.

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    A table and its grid: the TABLE (or any node carrying a TableFacet), its COLUMN_HEADERs and CELLs, and a ROW that is in no selection.
    A leaf that can be pressed and is nothing else: a BUTTON, or any node offering PRESS that no earlier shape claimed.
    A menu bar, a menu, or a row of one: MENU_BAR, MENU, MENU_ITEM, CHECK_MENU_ITEM, RADIO_MENU_ITEM.
    A node that opens something: HAS_POPUP on it, an ExpandFacet, or the COMBO_BOX role.
    A container that holds a selection and the members that are in it: a LIST, a TREE, a TAB_LIST, a RADIO_GROUP, a table's or a calendar's rows; a LIST_ITEM, a TREE_ITEM, a TAB, a RADIO_BUTTON, a segment, a selectable ROW; and any other node carrying a SelectionFacet or a SelectionItemFacet.
    A sentence a reader reads and cannot act on: a LABEL, a HEADING, an ALERT.
    A surface with a role and none of the above: a window, a dialog, a group, a scroll pane, a tool bar, a tab panel, a split pane, a canvas, an image, a video, a chart, a separator, a colour chooser.
    A node with a TextFacet, or a TEXT_FIELD, a TEXT_AREA, a PASSWORD_FIELD, a SEARCH_FIELD.
    A node with a ToggleFacet, or a CHECK_BOX, a SWITCH, a TOGGLE_BUTTON, a CHART_SERIES.
    No shape: only a node whose role is UNKNOWN, which the walk already refuses to publish.
    A node with a ValueFacet, or a SLIDER, a SPIN_BUTTON, a PROGRESS_BAR (also while indeterminate, when it carries no value), a SCROLL_BAR, a SPLITTER: a date field's segment and a colour picker's rail are spin buttons and sliders.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Whether a role belongs to the menu family, which decides MENU before any facet.
    static Shape
    Classifies a published node by the order the constants are declared in.
    static Shape
    Returns the enum constant of this class with the specified name.
    static Shape[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • GRID

      public static final Shape GRID
      A table and its grid: the TABLE (or any node carrying a TableFacet), its COLUMN_HEADERs and CELLs, and a ROW that is in no selection. A grid is rows whose members carry cells, so a table's selectable row is a ROWS member under a GRID container, and the grid's rules (a cell is found by its facet; a header sorts) are added on top of the rows' rules. A cell facet on a node of another role is that node's position in the grid, not its shape.
    • ROWS

      public static final Shape ROWS
      A container that holds a selection and the members that are in it: a LIST, a TREE, a TAB_LIST, a RADIO_GROUP, a table's or a calendar's rows; a LIST_ITEM, a TREE_ITEM, a TAB, a RADIO_BUTTON, a segment, a selectable ROW; and any other node carrying a SelectionFacet or a SelectionItemFacet. What the reader does to a row — select, add, deselect, focus, press, expand, collapse, scroll into view — is one set of rules, whichever widget publishes the row.
    • TOGGLE

      public static final Shape TOGGLE
      A node with a ToggleFacet, or a CHECK_BOX, a SWITCH, a TOGGLE_BUTTON, a CHART_SERIES.
    • VALUE

      public static final Shape VALUE
      A node with a ValueFacet, or a SLIDER, a SPIN_BUTTON, a PROGRESS_BAR (also while indeterminate, when it carries no value), a SCROLL_BAR, a SPLITTER: a date field's segment and a colour picker's rail are spin buttons and sliders.
    • TEXT

      public static final Shape TEXT
      A node with a TextFacet, or a TEXT_FIELD, a TEXT_AREA, a PASSWORD_FIELD, a SEARCH_FIELD.
    • LEAF_ACTION

      public static final Shape LEAF_ACTION
      A leaf that can be pressed and is nothing else: a BUTTON, or any node offering PRESS that no earlier shape claimed.
    • STATIC

      public static final Shape STATIC
      A sentence a reader reads and cannot act on: a LABEL, a HEADING, an ALERT.
    • SURFACE

      public static final Shape SURFACE
      A surface with a role and none of the above: a window, a dialog, a group, a scroll pane, a tool bar, a tab panel, a split pane, a canvas, an image, a video, a chart, a separator, a colour chooser. The walk's free verbs and, on a scroll pane, the ScrollFacet are all it carries.
    • UNCLASSIFIED

      public static final Shape UNCLASSIFIED
      No shape: only a node whose role is UNKNOWN, which the walk already refuses to publish. Kept so that the classification is total and the gallery ratchet has something to refuse.
  • Method Details

    • values

      public static Shape[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Shape valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • of

      public static Shape of(AccessibleNode node)
      Classifies a published node by the order the constants are declared in.
      Parameters:
      node - a node of a published tree
      Returns:
      its shape; UNCLASSIFIED only for an UNKNOWN role
    • isMenuRole

      public static boolean isMenuRole(Accessible.Role role)
      Whether a role belongs to the menu family, which decides MENU before any facet.
      Parameters:
      role - a role
      Returns:
      true for MENU_BAR, MENU, MENU_ITEM, CHECK_MENU_ITEM and RADIO_MENU_ITEM