Class Grid.Builder
java.lang.Object
com.ultikits.ultitools.ui.Grid.Builder
- Enclosing class:
Grid
A reusable, non-thread-safe snapshot builder.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbind(GridSlot slot, SlotContainer container, int index, BindingMode mode) Bindsslottocontainer'sindex.bindRange(int row, int column, int count, SlotContainer container, int firstIndex, BindingMode mode) Bindscountconsecutive slots in row-major order starting at (row,column) to consecutive indexes fromfirstIndex.build()Validates the complete snapshot and copies its icon table.Removes an icon or a binding from this snapshot.private voidrequireSlot(GridSlot slot) set(int row, int column, ItemSpec icon, @Nullable GridAction action) Sets an icon with an optional action at zero-based coordinates.Sets or replaces an icon.private voidvalidate()
-
Field Details
-
title
-
rows
private final int rows -
items
-
bindings
-
-
Constructor Details
-
Builder
-
-
Method Details
-
set
Sets or replaces an icon. Replaces a binding on that slot. @throws IllegalArgumentException ifslot.row() >= rows -
set
Sets an icon with an optional action at zero-based coordinates. Replaces a binding on that slot. -
clear
Removes an icon or a binding from this snapshot. -
bind
Bindsslottocontainer'sindex. Replaces an icon or binding on that slot.- Throws:
IllegalArgumentException- if the slot is outside the grid's rows,indexis outside0..container.size()-1, or (atbuild()) two slots bind the same container index
-
bindRange
public Grid.Builder bindRange(int row, int column, int count, SlotContainer container, int firstIndex, BindingMode mode) Bindscountconsecutive slots in row-major order starting at (row,column) to consecutive indexes fromfirstIndex. Same checks asbind(GridSlot, SlotContainer, int, BindingMode). -
requireSlot
-
validate
private void validate() -
build
Validates the complete snapshot and copies its icon table.
-