Packagecom.yworks.yfiles.layout.grid
Classpublic class PartitionGrid
InheritancePartitionGrid Inheritance YObject Inheritance Object

Class for creating a partition grid, i.e., a grid that partitions the drawing area into rectangular partition cells. The grid consists of rows and columns that are created using the corresponding constructors of this class or method #addColumn or #addRow. The PartitionGrid object has to be registered to the graph using DataProvider key PARTITION_GRID_DPKEY;

Each node can be assigned to a com.yworks.yfiles.layout.grid.PartitionCellId which represents a set of partition cells. The mapping has to be registered to the graph using DataProvider key PARTITION_CELL_DPKEY. Simple partition cell identifiers which represent a single partition cell, i.e., a row-/column-pair, can be created using method createCellId() or createCellId2().

Nodes can also be mapped to a partition cell identifier 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 partition cell (row-/column-pair) is associated with at most one partition cell identifier. The multi-cell identifier can be created using methods createCellSpanId3(), createCellSpanId2(), createCellSpanId(), createColumnSpanId(), and createRowSpanId().

Note: if at least one node is mapped to a multi-cell, enabling option optimizeColumnOrder or optimizeRowOrder has no effect.

Note: A group node mapped to a multi-cell identifier represents the corresponding multi-cell, i.e., its boundary corresponds to the smallest rectangle containing all partition cells (rows and columns) specified by the multi-cell. The boundary does not depend on the partition cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the partition cells. Furthermore, edges incident to such a group node are not considered during the layout. Mapping a group node to a simple partition cell identifier has no effect.

See also

PARTITION_GRID_DPKEY
com.yworks.yfiles.layout.grid.PartitionCellId
PARTITION_CELL_DPKEY
createCellId()
createCellId2()
createCellSpanId3()
createCellSpanId2()
createCellSpanId()
createColumnSpanId()
createRowSpanId()
optimizeColumnOrder
optimizeRowOrder


Public Properties
 PropertyDefined By
  columns : YList
[read-only] Returns the columns of the partition grid.
PartitionGrid
  optimizeColumnOrder : Boolean
Getter: Returns whether the order of the columns should be chosen automatically.
PartitionGrid
  optimizeRowOrder : Boolean
Getter: Returns whether the order of the rows should be chosen automatically.
PartitionGrid
  rows : YList
[read-only] Returns the rows of the partition grid.
PartitionGrid
Public Methods
 MethodDefined By
  
PartitionGrid(init:Boolean = true)
Constructs an empty partition grid.
PartitionGrid
  
Adds a new column to the partition grid.
PartitionGrid
  
Adds a new row to the partition grid.
PartitionGrid
  
Creates a partition cell identifier that represents the cell defined by the given column and row.
PartitionGrid
  
createCellId2(rowIndex:int, columnIndex:int):PartitionCellId
Creates a partition cell identifier that represents the cell defined by the given column and row index.
PartitionGrid
  
Creates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.
PartitionGrid
  
createCellSpanId2(fromRowIndex:int, fromColIndex:int, toRowIndex:int, toColIndex:int):PartitionCellId
Creates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.
PartitionGrid
  
Creates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.
PartitionGrid
  
Creates a partition cell identifier that represents a cell spanning a whole column.
PartitionGrid
  
Creates a partition cell identifier that represents a cell spanning a whole row.
PartitionGrid
 Inherited
equals(o:Object):Boolean
YObject
  
A method that is called at the end of the com.yworks.yfiles.layout.OrientationLayouter stage.
PartitionGrid
  
getClass():Class
[override]
PartitionGrid
  
Returns the column with the given index.
PartitionGrid
  
[static] Returns the partition grid associated with the given graph.
PartitionGrid
  
Returns the row with the given index.
PartitionGrid
 Inherited
hashCode():int
YObject
  
[static] Constructs an empty partition grid.
PartitionGrid
  
newPartitionGrid2(rowCount:int, columnCount:int):PartitionGrid
[static] Constructs a partition grid with rowCount rows and columnCount columns.
PartitionGrid
  
newPartitionGrid3(rowCount:int, columnCount:int, rowInsets:Number, columnInsets:Number, minRowSize:Number, minColumnSize:Number):PartitionGrid
[static] Constructs a partition grid with rowCount rows and columnCount columns as well as the given insets and min sizes.
PartitionGrid
  
Optimizes the order of the columns of the partition grid for the given graph.
PartitionGrid
  
Optimizes the order of the rows of the partition grid for the given graph.
PartitionGrid
  
A method that is called at the beginning of the com.yworks.yfiles.layout.OrientationLayouter stage.
PartitionGrid
Protected Methods
 MethodDefined By
  
Initializes this object.
PartitionGrid
  
initPartitionGrid2(rowCount:int, columnCount:int):void
Initializes this object.
PartitionGrid
  
initPartitionGrid3(rowCount:int, columnCount:int, rowInsets:Number, columnInsets:Number, minRowSize:Number, minColumnSize:Number):void
Initializes this object.
PartitionGrid
Public Constants
 ConstantDefined By
  PARTITION_CELL_DPKEY : Object = y.layout.grid.PartitionGrid.PARTITION_CELL_DPKEY
[static] com.yworks.yfiles.base.DataProvider key used to store com.yworks.yfiles.layout.grid.PartitionCellId instances for nodes of the graph.
PartitionGrid
  PARTITION_GRID_DPKEY : Object = y.layout.grid.PartitionGrid.PARTITION_DPKEY
[static] com.yworks.yfiles.base.DataProvider key used to store the com.yworks.yfiles.layout.grid.PartitionGrid structure.
PartitionGrid
Property Detail
columnsproperty
columns:YList  [read-only]

Returns the columns of the partition grid.


Implementation
    public function get columns():YList
optimizeColumnOrderproperty 
optimizeColumnOrder:Boolean

Getter: Returns whether the order of the columns should be chosen automatically. The default is true.

Note: 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.

Setter: Specifies whether the order of the columns should be chosen automatically to minimize edge lengths.

For all columns where com.yworks.yfiles.layout.grid.ColumnDescriptor.indexFixed is set to true, the relative ordering given by the indices is preserved. The remaining columns may be resorted so that the overall edge lengths are minimized.

Note: 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.


Implementation
    public function get optimizeColumnOrder():Boolean
    public function set optimizeColumnOrder(value:Boolean):void

See also

optimizeRowOrderproperty 
optimizeRowOrder:Boolean

Getter: Returns whether the order of the rows should be chosen automatically. The default is true.

Note: 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.

Setter: Specifies whether the order of the rows should be chosen automatically to minimize edge lengths.

For all rows where com.yworks.yfiles.layout.grid.RowDescriptor.indexFixed is set to true, the relative ordering given by the indices is preserved. The remaining rows may be resorted so that the overall edge lengths are minimized.

Note: 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.


Implementation
    public function get optimizeRowOrder():Boolean
    public function set optimizeRowOrder(value:Boolean):void

See also

rowsproperty 
rows:YList  [read-only]

Returns the rows of the partition grid.


Implementation
    public function get rows():YList
Constructor Detail
PartitionGrid()Constructor
public function PartitionGrid(init:Boolean = true)

Constructs an empty partition grid.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
addColumn()method
public function addColumn():ColumnDescriptor

Adds a new column to the partition grid. The index of the column (as returned by com.yworks.yfiles.layout.grid.ColumnDescriptor.index) is set to the size of the list returned by columns.

Returns
ColumnDescriptor — the new column.

See also

addRow()method 
public function addRow():RowDescriptor

Adds a new row to the partition grid. The index of the row (as returned by com.yworks.yfiles.layout.grid.RowDescriptor.index) is set to the size of the list returned by rows.

Returns
RowDescriptor — the new row.

See also

createCellId()method 
public function createCellId(rd:RowDescriptor, cd:ColumnDescriptor):PartitionCellId

Creates a partition cell identifier that represents the cell defined by the given column and row.

Parameters

rd:RowDescriptor — the row defining the cell
 
cd:ColumnDescriptor — the column defining the cell

Returns
PartitionCellId — the partition cell identifier

Throws
IllegalArgumentException — if the given column/row is null.
createCellId2()method 
public function createCellId2(rowIndex:int, columnIndex:int):PartitionCellId

Creates a partition cell identifier that represents the cell defined by the given column and row index.

Parameters

rowIndex:int — the row index of the row defining the cell
 
columnIndex:int — the column index of the column defining the cell

Returns
PartitionCellId — the partition cell identifier

Throws
IllegalArgumentException — if the given column/row index is not valid.
createCellSpanId()method 
public function createCellSpanId(rowList:Collection, columnList:Collection):PartitionCellId

Creates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.

The partition cell identifier represents all cells spanned by the columns of columnList and rows of rowList.

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

Parameters

rowList:Collection — the rows defining the cell
 
columnList:Collection — the columns defining the cell

Returns
PartitionCellId — the partition cell identifier
createCellSpanId2()method 
public function createCellSpanId2(fromRowIndex:int, fromColIndex:int, toRowIndex:int, toColIndex:int):PartitionCellId

Creates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.

The partition cell identifier represents all cells defined by a row with index between fromRow and toRow (both including) and a column with index between fromCol and toCol (both including).

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

Parameters

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

Returns
PartitionCellId — the partition cell identifier
createCellSpanId3()method 
public function createCellSpanId3(fromRow:RowDescriptor, fromCol:ColumnDescriptor, toRow:RowDescriptor, toCol:ColumnDescriptor):PartitionCellId

Creates a partition cell identifier that represents a multi-cell spanning multiple columns and rows.

The partition cell identifier 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 partition cell identifier represents the multi-cell, i.e., its boundary corresponds to the smallest rectangle containing all partition cells specified by the partition cell identifier. The boundary does not depend on the partition cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the partition cells. Furthermore, edges incident to such a group node are not considered during the layout.

Parameters

fromRow:RowDescriptor — the topmost row defining the cell
 
fromCol:ColumnDescriptor — the leftmost column defining the cell
 
toRow:RowDescriptor — the bottommost row defining the cell
 
toCol:ColumnDescriptor — the rightmost column defining the cell

Returns
PartitionCellId — the partition cell identifier
createColumnSpanId()method 
public function createColumnSpanId(columnIndex:int):PartitionCellId

Creates a partition cell identifier that represents a cell spanning a whole column.

A group node mapped to such a partition cell identifier represents the column, i.e., its enclosing boundary corresponds to that of the column. The boundary does not depend on the partition cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the partition cells. Furthermore, edges incident to such a group node are not considered during the layout.

Parameters

columnIndex:int — the column index of the column defining the cell

Returns
PartitionCellId — the partition cell identifier
createRowSpanId()method 
public function createRowSpanId(rowIndex:int):PartitionCellId

Creates a partition cell identifier that represents a cell spanning a whole row.

A group node mapped to such a partition cell identifier represents the row, i.e., its enclosing boundary corresponds to that of the row. The boundary does not depend on the partition cells associated with the group's descendants. Hence, each non-group descendant has to be manually assigned to one of the partition cells. Furthermore, edges incident to such a group node are not considered during the layout.

Parameters

rowIndex:int — the row index of the row defining the cell

Returns
PartitionCellId — the partition cell identifier
finalizeOrientationChange()method 
public function finalizeOrientationChange(orientationLayouter:OrientationLayouter, transformer:OrientationLayouter_Transformer):void

A method that is called at the end of the com.yworks.yfiles.layout.OrientationLayouter stage.

Parameters

orientationLayouter:OrientationLayouter — the instance of the orientation layouter
 
transformer:OrientationLayouter_Transformer — provides a method for transferring a point to its final position

See also

getClass()method 
override public function getClass():Class

Returns
Class
getColumn()method 
public function getColumn(index:int):ColumnDescriptor

Returns the column with the given index.

Parameters

index:int — the index of the column to be returned

Returns
ColumnDescriptor — the column with the given index or null if there is no such column
getPartitionGrid()method 
public static function getPartitionGrid(graph:Graph):PartitionGrid

Returns the partition grid associated with the given graph.

Parameters

graph:Graph — the graph

Returns
PartitionGrid — the partition grid of the graph or null if the graph has no associated partition grid
getRow()method 
public function getRow(index:int):RowDescriptor

Returns the row with the given index.

Parameters

index:int — the index of the row to be returned

Returns
RowDescriptor — the row with the given index or null if there is no such row
initPartitionGrid1()method 
protected final function initPartitionGrid1():void

Initializes this object. See the documentation of the corresponding factory method newPartitionGrid1() for details.

See also

initPartitionGrid2()method 
protected final function initPartitionGrid2(rowCount:int, columnCount:int):void

Initializes this object. See the documentation of the corresponding factory method newPartitionGrid2() for details.

Parameters

rowCount:int
 
columnCount:int

See also

initPartitionGrid3()method 
protected final function initPartitionGrid3(rowCount:int, columnCount:int, rowInsets:Number, columnInsets:Number, minRowSize:Number, minColumnSize:Number):void

Initializes this object. See the documentation of the corresponding factory method newPartitionGrid3() for details.

Parameters

rowCount:int
 
columnCount:int
 
rowInsets:Number
 
columnInsets:Number
 
minRowSize:Number
 
minColumnSize:Number

See also

newPartitionGrid1()method 
public static function newPartitionGrid1():PartitionGrid

Constructs an empty partition grid.

Returns
PartitionGrid
newPartitionGrid2()method 
public static function newPartitionGrid2(rowCount:int, columnCount:int):PartitionGrid

Constructs a partition grid with rowCount rows and columnCount columns.

Parameters

rowCount:int — the number of rows
 
columnCount:int — the number of columns

Returns
PartitionGrid
newPartitionGrid3()method 
public static function newPartitionGrid3(rowCount:int, columnCount:int, rowInsets:Number, columnInsets:Number, minRowSize:Number, minColumnSize:Number):PartitionGrid

Constructs a partition grid with rowCount rows and columnCount columns as well as the given insets and min sizes.

Parameters

rowCount:int — the number of rows
 
columnCount:int — the number of columns
 
rowInsets:Number — the top and bottom insets of the rows
 
columnInsets:Number — the left and right insets of the columns
 
minRowSize:Number — the minimum row height
 
minColumnSize:Number — the minimum column width

Returns
PartitionGrid
optimizeColumns()method 
public function optimizeColumns(g:Graph):void

Optimizes the order of the columns of the partition grid for the given graph. Note that this method is for internal use only!

If you want to use the column order optimization, please use option optimizeColumnOrder.

Parameters

g:Graph — the given graph.

See also

optimizeRows()method 
public function optimizeRows(g:Graph):void

Optimizes the order of the rows of the partition grid for the given graph. Note that this method is for internal use only!

If you want to use the column order optimization, please use option optimizeRowOrder.

Parameters

g:Graph — the given graph.

See also

prepareOrientationChange()method 
public function prepareOrientationChange(orientationLayouter:OrientationLayouter, transformer:OrientationLayouter_Transformer):void

A method that is called at the beginning of the com.yworks.yfiles.layout.OrientationLayouter stage.

Parameters

orientationLayouter:OrientationLayouter — the instance of the orientation layouter
 
transformer:OrientationLayouter_Transformer — provides a method for transferring an original point to its temporary position

See also

Constant Detail
PARTITION_CELL_DPKEYConstant
public static const PARTITION_CELL_DPKEY:Object = y.layout.grid.PartitionGrid.PARTITION_CELL_DPKEY

com.yworks.yfiles.base.DataProvider key used to store com.yworks.yfiles.layout.grid.PartitionCellId instances for nodes of the graph. Each node is placed inside the columns/rows defined by the corresponding partition cell identifier. Instances can be shared among multiple nodes, but don't have to be shared. Note, that multi-cell identifiers (i.e., a identifier that represents multiple columns/rows) are not allowed to overlap each other.

See also

PARTITION_GRID_DPKEYConstant 
public static const PARTITION_GRID_DPKEY:Object = y.layout.grid.PartitionGrid.PARTITION_DPKEY

com.yworks.yfiles.base.DataProvider key used to store the com.yworks.yfiles.layout.grid.PartitionGrid structure. If the provider contains a partition grid structure this structure will be considered during layout (provided that the layout algorithm supports such constraints).

See also