IBM ILOG Dojo Diagrammer 1.1.1 API Documentation
Legend: Array Boolean Constructor Date DomNode Error Function Namespace Number Object RegExp Singleton String

ibm_ilog.diagram.gfxlayout.GridLayout

Object » ibm_ilog.diagram.gfxlayout.Layout » ibm_ilog.diagram.gfxlayout.GridLayout
dojo.require("ibm_ilog.diagram.gfxlayout.GridLayout");

The GridLayout class arranges children of a container as grid elements.

The grid structure is defined by the 'rows' and 'cols' constructor parameters. These properties are arrays of descriptor objects that defined how the column or row size is computed. These descriptor objects support the following properties: 'width': if the container width (resp. height) is not fixed, then the column width (resp. row height) depends on the value of this property. A value of -1 means the dimension will accomodate to the maximum children dimension. Any other positive number sets the column width (resp. row height). 'weight': if the container width (resp. height) is fixed, this property defines how the space remaining after all the fixed width's (resp. height's) have been substracted from the container width (resp. height) is distributed accross the columns (resp. the rows).

The GridLayout class defines the paddingLeft, paddingRight, paddingTop and paddingBottom properties to specificy the internal margins of the panel from which the children are positionned. A convenient global padding property is also defined to set the same padding in all directions.

Children in the grid are placed into the grid cells according to the 'column' and 'row' properties of the children. When these properties are not specified on a shape, the shape is automatically placed in the grid according to its order in the container children list. The direction of the placement flow is defined via the 'horizontalFlow' property, which is 'true' by default. For example, assuming the 'horizontalFlow' property is set to 'true' the children do not defined any specific row/col index, the first child will be placed at the (0,0) cell, the 2nd one at the (1,0) cell, and so on.

A child can span over multiple rows or columns depending on their 'colspan' or 'rowspan' properties. These properties indicates the number of columns or rows the child must overlap. A value of '-1' means the child should span over all the remaining columns or rows.

Children are arranged within the computed grid cell according to their 'valign' (one of the 'top', 'center', 'bottom' and 'stretch' values), 'halign' (one of the 'left', 'center', 'right' and 'stretch' values) and their 'margins' properties.

Property Summary

Method Summary

  • adjustBBox(bbox) Returns the container bbox adjusted according to the constraints of this layout.
  • computePreferredSize(proposedSize) compute the preferred size of the associated container according to the layout strategy.
  • constructor(args) Creates and initializes a new ibm_ilog.diagram.gfxlayout.Layout instance. args : Object : a mixin set of parameters.
  • doLayout(contBounds) Applies this layout to the associated container.
  • getConfig() Gets the current configuration of this layout instance. Description: This method returns a descriptor of this layout current configuration as well as the type information so that it can be passed to the Group.setLayout() method (for example to make a copy the layout of a Group).
  • getHorizontalFlow()
  • inLayout() Indicates whether this layout is in a layout session.
  • invalidate() Invalidates this layout.
  • layoutChildren(contBounds) Applies this layout strategy to the associated container within the specified bounds. Subclass must override this method to implement their own layout logic.
  • placeChildInSlot(shape, slotBounds, hAlign, vAlign) Places the specified object in the given slotBounds.
  • setHorizontalFlow(value) Sets whether children with no specified 'row' or 'column' properties are arranged horizontally or vertically in the grid.
  • setPadding(value) Sets the padding of this layout.

Event Summary

Attached Objects

Properties

cols
rows

Methods

adjustBBox
Returns the container bbox adjusted according to the constraints of this layout.
ParameterTypeDescription
bboxdojox.gfx.RectangleRectangle: the bounding box of the associated container.
computePreferredSize
compute the preferred size of the associated container according to the layout strategy.
ParameterTypeDescription
proposedSize
constructor
Creates and initializes a new ibm_ilog.diagram.gfxlayout.Layout instance. args : Object : a mixin set of parameters.
ParameterTypeDescription
args
doLayout
Applies this layout to the associated container.
ParameterTypeDescription
contBoundsRect
getConfig
Object An object that represents the layout current configuration.
Gets the current configuration of this layout instance. Description: This method returns a descriptor of this layout current configuration as well as the type information so that it can be passed to the Group.setLayout() method (for example to make a copy the layout of a Group).
getHorizontalFlow
inLayout
Indicates whether this layout is in a layout session.
invalidate

This method post a layout request to the layout engine.

layoutChildren
Applies this layout strategy to the associated container within the specified bounds. Subclass must override this method to implement their own layout logic.
ParameterTypeDescription
contBounds
placeChildInSlot

This method should be invoked by layout implementation to place a shape within the given slot bounds, taking into account the vertical and horizontal alignment contraints of the shape (specified by means of the 'valign' and 'halign' properties on the shape object) and the margins, if any (specified by means of the 'margins' property. shape : dojox.gfx.Shape: the shape. slotBounds : Rectangle : the slot bounds (i.e the bounds where the shape must lie in)

ParameterTypeDescription
shapedojox.gfx.Shape
slotBoundsdojox.gfx.Rectangle
hAlignBoolean: indicates whether the shape must be aligned horizontally according to the value of its halign property.
vAlignBoolean: indicates whether the shape must be aligned vertically according to the value of its valign property.
setHorizontalFlow
Sets whether children with no specified 'row' or 'column' properties are arranged horizontally or vertically in the grid.
ParameterTypeDescription
valueBooleanBoolean: the automatic flow direction.
setPadding

This property is used to set the internal margins of this layout. The value can either be a 4-elements array whose items match respectively the left, top, right and bottom paddings ; or one integer that is applied to all paddings.

ParameterTypeDescription
value

Events

onLayoutPropertyChanged

This method should be called by layout subclasses when a property change needs the layout to be refreshed.