Class GridSizer


  • class GridSizer
    extends java.lang.Object
    Class representing grid sizing algorithm.
    • Field Detail

      • grid

        private final Grid grid
      • templateColumns

        private final java.util.List<GridValue> templateColumns
      • templateRows

        private final java.util.List<GridValue> templateRows
      • columnAutoWidth

        private final GridValue columnAutoWidth
      • rowAutoHeight

        private final GridValue rowAutoHeight
      • columnGap

        private final float columnGap
      • rowGap

        private final float rowGap
      • actualBBox

        private final Rectangle actualBBox
      • containerHeight

        private float containerHeight
    • Constructor Detail

      • GridSizer

        GridSizer​(Grid grid,
                  java.util.List<GridValue> templateColumns,
                  java.util.List<GridValue> templateRows,
                  GridValue columnAutoWidth,
                  GridValue rowAutoHeight,
                  float columnGap,
                  float rowGap,
                  Rectangle actualBBox)
        Creates new grid sizer instance.
        Parameters:
        grid - grid to size
        templateColumns - template values for columns
        templateRows - template values for rows
        columnAutoWidth - value which used to size columns out of template range
        rowAutoHeight - value which used to size rows out of template range
        columnGap - gap size between columns
        rowGap - gap size between rows
        actualBBox - actual bbox which restricts sizing algorithm
    • Method Detail

      • sizeGrid

        public void sizeGrid()
        Resolves grid track sizes.
      • getContainerHeight

        public float getContainerHeight()
        Gets grid container height. Use this method only after calling sizeGrid().
        Returns:
        grid container height covered by row template
      • resolveGridRows

        private void resolveGridRows()
      • calculateGridOccupiedHeight

        private float calculateGridOccupiedHeight​(java.util.List<java.lang.Float> originalSizes)
        Calculate grid container occupied area based on original (non-expanded percentages) track sizes.
        Parameters:
        originalSizes - original track sizes
        Returns:
        grid container occupied area
      • sum

        private float sum​(java.util.List<java.lang.Float> trackSizes)
      • resolveGridColumns

        private void resolveGridColumns()