Class
zebkit.layout.GridLayout
mixed with <zebkit.layout.Layout> |
<zebkit.layout> |
Grid layout manager. can be used to split a component area to number of virtual cells where children components can be placed. The way how the children components have to be laid out in the cells can be customized by using "zebkit.layout.Constraints" class:
// create constraints
var ctr = new zebkit.layout.Constraints();
// specify cell top, left, right, bottom paddings
ctr.setPadding(8);
// say the component has to be left aligned in a
// virtual cell of grid layout
ctr.ax = "left";
// create panel and set grid layout manager with two
// virtual rows and columns
var p = new zebkit.ui.Panel();
p.setLayout(new zebkit.layout.GridLayout(2, 2));
// add children component
p.add(ctr, new zebkit.ui.Label("Cell 1, 1"));
p.add(ctr, new zebkit.ui.Label("Cell 1, 2"));
p.add(ctr, new zebkit.ui.Label("Cell 2, 1"));
p.add(ctr, new zebkit.ui.Label("Cell 2, 2"));
zebkit.layout.GridLayout
(rows, cols, [stretchRows], [stretchCols]
)
Parameters:
-
rows
<Integer>a number of virtual rows to layout children components
-
cols
<Integer>a number of virtual columns to layout children components
-
[stretchRows]
<Boolean>true if virtual cell height has to be stretched to occupy the whole vertical container component space
-
[stretchCols]
<Boolean>true if virtual cell width has to be stretched to occupy the whole horizontal container component space
protected
|
<Integer> | calcCol (col, c) |
protected
|
<Array> | calcCols (c) |
protected
|
<Integer> | calcRow (row, c) |
protected
|
<Array> | calcRows (c) |
public | void | setDefaultConstraints (c) |
public | void | setPadding (p) |
public | void | setPadding (t, l, b, r) |
protected
<Integer>
calcCol (col, c )
Calculate the given column width Parameters:
Returns:
<Integer>
a size of the column |
protected
<Array>
calcCols (c )
Calculate columns metrics Parameters:
Returns:
<Array>
a columns widths |
protected
<Integer>
calcRow (row, c )
Calculate the given row height Parameters:
Returns:
<Integer>
a size of the row |
protected
<Array>
calcRows (c )
Calculate rows metrics Parameters:
Returns:
<Array>
a rows heights |
public
chainable
setDefaultConstraints (c )
Set default constraints. Parameters:
|
public
chainable
setPadding (p )
Set default grid layout cell paddings (top, left, bottom, right) to the given value Parameters:
|
public
chainable
setPadding (t, l, b, r )
Set default grid layout cell paddings: top, left, bottom, right Parameters:
|
public
![]() cols
Number of virtual columns to place children components |
public
<zebkit.layout.Constraints>
constraints
Default constraints that is applied for children components that doesn't define own constraints |
public
![]() rows
Number of virtual rows to place children components |
public
![]() stretchCols
Attributes that indicates if component has to be stretched horizontally to occupy the whole space of a virtual cell. |
public
![]() stretchRows
Attributes that indicates if component has to be stretched vertically to occupy the whole space of a virtual cell. |