Interface EntryVisitor<R>
- Type Parameters:
R- what each visit method returns, e.g. the created widget, orVoid
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 Summary
Modifier and TypeMethodDescriptionvisitButton(Button button) A push button; also a collapsibleSection's header.visitCheckbox(Checkbox checkbox) A check box with its label to the right.visitColorPicker(ColorPicker picker) A color button with a swatch, opening an editor screen.visitCycle(Cycle<?> cycle) A button that steps through values, "label: value".visitDropdown(Dropdown<?> dropdown) A button that opens a picker list, drawn like aCycle.visitKeybind(Keybind keybind) A key binding button.visitLabel(Label label) A line of text; also a non-collapsibleSection's header.A multi-line text box.visitSelectList(SelectList list) A scrolling list of selectable rows.visitSlider(Slider slider) A slider over a number range.visitStatusLine(StatusLine status) A line showing the result of the screen's last action.visitTextInput(TextInput input) A one-line text field; also everyNumberField(visited as itsNumberField.input()).visitToggle(Toggle toggle) An on/off button, "label: ON/OFF".
-
Method Details
-
visitButton
-
visitToggle
-
visitCycle
-
visitTextInput
A one-line text field; also everyNumberField(visited as itsNumberField.input()).- Parameters:
input- the one-line text field to handle- Returns:
- the visitor's result for it
-
visitLabel
-
visitSelectList
A scrolling list of selectable rows.- Parameters:
list- the list to handle- Returns:
- the visitor's result for it
-
visitStatusLine
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
-
visitCheckbox
-
visitKeybind
-
visitMultiLineInput
A multi-line text box.- Parameters:
input- the multi-line text box to handle- Returns:
- the visitor's result for it
-
visitDropdown
-
visitColorPicker
A color button with a swatch, opening an editor screen.- Parameters:
picker- the color button to handle- Returns:
- the visitor's result for it
-