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.
See Also
Developer's Guide
Members
Constructors
LayoutGrid
(rowCount?: numbercolumnCount?: numberrowPadding?: numbercolumnPadding?: numberminRowSize?: numberminColumnSize?: number)Creates an instance of LayoutGrid and optionally creates the given number of rows and columns with given padding and minimum sizes.
LayoutGrid
(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.
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.Property Value
true if the order is chosen automatically, false otherwiseDefault Value
Sample Graphs
falsetrue, the relative ordering given by the indices is preserved. The remaining rows may be sorted again so that the overall edge lengths are minimized.Property Value
true if the order is chosen automatically, false otherwiseDefault Value
Sample Graphs
falseGets the rows of the LayoutGrid.
Methods
Adds a new column to the LayoutGrid instance.
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.
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.
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.
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
Parameters
- row: LayoutGridRow
- the row defining the cell
- column: LayoutGridColumn
- the column defining the cell
Return Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given column/row is
null
Creates a LayoutGridCellDescriptor defined by the given column and row index.
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
Throws
- Exception ({ name: 'ArgumentError' })
- if the given column/row index is not valid
See Also
Developer's Guide
createCellSpanDescriptor
(rowList: IEnumerable<LayoutGridRow>, columnList: IEnumerable<LayoutGridColumn>): LayoutGridCellDescriptorCreates a LayoutGridCellDescriptor that spans multiple columns and rows.
createCellSpanDescriptor
(rowList: IEnumerable<LayoutGridRow>, columnList: IEnumerable<LayoutGridColumn>): LayoutGridCellDescriptorThe 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.
Parameters
- rowList: IEnumerable<LayoutGridRow>
- the rows defining the cell
- columnList: IEnumerable<LayoutGridColumn>
- the columns defining the cell
Return Value
createCellSpanDescriptor
(fromRowIndex: numberfromColIndex: numbertoRowIndex: numbertoColIndex: number): LayoutGridCellDescriptorCreates a LayoutGridCellDescriptor that spans multiple columns and rows.
createCellSpanDescriptor
(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.
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
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.
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
Creates a LayoutGridCellDescriptor that spans a whole column.
Parameters
- columnIndex: number
- the column index of the column defining the cell
Return Value
Creates a dynamic LayoutGridCellDescriptor.
Return Value
Creates a LayoutGridCellDescriptor spanning a whole row.
Parameters
- rowIndex: number
- the row index of the row defining the cell
Return Value
Returns the column with the given index.
Parameters
- index: number
- the index of the column to be returned
Return Value
- LayoutGridColumn
- the column with the given index or
nullif no such column exists
Returns the row with the given index.
Parameters
- index: number
- the index of the row to be returned
Return Value
- LayoutGridRow
- the row with the given index or
nullif no such row exists
Constants
Static Methods
Returns the LayoutGrid instance of the first node of the given graph having LayoutGridCellDescriptor associated.
Parameters
- graph: LayoutGraph
- the given graph
Return Value
- LayoutGrid
- the LayoutGrid of the first node of the graph or
nullif no node of the graph has a LayoutGridCellDescriptor associated.