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
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classDeprecated, for removal: This API element is subject to removal in a future version.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected doubleprotected doubleprotected doubleprotected intprotected doubleprotected intprotected doubleprotected doubleprotected doubleprotected intprotected intFields inherited from class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithmcontext
- 
Constructor SummaryConstructorsConstructorDescriptionGridLayoutAlgorithm(int style) Deprecated.Since Zest 2.0, useGridLayoutAlgorithm().
- 
Method SummaryModifier and TypeMethodDescriptionvoidapplyLayout(boolean clean) Makes this algorithm perform layout computation and apply it to its context.protected voidapplyLayoutInternal(EntityLayout[] entitiesToLayout, DisplayIndependentRectangle bounds) Use this algorithm to layout the given entities and bounds.protected voidCalculates all the dimensions of grid that layout entities will be fit in.protected double[]calculateNodeSize(double colWidth, double rowHeight) 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 rowsprotected int[]calculateNumberOfRowsAndCols_rectangular(int numChildren) protected int[]calculateNumberOfRowsAndCols_square(int numChildren, double boundX, double boundY, double boundWidth, double boundHeight) booleanvoidsetAspectRatio(double aspectRatio) Sets the preferred aspect ratio for layout entities.voidsetResizing(boolean resizing) voidsetRowPadding(int rowPadding) Sets the padding between rows in the gridMethods inherited from class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithmsetLayoutContext
- 
Field Details- 
aspectRatioprotected double aspectRatio- Since:
- 2.0
 
- 
rowPaddingprotected int rowPadding
- 
rowsprotected int rows- Since:
- 2.0
 
- 
colsprotected int cols- Since:
- 2.0
 
- 
numChildrenprotected int numChildren- Since:
- 2.0
 
- 
colWidthprotected double colWidth- Since:
- 2.0
 
- 
rowHeightprotected double rowHeight- Since:
- 2.0
 
- 
offsetXprotected double offsetX- Since:
- 2.0
 
- 
offsetYprotected double offsetY- Since:
- 2.0
 
- 
childrenHeightprotected double childrenHeight- Since:
- 2.0
 
- 
childrenWidthprotected double childrenWidth- Since:
- 2.0
 
 
- 
- 
Constructor Details- 
GridLayoutAlgorithmDeprecated.Since Zest 2.0, useGridLayoutAlgorithm().
- 
GridLayoutAlgorithmpublic GridLayoutAlgorithm()
 
- 
- 
Method Details- 
applyLayoutpublic void applyLayout(boolean clean) Description copied from interface:LayoutAlgorithmMakes 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.
 
- 
calculateGridCalculates 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
 
- 
applyLayoutInternalprotected 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
 
- 
calculateNumberOfRowsAndColsprotected 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_squareprotected int[] calculateNumberOfRowsAndCols_square(int numChildren, double boundX, double boundY, double boundWidth, double boundHeight) 
- 
calculateNumberOfRowsAndCols_rectangularprotected int[] calculateNumberOfRowsAndCols_rectangular(int numChildren) 
- 
calculateNodeSizeprotected double[] calculateNodeSize(double colWidth, double rowHeight) 
- 
setRowPaddingpublic void setRowPadding(int rowPadding) Sets the padding between rows in the grid- Parameters:
- rowPadding- padding - should be greater than or equal to 0
 
- 
setAspectRatiopublic 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
 
- 
isResizingpublic boolean isResizing()- Returns:
- true if this algorithm is set to resize elements
- Since:
- 2.0
 
- 
setResizingpublic void setResizing(boolean resizing) - Parameters:
- resizing- true if this algorithm should resize elements (default is false)
- Since:
- 2.0
 
 
- 
GridLayoutAlgorithminstead.