Interface EntryVisitor<R>

Type Parameters:
R - what each visit method returns, e.g. the created widget, or Void

public interface EntryVisitor<R>
One method per entry type, for code that must handle every widget: a backend implements it to create the vanilla widget for each entry, and the test fixture's FakeHost to render and drive them. Adding an entry type adds a method here, so every backend fails to compile until it handles the new type.

Call it through Entry.accept(EntryVisitor):

for (Entry e : screen.entries()) {
    if (e.visible()) {
        Widget w = e.accept(widgetFactory);   // widgetFactory implements EntryVisitor<Widget>
    }
}

Some widgets need no method of their own: StringListEditor expands into plain entries, a NumberField is visited as its TextInput and a Section as its header Button or Label (its children are ordinary entries, Entry.visible only while it is expanded). TODO.md Phase 11 says what each backend draws for the methods from visitSlider(Slider) on.

Mods rarely need this interface; it is part of the backend contract.

  • Method Details

    • visitButton

      R visitButton(Button button)
      A push button; also a collapsible Section's header.
      Parameters:
      button - the button to handle
      Returns:
      the visitor's result for it
    • visitToggle

      R visitToggle(Toggle toggle)
      An on/off button, "label: ON/OFF".
      Parameters:
      toggle - the on/off button to handle
      Returns:
      the visitor's result for it
    • visitCycle

      R visitCycle(Cycle<?> cycle)
      A button that steps through values, "label: value".
      Parameters:
      cycle - the stepping button to handle
      Returns:
      the visitor's result for it
    • visitTextInput

      R visitTextInput(TextInput input)
      A one-line text field; also every NumberField (visited as its NumberField.input()).
      Parameters:
      input - the one-line text field to handle
      Returns:
      the visitor's result for it
    • visitLabel

      R visitLabel(Label label)
      A line of text; also a non-collapsible Section's header.
      Parameters:
      label - the line of text to handle
      Returns:
      the visitor's result for it
    • visitSelectList

      R visitSelectList(SelectList list)
      A scrolling list of selectable rows.
      Parameters:
      list - the list to handle
      Returns:
      the visitor's result for it
    • visitStatusLine

      R visitStatusLine(StatusLine status)
      A line showing the result of the screen's last action.
      Parameters:
      status - the status line to handle
      Returns:
      the visitor's result for it
    • visitSlider

      R visitSlider(Slider slider)
      A slider over a number range.
      Parameters:
      slider - the slider to handle
      Returns:
      the visitor's result for it
    • visitCheckbox

      R visitCheckbox(Checkbox checkbox)
      A check box with its label to the right.
      Parameters:
      checkbox - the check box to handle
      Returns:
      the visitor's result for it
    • visitKeybind

      R visitKeybind(Keybind keybind)
      A key binding button.
      Parameters:
      keybind - the key binding button to handle
      Returns:
      the visitor's result for it
    • visitMultiLineInput

      R visitMultiLineInput(MultiLineInput input)
      A multi-line text box.
      Parameters:
      input - the multi-line text box to handle
      Returns:
      the visitor's result for it
    • visitDropdown

      R visitDropdown(Dropdown<?> dropdown)
      A button that opens a picker list, drawn like a Cycle.
      Parameters:
      dropdown - the picker button to handle
      Returns:
      the visitor's result for it
    • visitColorPicker

      R visitColorPicker(ColorPicker picker)
      A color button with a swatch, opening an editor screen.
      Parameters:
      picker - the color button to handle
      Returns:
      the visitor's result for it