Class Entry.Builder<B extends Entry.Builder<B>>
java.lang.Object
dev.xichil.mvui.Entry.Builder<B>
- Type Parameters:
B- the concrete builder type, returned by every setter
- Direct Known Subclasses:
Button.Builder, Checkbox.Builder, ColorPicker.Builder, Cycle.Builder, Dropdown.Builder, Keybind.Builder, Label.Builder, MultiLineInput.Builder, NumberField.Builder, Section.Builder, SelectList.Builder, Slider.Builder, StatusLine.Builder, TextInput.Builder, Toggle.Builder
- Enclosing class:
Entry
The options every entry builder has. Each widget's builder extends it, so these setters chain with the widget's
own (
Toggle.builder("x").label(…).enabled(…).build()) and return that builder type.
Every setter that takes a supplier also has a constant overload; the supplier form is re-read on every
refresh. A required field that is missing or null makes build() throw
IllegalStateException naming the widget and the field; setters of optional fields reject null at
once, with the same exception.
-
Method Summary
Modifier and TypeMethodDescriptionenabled(boolean enabled) A fixed enabled state; seeenabled(BooleanSupplier).enabled(BooleanSupplier enabled) Whether the widget can be used, re-read on every refresh.A fixed tooltip; seetooltip(Supplier).The tooltip shown while the mouse is over the widget, re-read on every refresh; the supplier may returnnullfor no tooltip at that moment.visible(BooleanSupplier visible) Shows the entry only whilevisibleis true, re-read on every refresh.
-
Method Details
-
enabled
Whether the widget can be used, re-read on every refresh. While false it is drawn greyed out and ignores input; it still shows its label, value and tooltip. Default: always enabled.- Parameters:
enabled- read on refresh- Returns:
- this builder
-
enabled
A fixed enabled state; seeenabled(BooleanSupplier).- Parameters:
enabled-falseto grey the widget out for good- Returns:
- this builder
-
tooltip
The tooltip shown while the mouse is over the widget, re-read on every refresh; the supplier may returnnullfor no tooltip at that moment. Disabled widgets show their tooltip too, which makes it a good place to say why something is disabled. Default: none.- Parameters:
tooltip- read on refresh; returnsnullfor none- Returns:
- this builder
-
tooltip
A fixed tooltip; seetooltip(Supplier).- Parameters:
tooltip- the tooltip, ornullfor none- Returns:
- this builder
-
visible
Shows the entry only whilevisibleis true, re-read on every refresh. A hidden entry takes no space: the rows below move up. Use it for options that only apply in some state:
An entry with a.add(Slider.builder("fogDistance")… .visible(() -> config.fog) .build())visiblesupplier can't be in aMenuScreen's footer. To hide a group of entries together, put them in a collapsibleSectioninstead; a section hides its children by itself.- Parameters:
visible- read on refresh- Returns:
- this builder
-