Class sap.ui.commons.layout.MatrixLayoutModule: sap/ui/commons/layout/MatrixLayout

extends Control

A matrix layout arranges controls in a grid structure, using rows which need not have the same number of cells.

It uses predefined cell classes that guarantee appropriate distances between cells in the grid. The cell's vGutter property lets you specify additional horizontal distances easily. You can set these additional distances (known as gutters) with or without separators. The distance for each cell is specified by assigning a specific enumeration value of the class LayoutCellSeparator of the matrix data object.

You should avoid nesting matrix layouts. You should only use a matrix layout if you need to align controls horizontally across rows.

Deprecated API:Since version 1.38. Instead, use the sap.ui.layout.Grid control.

Constructor Summary
new sap.ui.commons.layout.MatrixLayout(sId?, mSettings?)Constructor for a new layout/MatrixLayout.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.commons.layout.MatrixLayout.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.layout.MatrixLayout with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.layout.MatrixLayout.getMetadata()Returns a metadata object for class sap.ui.commons.layout.MatrixLayout.
addRow(oRow)Adds some row to the aggregation rows.
createRow(rowContent)Creates a new matrix layout row and appends it to this matrix layout.
destroyRows()Destroys all the rows in the aggregation rows.
getColumns()Gets current value of property columns.
getHeight()Gets current value of property height.
getLayoutFixed()Gets current value of property layoutFixed.
getRows()Gets content of aggregation rows.
getWidth()Gets current value of property width.
getWidths()Gets current value of property widths.
indexOfRow(oRow)Checks for the provided sap.ui.commons.layout.MatrixLayoutRow in the aggregation rows.
insertRow(oRow, iIndex)Inserts a row into the aggregation rows.
removeAllRows()Removes all the controls from the aggregation rows.
removeRow(vRow)Removes a row from the aggregation rows.
setColumns(iColumns)Sets a new value for property columns.
setHeight(sHeight)Sets a new value for property height.
setLayoutFixed(bLayoutFixed)Sets a new value for property layoutFixed.
setWidth(sWidth)Sets a new value for property width.
setWidths(sWidths)Sets a new value for property widths.
Constructor Detail
new sap.ui.commons.layout.MatrixLayout(sId?, mSettings?)
Constructor for a new layout/MatrixLayout.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.

The supported settings are:

  • Properties
  • Aggregations
    • rows : sap.ui.commons.layout.MatrixLayoutRow[] (default)

In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.

Parameters:
{string}sId? id for the new control, generated automatically if no id is given
{object}mSettings? initial settings for the new control
Deprecated:
Since version 1.38. Instead, use the sap.ui.layout.Grid control.
Method Detail
sap.ui.commons.layout.MatrixLayout.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.commons.layout.MatrixLayout with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.commons.layout.MatrixLayout.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.layout.MatrixLayout.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
Adds some row to the aggregation rows.
Parameters:
{sap.ui.commons.layout.MatrixLayoutRow}oRow the row to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.layout.MatrixLayout} Reference to this in order to allow method chaining
createRow(rowContent): sap.ui.commons.layout.MatrixLayout
Creates a new matrix layout row and appends it to this matrix layout.

Each argument must be either a matrix layout cell, which is added to the row "as is", or an arbitrary content control, which is wrapped with a new (default) matrix layout cell first and then added to the row.

Parameters:
{sap.ui.core.Control|sap.ui.commons.layout.MatrixLayoutCell|string}rowContent to add
Returns:
{sap.ui.commons.layout.MatrixLayout}this to allow method chaining
Destroys all the rows in the aggregation rows.
Returns:
{sap.ui.commons.layout.MatrixLayout} Reference to this in order to allow method chaining
getColumns(): int
Gets current value of property columns.

Number of columns. If not specified, the number of columns will be determined from the given cells.

Returns:
{int} Value of property columns
getHeight(): sap.ui.core.CSSSize
Gets current value of property height.

CSS height of the matrix layout.

Returns:
{sap.ui.core.CSSSize} Value of property height
getLayoutFixed(): boolean
Gets current value of property layoutFixed.

Sets the table layout. If fixed the width parameter of a column has priority, if not the width of the content of the colums has priority. The default is "fixed". If the fixed layout is used a adequate width of the MatrixLayout should be provided. Otherwise the column width displayed could be different than the given ones because of browser dependend optimazations.

Default value is true.

Returns:
{boolean} Value of property layoutFixed
Gets content of aggregation rows.

The matrix layout's individual rows.

Returns:
{sap.ui.commons.layout.MatrixLayoutRow[]}
getWidth(): sap.ui.core.CSSSize
Gets current value of property width.

CSS width of the matrix layout. If the LayoutFixed = true a adequate width should be provided.

Returns:
{sap.ui.core.CSSSize} Value of property width
getWidths(): sap.ui.core.CSSSize[]
Gets current value of property widths.

Widths of the columns. Use an array to define the widths of the columns. If a column shall have an automatical sizing enter "auto" for this column width.

Returns:
{sap.ui.core.CSSSize[]} Value of property widths
indexOfRow(oRow): int
Checks for the provided sap.ui.commons.layout.MatrixLayoutRow in the aggregation rows. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.commons.layout.MatrixLayoutRow}oRow The row whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertRow(oRow, iIndex): sap.ui.commons.layout.MatrixLayout
Inserts a row into the aggregation rows.
Parameters:
{sap.ui.commons.layout.MatrixLayoutRow}oRow the row to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the row should be inserted at; for a negative value of iIndex, the row is inserted at position 0; for a value greater than the current size of the aggregation, the row is inserted at the last position
Returns:
{sap.ui.commons.layout.MatrixLayout} Reference to this in order to allow method chaining
Removes all the controls from the aggregation rows.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.ui.commons.layout.MatrixLayoutRow[]} An array of the removed elements (might be empty)
Removes a row from the aggregation rows.
Parameters:
{int|string|sap.ui.commons.layout.MatrixLayoutRow}vRow The rowto remove or its index or id
Returns:
{sap.ui.commons.layout.MatrixLayoutRow} The removed row or null
setColumns(iColumns): sap.ui.commons.layout.MatrixLayout
Sets a new value for property columns.

Number of columns. If not specified, the number of columns will be determined from the given cells.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{int}iColumns New value for property columns
Returns:
{sap.ui.commons.layout.MatrixLayout} Reference to this in order to allow method chaining
Sets a new value for property height.

CSS height of the matrix layout.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{sap.ui.core.CSSSize}sHeight New value for property height
Returns:
{sap.ui.commons.layout.MatrixLayout} Reference to this in order to allow method chaining
setLayoutFixed(bLayoutFixed): sap.ui.commons.layout.MatrixLayout
Sets a new value for property layoutFixed.

Sets the table layout. If fixed the width parameter of a column has priority, if not the width of the content of the colums has priority. The default is "fixed". If the fixed layout is used a adequate width of the MatrixLayout should be provided. Otherwise the column width displayed could be different than the given ones because of browser dependend optimazations.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Parameters:
{boolean}bLayoutFixed New value for property layoutFixed
Returns:
{sap.ui.commons.layout.MatrixLayout} Reference to this in order to allow method chaining
Sets a new value for property width.

CSS width of the matrix layout. If the LayoutFixed = true a adequate width should be provided.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{sap.ui.core.CSSSize}sWidth New value for property width
Returns:
{sap.ui.commons.layout.MatrixLayout} Reference to this in order to allow method chaining
Sets a new value for property widths.

Widths of the columns. Use an array to define the widths of the columns. If a column shall have an automatical sizing enter "auto" for this column width.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{sap.ui.core.CSSSize[]}sWidths New value for property widths
Returns:
{sap.ui.commons.layout.MatrixLayout} Reference to this in order to allow method chaining