Package com.simsilica.lemur.component
Class SpringGridLayout
java.lang.Object
com.simsilica.lemur.component.AbstractGuiComponent
com.simsilica.lemur.component.SpringGridLayout
- All Implemented Interfaces:
GuiComponent
,GuiLayout
,Cloneable
A layout that manages children on a grid that automatically
resizes to fit the components along the major or minor
axes (row and column be default). Each row and column is
sized large enough to fit the largest child within that row
or column.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSpringGridLayout
(Axis mainAxis, Axis minorAxis) SpringGridLayout
(Axis mainAxis, Axis minorAxis, FillMode mainFill, FillMode minorFill) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
addAlternate
(Vector3f v, float f) <T extends Node>
TaddChild
(int row, int column, T n) <T extends Node>
Tprotected final void
protected final void
void
attach
(GuiControl parent) void
void
clone()
void
detach
(GuiControl parent) protected void
distribute
(float[] sizes, float[] prefs, float totalSize, float totalPref, FillMode fill, Axis axis) protected final float
getChild
(int row, int column) protected final float
protected final float
protected Map
<Integer, SpringGridLayout.Entry> getRow
(int row, boolean create) protected void
protected float
Recalculates the internal arrays that keep track of the preferred sizes for each row and collumn.protected void
void
removeChild
(Node n) void
protected final void
setAlternate
(Vector3f v, float f) protected final void
protected final void
toString()
protected float
weighted
(int index, float pref, float totalSize, float totalPref, int count, FillMode fill, Axis axis) Methods inherited from class com.simsilica.lemur.component.AbstractGuiComponent
getGuiControl, getNode, isAttached
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.simsilica.lemur.core.GuiComponent
getGuiControl, isAttached
-
Constructor Details
-
SpringGridLayout
public SpringGridLayout() -
SpringGridLayout
-
SpringGridLayout
-
-
Method Details
-
clone
- Specified by:
clone
in interfaceGuiComponent
- Specified by:
clone
in interfaceGuiLayout
- Overrides:
clone
in classAbstractGuiComponent
-
invalidate
protected void invalidate()- Overrides:
invalidate
in classAbstractGuiComponent
-
getMajor
-
getMinor
-
getAlternate
-
setMajor
-
setMinor
-
setAlternate
-
addMajor
-
addMinor
-
addAlternate
-
refreshRowColPrefs
protected float refreshRowColPrefs()Recalculates the internal arrays that keep track of the preferred sizes for each row and collumn. The preferred sizes are based on the maximum preferred size of every component in the row or column. This returns the "alternate axis" max size for all contained components. In a standard row, column setup where rows are vertical and columns are horizontal, the alternate axis is depth. -
calculatePreferredSize
- Specified by:
calculatePreferredSize
in interfaceGuiComponent
-
weighted
-
distribute
-
reshape
- Specified by:
reshape
in interfaceGuiComponent
-
getRow
-
addChild
-
addChild
-
getChild
-
removeChild
- Specified by:
removeChild
in interfaceGuiLayout
-
getChildren
- Specified by:
getChildren
in interfaceGuiLayout
-
clearChildren
public void clearChildren()- Specified by:
clearChildren
in interfaceGuiLayout
-
remove
-
attach
- Specified by:
attach
in interfaceGuiComponent
- Overrides:
attach
in classAbstractGuiComponent
-
detach
- Specified by:
detach
in interfaceGuiComponent
- Overrides:
detach
in classAbstractGuiComponent
-
toString
-