- java.lang.Object
-
- net.miginfocom.layout.Grid
-
public final class Grid extends java.lang.ObjectHolds components in a grid. Does most of the logic behind the layout manager.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classGrid.AboveBelowprivate static classGrid.CellA simple representation of a cell in the grid.private classGrid.CompWrapWraps aComponenttogether with its constraint.private static classGrid.FlowSizeSpecprivate static classGrid.LinkedDimGroupA number of component wraps that share a layout "something" in one dimensionprivate static classGrid.WeakCell
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<LayoutCallback>callbackListprivate ACcolConstrThe row and column specifications.private Grid.FlowSizeSpeccolFlowSpecsThe in the constructor calculated min/pref/max sizes of the rows and columns.private java.util.ArrayList<Grid.LinkedDimGroup>[]colGroupListsComponents that are connections in one dimension (such as baseline alignment for instance) are grouped together and stored here.private java.util.TreeSet<java.lang.Integer>colIndexesThe size of the grid.private ContainerWrappercontainerThe parent that is layout out and this grid is done for.private java.util.ArrayList<int[]>debugRectsIf debug is on contains the bounds for things to paint when callingContainerWrapper.paintDebugCell(int, int, int, int)private static CCDEF_CCUsed for components that doesn't have a CC set.private static DimConstraintDOCK_DIM_CONSTRAINTprivate intdockOffXprivate intdockOffYprivate static ResizeConstraintGAP_RC_CONSTA constraint used for gaps.private static ResizeConstraintGAP_RC_CONST_PUSHprivate java.util.LinkedHashMap<java.lang.Integer,Grid.Cell>gridAn x, y array implemented as a sparse array to accommodate for any grid size without wasting memory (or rather 15 bit (0-MAX_GRID * 0-MAX_GRID).private static java.lang.Float[]GROW_100private int[]heightThe in the constructor calculated min/pref/max size of the whole grid.private intlastRefHeightprivate intlastRefWidthprivate LClcThe constraints.private java.util.HashMap<java.lang.String,java.lang.Boolean>linkTargetIDsIf any of the absolute coordinates for component bounds has links the name of the target is in this Set.private static intMAX_DOCK_GRIDDocking components will use the grid coordinates-MAX_DOCK_GRID -> 0andMAX_GRID -> MAX_DOCK_GRID.private static intMAX_GRIDThis is the maximum grid position for "normal" components.private static java.util.WeakHashMap<java.lang.Object,java.util.ArrayList<Grid.WeakCell>>PARENT_GRIDPOS_MAPprivate static java.util.WeakHashMap<java.lang.Object,int[][]>[]PARENT_ROWCOL_SIZES_MAPprivate java.lang.Float[]pushXsprivate java.lang.Float[]pushYsprivate ACrowConstrThe row and column specifications.private Grid.FlowSizeSpecrowFlowSpecsThe in the constructor calculated min/pref/max sizes of the rows and columns.private java.util.ArrayList<Grid.LinkedDimGroup>[]rowGroupListsComponents that are connections in one dimension (such as baseline alignment for instance) are grouped together and stored here.private java.util.TreeSet<java.lang.Integer>rowIndexesThe size of the grid.static booleanTEST_GAPSprivate int[]widthThe in the constructor calculated min/pref/max size of the whole grid.private java.util.HashMap<java.lang.Integer,BoundSize>wrapGapMap
-
Constructor Summary
Constructors Constructor Description Grid(ContainerWrapper container, LC lc, AC rowConstr, AC colConstr, java.util.Map<? extends ComponentWrapper,CC> ccMap, java.util.ArrayList<LayoutCallback> callbackList)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private voidaddDockingCell(int[] dockInsets, int side, Grid.CompWrap cw)Adds a docking cell.private voidaddLinkIDs(CC cc)private static java.util.HashMap<java.lang.String,java.lang.Integer>addToEndGroup(java.util.HashMap<java.lang.String,java.lang.Integer> endGroups, java.lang.String endGroup, int end)private static voidaddToSizeGroup(java.util.HashMap<java.lang.String,int[]> sizeGroups, java.lang.String sizeGroup, int[] size)private voidadjustMinPrefForSpanningComps(DimConstraint[] specs, java.lang.Float[] defPush, Grid.FlowSizeSpec fss, java.util.ArrayList<Grid.LinkedDimGroup>[] groupsLists)Adjust min/pref size for columns(or rows) that has components that spans multiple columns (or rows).private voidadjustSizeForAbsolute(boolean isHor)Adjust grid's width or height for the absolute components' positions.private voidcalcGridSizes(int refWidth, int refHeight)private Grid.FlowSizeSpeccalcRowsOrColsSizes(boolean isHor, int containerSize)Calculates Min, Preferred and Max size for the columns OR rows.private voidcheckSizeCalcs(int refWidth, int refHeight)private voidclearGroupLinkBounds()private static intconstrainSize(int s)private static intconvertSpanToSparseGrid(int curIx, int span, java.util.TreeSet<java.lang.Integer> indexes)Spanning is specified in the uncompressed grid number.private static UnitValuecorrectAlign(CC cc, UnitValue rowAlign, boolean isHor, boolean fromEnd)private static voidcorrectMinMax(int[] s)private java.util.ArrayList<Grid.LinkedDimGroup>[]divideIntoLinkedGroups(boolean isRows)For one dimension divide the component wraps into logical groups.private booleandoAbsoluteCorrections(Grid.CompWrap cw, int[] bounds)private voidensureIndexSizes(int colCount, int rowCount)private static java.lang.Float[]extractSubArray(DimConstraint[] specs, java.lang.Float[] arr, int ix, int len)private int[]getAbsoluteDimBounds(Grid.CompWrap cw, int refSize, boolean isHor)private static Grid.AboveBelowgetBaselineAboveBelow(java.util.ArrayList<Grid.CompWrap> compWraps, int sType, boolean centerBaseline)private BoundSize[]getCallbackSize(ComponentWrapper cw)private static CCgetCC(ComponentWrapper comp, java.util.Map<? extends ComponentWrapper,CC> ccMap)private Grid.CellgetCell(int r, int c)private static boolean[]getComponentGapPush(java.util.ArrayList<Grid.CompWrap> compWraps, boolean isHor)private static ResizeConstraint[]getComponentResizeConstraints(java.util.ArrayList<Grid.CompWrap> compWraps, boolean isHor)private static int[][]getComponentSizes(java.util.ArrayList<Grid.CompWrap> compWraps, boolean isHor)ContainerWrappergetContainer()private java.lang.Float[]getDefaultPushWeights(boolean isRows)private static intgetDockInsets(java.util.TreeSet<java.lang.Integer> set)private static int[][]getGaps(java.util.ArrayList<Grid.CompWrap> compWraps, boolean isHor)(package private) static java.util.HashMap<java.lang.Object,int[]>getGridPositions(java.lang.Object parComp)private static Grid.LinkedDimGroupgetGroupContaining(java.util.ArrayList<Grid.LinkedDimGroup>[] groupLists, Grid.CompWrap cw)int[]getHeight()int[]getHeight(int refWidth)private int[]getMinPrefMaxSumSize(boolean isHor, int[][] sizes)private static intgetParentSize(ComponentWrapper cw, boolean isHor)private UnitValue[]getPos(ComponentWrapper cw, CC cc)private int[][]getRowGaps(DimConstraint[] specs, int refSize, boolean isHor, boolean[] fillInPushGaps)Returns the row gaps in pixel sizes.private static ResizeConstraint[]getRowResizeConstraints(DimConstraint[] specs)(package private) static int[][]getSizesAndIndexes(java.lang.Object parComp, boolean isRows)private static intgetTotalGroupsSizeParallel(java.util.ArrayList<Grid.LinkedDimGroup> groups, int sType, boolean countSpanning)private static intgetTotalSizeParallel(java.util.ArrayList<Grid.CompWrap> compWraps, int sType, boolean isHor)private static intgetTotalSizeSerial(java.util.ArrayList<Grid.CompWrap> compWraps, int sType, boolean isHor)int[]getWidth()int[]getWidth(int refHeight)private booleanhasDocks()private intincrease(int[] p, int cnt)Go to next cell.private voidinvalidateComponentSizes()voidinvalidateContainerSize()If the container (parent) that this grid is laying out has changed its bounds, call this method to clear any cached values min/pref/max sizes of the components and rows/columns.private booleanisCellFree(int r, int c, java.util.ArrayList<int[]> occupiedRects)booleanlayout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug)Does the actual layout.booleanlayout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug, boolean notUsed)Deprecated.since 5.0 Last boolean is not needed and is gotten from the newComponentWrapper.getContentBias()instead;private static voidlayoutBaseline(ContainerWrapper parent, java.util.ArrayList<Grid.CompWrap> compWraps, DimConstraint dc, int start, int size, int sizeType, int spanCount)private booleanlayoutImpl(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug, boolean trialRun)Does the actual layout.private voidlayoutInOneDim(int refSize, UnitValue align, boolean isRows, java.lang.Float[] defaultPushWeights)private static voidlayoutParallel(ContainerWrapper parent, java.util.ArrayList<Grid.CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, boolean fromEnd)private static voidlayoutSerial(ContainerWrapper parent, java.util.ArrayList<Grid.CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, int spanCount, boolean fromEnd)private static int[]mergeSizes(int[] oldValues, int[] newValues)private static intmergeSizes(int oldValue, int newValue, boolean toMax)private static Grid.FlowSizeSpecmergeSizesGapsAndResConstrs(ResizeConstraint[] resConstr, boolean[] gapPush, int[][] minPrefMaxSizes, int[][] gapSizes)Merges sizes and gaps together with Resize Constraints.voidpaintDebug()private static voidputSizesAndIndexes(java.lang.Object parComp, int[] sizes, int[] ixArr, boolean isRows)private voidresetLinkValues(boolean parentSize, boolean compLinks)private static voidsaveGrid(ComponentWrapper parComp, java.util.LinkedHashMap<java.lang.Integer,Grid.Cell> grid)private voidsetCell(int r, int c, Grid.Cell cell)private static voidsetCompWrapBounds(ContainerWrapper parent, int[][] sizes, java.util.ArrayList<Grid.CompWrap> compWraps, UnitValue rowAlign, int start, int size, boolean isHor, boolean fromEnd)private static voidsetCompWrapBounds(ContainerWrapper parent, int[] allSizes, java.util.ArrayList<Grid.CompWrap> compWraps, UnitValue rowAlign, int start, int size, boolean isHor, boolean fromEnd)private booleansetLinkedBounds(ComponentWrapper cw, CC cc, int x, int y, int w, int h, boolean external)private static voidsortCellsByPlatform(java.util.Collection<Grid.Cell> cells, ContainerWrapper parent)Sort components (normally buttons in a button bar) so they appear in the correct order.private voidwrap(int[] cellXY, BoundSize gapSize)Wraps to the next row or column depending on if horizontal flow or vertical flow is used.
-
-
-
Field Detail
-
TEST_GAPS
public static final boolean TEST_GAPS
- See Also:
- Constant Field Values
-
GROW_100
private static final java.lang.Float[] GROW_100
-
DOCK_DIM_CONSTRAINT
private static final DimConstraint DOCK_DIM_CONSTRAINT
-
MAX_GRID
private static final int MAX_GRID
This is the maximum grid position for "normal" components. Docking components use the space out toMAX_DOCK_GRIDand below 0.- See Also:
- Constant Field Values
-
MAX_DOCK_GRID
private static final int MAX_DOCK_GRID
Docking components will use the grid coordinates-MAX_DOCK_GRID -> 0andMAX_GRID -> MAX_DOCK_GRID.- See Also:
- Constant Field Values
-
GAP_RC_CONST
private static final ResizeConstraint GAP_RC_CONST
A constraint used for gaps.
-
GAP_RC_CONST_PUSH
private static final ResizeConstraint GAP_RC_CONST_PUSH
-
DEF_CC
private static final CC DEF_CC
Used for components that doesn't have a CC set. Not that it's really really important that the CC is never changed in this Grid class.
-
lc
private final LC lc
The constraints. Nevernull.
-
container
private final ContainerWrapper container
The parent that is layout out and this grid is done for. Nevernull.
-
grid
private final java.util.LinkedHashMap<java.lang.Integer,Grid.Cell> grid
An x, y array implemented as a sparse array to accommodate for any grid size without wasting memory (or rather 15 bit (0-MAX_GRID * 0-MAX_GRID).
-
wrapGapMap
private java.util.HashMap<java.lang.Integer,BoundSize> wrapGapMap
-
rowIndexes
private final java.util.TreeSet<java.lang.Integer> rowIndexes
The size of the grid. Row count and column count.
-
colIndexes
private final java.util.TreeSet<java.lang.Integer> colIndexes
The size of the grid. Row count and column count.
-
rowConstr
private final AC rowConstr
The row and column specifications.
-
colConstr
private final AC colConstr
The row and column specifications.
-
colFlowSpecs
private Grid.FlowSizeSpec colFlowSpecs
The in the constructor calculated min/pref/max sizes of the rows and columns.
-
rowFlowSpecs
private Grid.FlowSizeSpec rowFlowSpecs
The in the constructor calculated min/pref/max sizes of the rows and columns.
-
colGroupLists
private final java.util.ArrayList<Grid.LinkedDimGroup>[] colGroupLists
Components that are connections in one dimension (such as baseline alignment for instance) are grouped together and stored here. One for each row/column.
-
rowGroupLists
private final java.util.ArrayList<Grid.LinkedDimGroup>[] rowGroupLists
Components that are connections in one dimension (such as baseline alignment for instance) are grouped together and stored here. One for each row/column.
-
width
private int[] width
The in the constructor calculated min/pref/max size of the whole grid.
-
height
private int[] height
The in the constructor calculated min/pref/max size of the whole grid.
-
debugRects
private java.util.ArrayList<int[]> debugRects
If debug is on contains the bounds for things to paint when callingContainerWrapper.paintDebugCell(int, int, int, int)
-
linkTargetIDs
private java.util.HashMap<java.lang.String,java.lang.Boolean> linkTargetIDs
If any of the absolute coordinates for component bounds has links the name of the target is in this Set. Since it requires some memory and computations this is checked at the creation so that the link information is only created if needed later.The boolean is true for groups id:s and null for normal id:s.
-
dockOffY
private final int dockOffY
-
dockOffX
private final int dockOffX
-
pushXs
private final java.lang.Float[] pushXs
-
pushYs
private final java.lang.Float[] pushYs
-
callbackList
private final java.util.ArrayList<LayoutCallback> callbackList
-
lastRefWidth
private int lastRefWidth
-
lastRefHeight
private int lastRefHeight
-
PARENT_ROWCOL_SIZES_MAP
private static java.util.WeakHashMap<java.lang.Object,int[][]>[] PARENT_ROWCOL_SIZES_MAP
-
PARENT_GRIDPOS_MAP
private static java.util.WeakHashMap<java.lang.Object,java.util.ArrayList<Grid.WeakCell>> PARENT_GRIDPOS_MAP
-
-
Constructor Detail
-
Grid
public Grid(ContainerWrapper container, LC lc, AC rowConstr, AC colConstr, java.util.Map<? extends ComponentWrapper,CC> ccMap, java.util.ArrayList<LayoutCallback> callbackList)
Constructor.- Parameters:
container- The container that will be laid out.lc- The form flow constraints.rowConstr- The rows specifications. If more cell rows are required, the last element will be used for when there is no corresponding element in this array.colConstr- The columns specifications. If more cell rows are required, the last element will be used for when there is no corresponding element in this array.ccMap- The map containing the parsed constraints for each child component ofparent. Will not be altered. Can have null CC which will use a common cached one.callbackList- A list of callbacks ornullif none. Will not be altered.
-
-
Method Detail
-
ensureIndexSizes
private void ensureIndexSizes(int colCount, int rowCount)
-
getCC
private static CC getCC(ComponentWrapper comp, java.util.Map<? extends ComponentWrapper,CC> ccMap)
-
addLinkIDs
private void addLinkIDs(CC cc)
-
invalidateContainerSize
public void invalidateContainerSize()
If the container (parent) that this grid is laying out has changed its bounds, call this method to clear any cached values min/pref/max sizes of the components and rows/columns.If any component can have changed cell the grid needs to be recreated.
-
invalidateComponentSizes
private void invalidateComponentSizes()
-
layout
public boolean layout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug, boolean notUsed)Deprecated.since 5.0 Last boolean is not needed and is gotten from the newComponentWrapper.getContentBias()instead;
-
layout
public boolean layout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug)Does the actual layout. Uses many values calculated in the constructor.- Parameters:
bounds- The bounds to layout against. Normally that of the parent. [x, y, width, height].alignX- The alignment for the x-axis. Can be null.alignY- The alignment for the y-axis. Can be null.debug- If debug information should be saved indebugRects.- Returns:
- If the layout has changed the preferred size and there is need for a new layout. This can happen if one or more components
in the grid has a content bias according to
ComponentWrapper.getContentBias(). - Since:
- 5.0
-
layoutImpl
private boolean layoutImpl(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug, boolean trialRun)Does the actual layout. Uses many values calculated in the constructor.- Parameters:
bounds- The bounds to layout against. Normally that of the parent. [x, y, width, height].alignX- The alignment for the x-axis. Can be null.alignY- The alignment for the y-axis. Can be null.debug- If debug information should be saved indebugRects.trialRun- If true the bounds calculated will not be transferred to the components. Only the internal size of the components will be calculated.- Returns:
- If the layout has changed the preferred size and there is need for a new layout. This can happen if one or more components
in the grid has a content bias according to
ComponentWrapper.getContentBias(). - Since:
- 5.0
-
paintDebug
public void paintDebug()
-
getContainer
public ContainerWrapper getContainer()
-
getWidth
public final int[] getWidth()
-
getWidth
public final int[] getWidth(int refHeight)
-
getHeight
public final int[] getHeight()
-
getHeight
public final int[] getHeight(int refWidth)
-
checkSizeCalcs
private void checkSizeCalcs(int refWidth, int refHeight)
-
calcGridSizes
private void calcGridSizes(int refWidth, int refHeight)
-
getPos
private UnitValue[] getPos(ComponentWrapper cw, CC cc)
-
getCallbackSize
private BoundSize[] getCallbackSize(ComponentWrapper cw)
-
getDockInsets
private static int getDockInsets(java.util.TreeSet<java.lang.Integer> set)
-
setLinkedBounds
private boolean setLinkedBounds(ComponentWrapper cw, CC cc, int x, int y, int w, int h, boolean external)
- Parameters:
cw- Nevernull.cc- Nevernull.external- The bounds should be stored even if they are not inlinkTargetIDs.- Returns:
- If a change has been made.
-
increase
private int increase(int[] p, int cnt)Go to next cell.- Parameters:
p- The point to increasecnt- How many cells to advance.- Returns:
- The new value in the "increasing" dimension.
-
wrap
private void wrap(int[] cellXY, BoundSize gapSize)Wraps to the next row or column depending on if horizontal flow or vertical flow is used.- Parameters:
cellXY- The point to wrap and thus set either x or y to 0 and increase the other one.gapSize- The gaps size specified in a "wrap XXX" or "newline XXX" ornullif none.
-
sortCellsByPlatform
private static void sortCellsByPlatform(java.util.Collection<Grid.Cell> cells, ContainerWrapper parent)
Sort components (normally buttons in a button bar) so they appear in the correct order.- Parameters:
cells- The cells to sort.parent- The parent.
-
getDefaultPushWeights
private java.lang.Float[] getDefaultPushWeights(boolean isRows)
-
clearGroupLinkBounds
private void clearGroupLinkBounds()
-
resetLinkValues
private void resetLinkValues(boolean parentSize, boolean compLinks)
-
getGroupContaining
private static Grid.LinkedDimGroup getGroupContaining(java.util.ArrayList<Grid.LinkedDimGroup>[] groupLists, Grid.CompWrap cw)
- Parameters:
groupLists- The lists to search in.cw- The component wrap to find.- Returns:
- The linked group or
nullif none had the component wrap.
-
doAbsoluteCorrections
private boolean doAbsoluteCorrections(Grid.CompWrap cw, int[] bounds)
-
adjustSizeForAbsolute
private void adjustSizeForAbsolute(boolean isHor)
Adjust grid's width or height for the absolute components' positions.
-
getAbsoluteDimBounds
private int[] getAbsoluteDimBounds(Grid.CompWrap cw, int refSize, boolean isHor)
-
layoutInOneDim
private void layoutInOneDim(int refSize, UnitValue align, boolean isRows, java.lang.Float[] defaultPushWeights)
-
addToSizeGroup
private static void addToSizeGroup(java.util.HashMap<java.lang.String,int[]> sizeGroups, java.lang.String sizeGroup, int[] size)
-
addToEndGroup
private static java.util.HashMap<java.lang.String,java.lang.Integer> addToEndGroup(java.util.HashMap<java.lang.String,java.lang.Integer> endGroups, java.lang.String endGroup, int end)
-
calcRowsOrColsSizes
private Grid.FlowSizeSpec calcRowsOrColsSizes(boolean isHor, int containerSize)
Calculates Min, Preferred and Max size for the columns OR rows.- Parameters:
isHor- If it is the horizontal dimension to calculate.containerSize- The reference container size in the dimension. If <= 0 it will be replaced by the actual container's size.- Returns:
- The sizes in a
Grid.FlowSizeSpec.
-
getParentSize
private static int getParentSize(ComponentWrapper cw, boolean isHor)
-
getMinPrefMaxSumSize
private int[] getMinPrefMaxSumSize(boolean isHor, int[][] sizes)
-
getRowResizeConstraints
private static ResizeConstraint[] getRowResizeConstraints(DimConstraint[] specs)
-
getComponentResizeConstraints
private static ResizeConstraint[] getComponentResizeConstraints(java.util.ArrayList<Grid.CompWrap> compWraps, boolean isHor)
-
getComponentGapPush
private static boolean[] getComponentGapPush(java.util.ArrayList<Grid.CompWrap> compWraps, boolean isHor)
-
getRowGaps
private int[][] getRowGaps(DimConstraint[] specs, int refSize, boolean isHor, boolean[] fillInPushGaps)
Returns the row gaps in pixel sizes. One more than there arespecssent in.- Parameters:
specs-refSize-isHor-fillInPushGaps- If the gaps are pushing. NOTE! this argument will be filled in and thus changed!- Returns:
- The row gaps in pixel sizes. One more than there are
specssent in.
-
getGaps
private static int[][] getGaps(java.util.ArrayList<Grid.CompWrap> compWraps, boolean isHor)
-
hasDocks
private boolean hasDocks()
-
adjustMinPrefForSpanningComps
private void adjustMinPrefForSpanningComps(DimConstraint[] specs, java.lang.Float[] defPush, Grid.FlowSizeSpec fss, java.util.ArrayList<Grid.LinkedDimGroup>[] groupsLists)
Adjust min/pref size for columns(or rows) that has components that spans multiple columns (or rows).- Parameters:
specs- The specs for the columns or rows. Last index will be used ifcountis greater than this array's length.defPush- The default grow weight if the specs does not have anyone that will grow. Comes from "push" in the CC.fss-groupsLists-
-
divideIntoLinkedGroups
private java.util.ArrayList<Grid.LinkedDimGroup>[] divideIntoLinkedGroups(boolean isRows)
For one dimension divide the component wraps into logical groups. One group for component wraps that share a common something, line the property to layout by base line.- Parameters:
isRows- If rows, and not columns, are to be divided.- Returns:
- One
ArrayListfor every row/column.
-
convertSpanToSparseGrid
private static int convertSpanToSparseGrid(int curIx, int span, java.util.TreeSet<java.lang.Integer> indexes)Spanning is specified in the uncompressed grid number. They can for instance be more than 60000 for the outer edge dock grid cells. When the grid is compressed and indexed after only the cells that area occupied the span is erratic. This method use the row/col indexes and corrects the span to be correct for the compressed grid.- Parameters:
span- The span in the uncompressed grid.LayoutUtil.INFwill be interpreted to span the rest of the column/row excluding the surrounding docking components.indexes- The indexes in the correct dimension.- Returns:
- The converted span.
-
isCellFree
private boolean isCellFree(int r, int c, java.util.ArrayList<int[]> occupiedRects)
-
getCell
private Grid.Cell getCell(int r, int c)
-
setCell
private void setCell(int r, int c, Grid.Cell cell)
-
addDockingCell
private void addDockingCell(int[] dockInsets, int side, Grid.CompWrap cw)Adds a docking cell. That cell is outside the normal cell indexes.- Parameters:
dockInsets- The current dock insets. Will be updated!side- top == 0, left == 1, bottom = 2, right = 3.cw- The compwrap to put in a cell and add.
-
layoutBaseline
private static void layoutBaseline(ContainerWrapper parent, java.util.ArrayList<Grid.CompWrap> compWraps, DimConstraint dc, int start, int size, int sizeType, int spanCount)
-
layoutSerial
private static void layoutSerial(ContainerWrapper parent, java.util.ArrayList<Grid.CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, int spanCount, boolean fromEnd)
-
setCompWrapBounds
private static void setCompWrapBounds(ContainerWrapper parent, int[] allSizes, java.util.ArrayList<Grid.CompWrap> compWraps, UnitValue rowAlign, int start, int size, boolean isHor, boolean fromEnd)
-
layoutParallel
private static void layoutParallel(ContainerWrapper parent, java.util.ArrayList<Grid.CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, boolean fromEnd)
-
setCompWrapBounds
private static void setCompWrapBounds(ContainerWrapper parent, int[][] sizes, java.util.ArrayList<Grid.CompWrap> compWraps, UnitValue rowAlign, int start, int size, boolean isHor, boolean fromEnd)
-
correctAlign
private static UnitValue correctAlign(CC cc, UnitValue rowAlign, boolean isHor, boolean fromEnd)
-
getBaselineAboveBelow
private static Grid.AboveBelow getBaselineAboveBelow(java.util.ArrayList<Grid.CompWrap> compWraps, int sType, boolean centerBaseline)
-
getTotalSizeParallel
private static int getTotalSizeParallel(java.util.ArrayList<Grid.CompWrap> compWraps, int sType, boolean isHor)
-
getTotalSizeSerial
private static int getTotalSizeSerial(java.util.ArrayList<Grid.CompWrap> compWraps, int sType, boolean isHor)
-
getTotalGroupsSizeParallel
private static int getTotalGroupsSizeParallel(java.util.ArrayList<Grid.LinkedDimGroup> groups, int sType, boolean countSpanning)
-
getComponentSizes
private static int[][] getComponentSizes(java.util.ArrayList<Grid.CompWrap> compWraps, boolean isHor)
- Parameters:
compWraps-isHor-- Returns:
- Might contain LayoutUtil.NOT_SET
-
mergeSizesGapsAndResConstrs
private static Grid.FlowSizeSpec mergeSizesGapsAndResConstrs(ResizeConstraint[] resConstr, boolean[] gapPush, int[][] minPrefMaxSizes, int[][] gapSizes)
Merges sizes and gaps together with Resize Constraints. For gapsGAP_RC_CONSTis used.- Parameters:
resConstr- One resize constraint for every row/component. Can be lesser in length and the last element should be used for missing elements.gapPush- If the corresponding gap should be considered pushing and thus want to take free space if left over. Should be one more than resConstrs!minPrefMaxSizes- The sizes (min/pref/max) for every row/component.gapSizes- The gaps before and after each row/component packed in one double sized array.- Returns:
- A holder for the merged values.
-
mergeSizes
private static int[] mergeSizes(int[] oldValues, int[] newValues)
-
mergeSizes
private static int mergeSizes(int oldValue, int newValue, boolean toMax)
-
constrainSize
private static int constrainSize(int s)
-
correctMinMax
private static void correctMinMax(int[] s)
-
extractSubArray
private static java.lang.Float[] extractSubArray(DimConstraint[] specs, java.lang.Float[] arr, int ix, int len)
-
putSizesAndIndexes
private static void putSizesAndIndexes(java.lang.Object parComp, int[] sizes, int[] ixArr, boolean isRows)
-
getSizesAndIndexes
static int[][] getSizesAndIndexes(java.lang.Object parComp, boolean isRows)
-
saveGrid
private static void saveGrid(ComponentWrapper parComp, java.util.LinkedHashMap<java.lang.Integer,Grid.Cell> grid)
-
getGridPositions
static java.util.HashMap<java.lang.Object,int[]> getGridPositions(java.lang.Object parComp)
-
-