Class GridView<T>
java.lang.Object
com.ultikits.ultitools.abstracts.gui.declarative.core.Widget
com.ultikits.ultitools.abstracts.gui.declarative.widgets.GridView<T>
- Type Parameters:
T- the data type (when built from a data list)
GridView is a grid-layout Widget that arranges its children in a grid.
Supports:
- a specified starting slot and row/column count
- automatic child Widget position calculation
- automatic mapping from a data list
Usage example:
// Manually specify child widgets
GridView.builder()
.startSlot(10)
.columns(7)
.children(buttons)
.build();
// Auto-generate from a data list
GridView.<ItemStack>builder()
.startSlot(10)
.columns(7)
.items(itemList)
.itemBuilder(item -> ItemDisplay.builder(item).build())
.build();
- Since:
- 6.2.0
- Version:
- 1.0.0
- Author:
- UltiTools Team
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @NotNull GridView.Builder<T> builder()Creates a Builder.intcalculateSlotForChild(int childIndex) Calculates the actual slot of a child Widget.@NotNull ElementCreates the Element corresponding to this Widget.intint
-
Field Details
-
startSlot
private final int startSlot -
columns
private final int columns -
children
-
-
Constructor Details
-
GridView
-
-
Method Details
-
builder
Creates a Builder.- Type Parameters:
T- the data type- Returns:
- the Builder
-
getStartSlot
public int getStartSlot() -
getColumns
public int getColumns() -
getChildren
-
calculateSlotForChild
public int calculateSlotForChild(int childIndex) Calculates the actual slot of a child Widget.- Parameters:
childIndex- the child Widget's index- Returns:
- slot index
-
createElement
Description copied from class:WidgetCreates the Element corresponding to this Widget.This is a framework-internal method; subclasses should return the Element implementation appropriate to the Widget type.
- StatelessWidget returns a
StatelessElement - StatefulWidget returns a
StatefulElement - RenderObjectWidget returns a
RenderObjectElement
- Specified by:
createElementin classWidget- Returns:
- the corresponding Element instance
- StatelessWidget returns a
-