Zebra API Doc

zebra.layout.GridLayout Class

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 "zebra.layout.Constraints" class:

   // create constraints
   var ctr = new zebra.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 = zebra.layout.LEFT;

   // create panel and set grid layout manager with two 
   // virtual rows and columns
   var p = new zebra.ui.Panel();
   p.setLayout(new zebra.layout.GridLayout(2,2));

   // add children component
   p.add(ctr, new zebra.ui.Label("Cell 1,1"));
   p.add(ctr, new zebra.ui.Label("Cell 1,2"));
   p.add(ctr, new zebra.ui.Label("Cell 2,1"));
   p.add(ctr, new zebra.ui.Label("Cell 2,2"));

Constructor

zebra.layout.GridLayout

(
  • rows
  • cols
)

Parameters:

  • rows Integer

    a number of virtual rows to layout children components

  • cols Integer

    a number of virtual columns to layout children components

Item Index

Attributes

Methods

calcCol

(
  • col
  • c
)
Integer protected

Calculate the given column width

Parameters:


Return: Integer

a size of the column

calcCols

(
  • c
)
Array protected

Calculate columns metrics

Parameters:


Return: Array

a columns widths

calcRow

(
  • row
  • c
)
Integer protected

Calculate the given row height

Parameters:


Return: Integer

a size of the row

calcRows

(
  • c
)
Array protected

Calculate rows metrics

Parameters:


Return: Array

a rows heights

Attributes

cols

Integer readonly

Number of virtual columns to place children components

constraints

zebra.layout.Constraints

Default constraints that is applied for children components that doesn't define own constraints

rows

Integer readonly

Number of virtual rows to place children components