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 Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Deprecated, for removal: This API element is subject to removal in a future version. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double
protected double
protected double
protected int
protected double
protected int
protected double
protected double
protected double
protected int
protected int
Fields inherited from class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
context
-
Constructor Summary
ConstructorsConstructorDescriptionGridLayoutAlgorithm
(int style) Deprecated.Since Zest 2.0, useGridLayoutAlgorithm()
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyLayout
(boolean clean) Makes this algorithm perform layout computation and apply it to its context.protected void
applyLayoutInternal
(EntityLayout[] entitiesToLayout, DisplayIndependentRectangle bounds) Use this algorithm to layout the given entities and bounds.protected void
Calculates 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) boolean
void
setAspectRatio
(double aspectRatio) Sets the preferred aspect ratio for layout entities.void
setResizing
(boolean resizing) void
setRowPadding
(int rowPadding) Sets the padding between rows in the gridMethods inherited from class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
setLayoutContext
-
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.Since Zest 2.0, useGridLayoutAlgorithm()
. -
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
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 entitiesbounds
- 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
-
GridLayoutAlgorithm
instead.