Class Section.Builder
- Enclosing class:
Section
Builds a
Section; from Section.builder(String). Also has the options every entry has (Entry.Builder).-
Method Summary
Modifier and TypeMethodDescriptionAppends a child entry.add(StringListEditor editor) Appends aStringListEditor's entries as children.build()Builds the section and attaches its children to it.collapsible(boolean collapsible) Whether the player can expand and collapse the section;trueby default.expanded(boolean expanded) Whether a collapsible section starts expanded;false(collapsed) by default.Called with the new state (true= expanded) each time the section is expanded or collapsed, e.g.A fixed title; seetitle(Supplier).The section's title, re-read on every refresh.
-
Method Details
-
title
The section's title, re-read on every refresh. Required.- Parameters:
title- read on refresh- Returns:
- this builder
-
title
A fixed title; seetitle(Supplier).- Parameters:
title- the title- Returns:
- this builder
-
collapsible
Whether the player can expand and collapse the section;trueby default. A section that can't collapse is a titled group, always expanded, with a plainLabelheader.- Parameters:
collapsible- whether it can collapse- Returns:
- this builder
-
expanded
Whether a collapsible section starts expanded;false(collapsed) by default. Pass a remembered state here and save it inonToggleto keep sections as the player left them.- Parameters:
expanded- the initial state- Returns:
- this builder
-
onToggle
Called with the new state (true= expanded) each time the section is expanded or collapsed, e.g. to remember it. Optional.- Parameters:
onToggle- receives the new state, on the main thread- Returns:
- this builder
-
add
Appends a child entry. Children appear under the section's header, in the order added.- Parameters:
entry- any entry except aSection; must not be in another section- Returns:
- this builder
- Throws:
IllegalStateException- ifentryis null or a section
-
add
Appends aStringListEditor's entries as children.- Parameters:
editor- the editor- Returns:
- this builder
-
build
Builds the section and attaches its children to it.- Returns:
- the section
- Throws:
IllegalStateException- if the title is missing or a child already is in another section
-