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 voidaddAlternate(Vector3f v, float f) <T extends Node>
TaddChild(int row, int column, T n) <T extends Node>
Tprotected final voidprotected final voidvoidattach(GuiControl parent) voidvoidclone()voiddetach(GuiControl parent) protected voiddistribute(float[] sizes, float[] prefs, float totalSize, float totalPref, FillMode fill, Axis axis) protected final floatgetChild(int row, int column) protected final floatprotected final floatprotected Map<Integer, SpringGridLayout.Entry> getRow(int row, boolean create) protected voidprotected floatRecalculates the internal arrays that keep track of the preferred sizes for each row and collumn.protected voidvoidremoveChild(Node n) voidprotected final voidsetAlternate(Vector3f v, float f) protected final voidprotected final voidtoString()protected floatweighted(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, isAttachedMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.simsilica.lemur.core.GuiComponent
getGuiControl, isAttached
-
Constructor Details
-
SpringGridLayout
public SpringGridLayout() -
SpringGridLayout
-
SpringGridLayout
-
-
Method Details
-
clone
- Specified by:
clonein interfaceGuiComponent- Specified by:
clonein interfaceGuiLayout- Overrides:
clonein classAbstractGuiComponent
-
invalidate
protected void invalidate()- Overrides:
invalidatein 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:
calculatePreferredSizein interfaceGuiComponent
-
weighted
-
distribute
-
reshape
- Specified by:
reshapein interfaceGuiComponent
-
getRow
-
addChild
-
addChild
-
getChild
-
removeChild
- Specified by:
removeChildin interfaceGuiLayout
-
getChildren
- Specified by:
getChildrenin interfaceGuiLayout
-
clearChildren
public void clearChildren()- Specified by:
clearChildrenin interfaceGuiLayout
-
remove
-
attach
- Specified by:
attachin interfaceGuiComponent- Overrides:
attachin classAbstractGuiComponent
-
detach
- Specified by:
detachin interfaceGuiComponent- Overrides:
detachin classAbstractGuiComponent
-
toString
-