Package tripleplay.ui

Class Selector

java.lang.Object
tripleplay.ui.Selector

public class Selector extends Object
Maintains a single selected item among a specified set of Element instances. The elements may be added individually, or the children of an Elements may be tracked automatically.

A click on a tracked element that implements Clickable makes it the selected item, or selected can be used to manually control the selected item.

  • Field Details

    • selected

      public final react.Value<Element<?>> selected
      The selected item. May be updated to set the selection manually.
  • Constructor Details

    • Selector

      public Selector()
      Create a selector with a null initial selection.
    • Selector

      public Selector(Elements<?> elements, Element<?> initialSelection)
      Creates a selector containing the children of elements with initialSelection selected.
  • Method Details

    • add

      public Selector add(Elements<?> elements)
      Tracks the children of elements for setting the selection. Children subsequently added or removed from elements are automatically handled appropriately.
    • preventDeselection

      public Selector preventDeselection()
      Prevent a deselection (null selected.get()) occurring as a result of toggling the currently selected button off.
    • remove

      public Selector remove(Elements<?> elements)
      Stops tracking the children of elements for setting the selection.
    • add

      public Selector add(Element<?> elem, Element<?>... more)
      Tracks one or more elements.
    • remove

      public Selector remove(Element<?> elem, Element<?>... more)
      Stops tracking one or more elements.