C

LayoutGrid

This class represents a layout grid that partitions the drawing area into rectangular layout grid cells.
Inheritance Hierarchy

Remarks

Such a structure allows, for example, to model vertical/horizontal swimlanes which are often used in flow diagrams to separate logical units.

The grid consists of rows and columns that are created using the corresponding constructors of this class or methods addRow and addColumn. The LayoutGrid can be defined by using property grid or layoutGridCellDescriptors.

Each node can have a LayoutGridCellDescriptor assigned which represents a set of layout grid cells. The mapping has to be registered with the graph using layoutGridCellDescriptors. Simple layout grid cell descriptors which represent a single layout grid cell, i.e., a row/column pair, can be created using method createCellDescriptor or createCellDescriptor.

Nodes can also be mapped to a layout grid cell descriptor that represents a multi-cell, i.e., a cell spanning multiple columns and rows. Please note, however, that multi-cells are not allowed to overlap each other. This means that the user has to ensure that each grid cell (row/column pair) is associated with at most one cell descriptor. The multi-cell descriptor can be created using methods createCellSpanDescriptor, createCellSpanDescriptor, createCellSpanDescriptor , createColumnSpanDescriptor, and createRowSpanDescriptor.

Sample output of a layout algorithm with a layout grid

See Also

Developer's Guide

Members

Show:

Constructors

Creates an instance of LayoutGrid and optionally creates the given number of rows and columns with given padding and minimum sizes.

Parameters

rowCount?: number
The number of rows. The default value is 0.
columnCount?: number
The number of columns. The default value is 0.
rowPadding?: number
The top and bottom padding of the rows. The default value is 0.
columnPadding?: number
The left and right padding of the columns. The default value is 0.
minRowSize?: number
The minimum row height. The default value is 0.
minColumnSize?: number
The minimum column width. The default value is 0.

Properties

Gets the columns of the LayoutGrid.
readonlyfinal
Gets or sets whether or not the order of the columns should be chosen automatically to minimize edge lengths.
For all columns where indexFixed is set to true, the relative ordering given by the indices is preserved. The remaining columns may be sorted again so that the overall edge lengths are minimized.
If at least one node is mapped to a multi-cell (i.e., a cell spanning multiple columns/rows), enabling this option has no effect.
final

Property Value

true if the order is chosen automatically, false otherwise

Default Value

The default value is: true

Sample Graphs

ShownSetting: false
Gets or sets whether or not the order of the rows should be chosen automatically to minimize edge lengths.
For all rows where indexFixed is set to true, the relative ordering given by the indices is preserved. The remaining rows may be sorted again so that the overall edge lengths are minimized.
If at least one node is mapped to a multi-cell (i.e., a cell spanning multiple columns/rows), enabling this option has no effect.
final

Property Value

true if the order is chosen automatically, false otherwise

Default Value

The default value is: true

Sample Graphs

ShownSetting: false
Gets the rows of the LayoutGrid.
readonlyfinal

Methods

Adds a new column to the LayoutGrid instance.
The index of the column (as returned by index) is equal to the size of the list returned by columns.
final

Parameters

padding?: number
The left and right padding of the added column. The default value is 0.
minimumWidth?: number
The minimum width of the added column. The default value is 0.

Return Value

LayoutGridColumn
a new LayoutGridColumn instance
Adds a new column to the LayoutGrid instance.
The index of the column (as returned by index) is equal to the size of the list returned by columns.
final

Parameters

leftPadding: number
The left padding of the added column.
rightPadding: number
The right padding of the added column.
minimumWidth: number
The minimum width of the added column.

Return Value

LayoutGridColumn
a new LayoutGridColumn instance
Adds a new row to the LayoutGrid instance.
The index of the row (as returned by index) is equal to the size of the list returned by rows.
final

Parameters

padding?: number
The top and bottom padding of the added row. The default value is 0.
minimumHeight?: number
The minimum height of the added row. The default value is 0.

Return Value

LayoutGridRow
a new LayoutGridRow instance
Adds a new row to the LayoutGrid instance.
The index of the row (as returned by index) is equal to the size of the list returned by rows.
final

Parameters

topPadding: number
The top padding of the added row.
bottomPadding: number
The bottom padding of the added row.
minimumHeight: number
The minimum height of the added row.

Return Value

LayoutGridRow
a new LayoutGridRow instance
Creates a LayoutGridCellDescriptor defined by the given column and row.
final

Parameters

row: LayoutGridRow
the row defining the cell
column: LayoutGridColumn
the column defining the cell

Return Value

LayoutGridCellDescriptor

Throws

Exception ({ name: 'ArgumentError' })
if the given column/row is null
Creates a LayoutGridCellDescriptor defined by the given column and row index.
final

Parameters

rowIndex: number
the row index of the row defining the cell
columnIndex: number
the column index of the column defining the cell

Return Value

LayoutGridCellDescriptor

Throws

Exception ({ name: 'ArgumentError' })
if the given column/row index is not valid

See Also

Developer's Guide
Creates a LayoutGridCellDescriptor that spans multiple columns and rows.

The layout grid cell descriptor represents all cells spanned by the columns of columnList and rows of rowList.

A group node mapped to such a layout grid cell represents the multi-cell, i.e., its boundary corresponds to the smallest rectangle containing all layout grid cells specified by the layout grid cell descriptor. The boundary does not depend on the layout grid cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the layout grid cells. Furthermore, edges incident to such a group node are not considered during the layout.

final

Parameters

rowList: IEnumerable<LayoutGridRow>
the rows defining the cell
columnList: IEnumerable<LayoutGridColumn>
the columns defining the cell

Return Value

LayoutGridCellDescriptor
Creates a LayoutGridCellDescriptor that spans multiple columns and rows.

The layout grid cell descriptor represents all cells defined by a row with index between fromRowIndex and toRowIndex (both inclusive) and a column with index between fromColIndex and toColIndex (both inclusive).

A group node mapped to such a layout grid cell descriptor represents the multi-cell, i.e., its boundary corresponds to the smallest rectangle containing all layout grid cells specified by the layout grid cell descriptor. The boundary does not depend on the layout grid cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the layout grid cells. Furthermore, edges incident to such a group node are not considered during the layout.

final

Parameters

fromRowIndex: number
the row index of the topmost row defining the cell
fromColIndex: number
the column index of the leftmost column defining the cell
toRowIndex: number
the row index of the bottommost row defining the cell
toColIndex: number
the column index of the rightmost column defining the cell

Return Value

LayoutGridCellDescriptor

See Also

Developer's Guide
Creates a LayoutGridCellDescriptor spanning multiple columns and rows.

The layout grid cell descriptor represents all cells defined by a row between fromRow and toRow (both including) and a column between fromCol and toCol (both including).

A group node mapped to such a layout grid cell represents the multi-cell, i.e., its boundary corresponds to the smallest rectangle containing all layout grid cells specified by the layout grid cell descriptor. The boundary does not depend on the layout grid cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the layout grid cells. Furthermore, edges incident to such a group node are not considered during the layout.

final

Parameters

fromRow: LayoutGridRow
the topmost row defining the cell
fromCol: LayoutGridColumn
the leftmost column defining the cell
toRow: LayoutGridRow
the bottommost row defining the cell
toCol: LayoutGridColumn
the rightmost column defining the cell

Return Value

LayoutGridCellDescriptor
Creates a LayoutGridCellDescriptor that spans a whole column.
A group node mapped to such a layout grid cell descriptor represents the column, i.e., its enclosing boundary corresponds to that of the column. The boundary does not depend on the layout grid cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the layout grid cells. Furthermore, edges incident to such a group node are not considered during the layout.
If rows are added after creating such a layout grid cell, these rows are not included in the column span.
final

Parameters

columnIndex: number
the column index of the column defining the cell

Return Value

LayoutGridCellDescriptor
Creates a dynamic LayoutGridCellDescriptor.
Dynamic layout grid cell descriptors have no specific position in their associated grid, but their position is determined automatically by the algorithm like the TabularLayout does.
final

Return Value

LayoutGridCellDescriptor
Creates a LayoutGridCellDescriptor spanning a whole row.
A group node mapped to such a layout grid cell descriptor represents the row, i.e., its enclosing boundary corresponds to that of the row. The boundary does not depend on the layout grid cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the layout grid cells. Furthermore, edges incident to such a group node are not considered during the layout.
If columns are added after creating such a layout grid cell, these columns are not included in the row span.
final

Parameters

rowIndex: number
the row index of the row defining the cell

Return Value

LayoutGridCellDescriptor
Returns the column with the given index.
final

Parameters

index: number
the index of the column to be returned

Return Value

LayoutGridColumn
the column with the given index or null if no such column exists
Returns the row with the given index.
final

Parameters

index: number
the index of the row to be returned

Return Value

LayoutGridRow
the row with the given index or null if no such row exists

Constants

All constants are filtered. Go to Filters.

Static Methods

Returns the LayoutGrid instance of the first node of the given graph having LayoutGridCellDescriptor associated.
static

Parameters

graph: LayoutGraph
the given graph

Return Value

LayoutGrid
the LayoutGrid of the first node of the graph or null if no node of the graph has a LayoutGridCellDescriptor associated.