Class GridLayoutAlgorithm

java.lang.Object
org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
org.eclipse.zest.layouts.algorithms.GridLayoutAlgorithm
All Implemented Interfaces:
LayoutAlgorithm
Direct Known Subclasses:
BoxLayoutAlgorithm

public class GridLayoutAlgorithm extends AbstractLayoutAlgorithm
  • Field Details

    • aspectRatio

      protected double aspectRatio
      Since:
      2.0
    • rowPadding

      protected int rowPadding
    • rows

      protected int rows
      Since:
      2.0
    • cols

      protected int cols
      Since:
      2.0
    • numChildren

      protected int numChildren
      Since:
      2.0
    • colWidth

      protected double colWidth
      Since:
      2.0
    • rowHeight

      protected double rowHeight
      Since:
      2.0
    • offsetX

      protected double offsetX
      Since:
      2.0
    • offsetY

      protected double offsetY
      Since:
      2.0
    • childrenHeight

      protected double childrenHeight
      Since:
      2.0
    • childrenWidth

      protected double childrenWidth
      Since:
      2.0
  • Constructor Details

    • GridLayoutAlgorithm

      @Deprecated public GridLayoutAlgorithm(int style)
      Deprecated.
      Since Zest 2.0, use GridLayoutAlgorithm().
    • GridLayoutAlgorithm

      public GridLayoutAlgorithm()
  • Method Details

    • applyLayout

      public void applyLayout(boolean clean)
      Description copied from interface: LayoutAlgorithm
      Makes this algorithm perform layout computation and apply it to its context.
      Parameters:
      clean - if true the receiver should assume that the layout context has changed significantly and recompute the whole layout even if it keeps track of changes with listeners. False can be used after dynamic layout in a context is turned back on so that layout algorithm working in background can apply accumulated changes. Static layout algorithm can ignore this call entirely if clean is false.
    • calculateGrid

      protected void calculateGrid(DisplayIndependentRectangle bounds)
      Calculates all the dimensions of grid that layout entities will be fit in. The following fields are set by this method: numChildren, rows, cols, colWidth, rowHeight, offsetX, offsetY
      Parameters:
      bounds -
      Since:
      2.0
    • applyLayoutInternal

      protected void applyLayoutInternal(EntityLayout[] entitiesToLayout, DisplayIndependentRectangle bounds)
      Use this algorithm to layout the given entities and bounds. The entities will be placed in the same order as they are passed in, unless a comparator is supplied.
      Parameters:
      entitiesToLayout - apply the algorithm to these entities
      bounds - the bounds in which the layout can place the entities.
      Since:
      2.0
    • calculateNumberOfRowsAndCols

      protected int[] calculateNumberOfRowsAndCols(int numChildren, double boundX, double boundY, double boundWidth, double boundHeight)
      Calculates and returns an array containing the number of columns, followed by the number of rows
    • calculateNumberOfRowsAndCols_square

      protected int[] calculateNumberOfRowsAndCols_square(int numChildren, double boundX, double boundY, double boundWidth, double boundHeight)
    • calculateNumberOfRowsAndCols_rectangular

      protected int[] calculateNumberOfRowsAndCols_rectangular(int numChildren)
    • calculateNodeSize

      protected double[] calculateNodeSize(double colWidth, double rowHeight)
    • setRowPadding

      public void setRowPadding(int rowPadding)
      Sets the padding between rows in the grid
      Parameters:
      rowPadding - padding - should be greater than or equal to 0
    • setAspectRatio

      public void setAspectRatio(double aspectRatio)
      Sets the preferred aspect ratio for layout entities. The default aspect ratio is 1.
      Parameters:
      aspectRatio - aspect ratio - should be greater than 0
      Since:
      2.0
    • isResizing

      public boolean isResizing()
      Returns:
      true if this algorithm is set to resize elements
      Since:
      2.0
    • setResizing

      public void setResizing(boolean resizing)
      Parameters:
      resizing - true if this algorithm should resize elements (default is false)
      Since:
      2.0