ibm_ilog.diagram.gfxlayout.GridLayout (version 1.1-SNAPSHOT)
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
- onLayoutPropertyChanged() Fires a layout property changed event.
Attached Objects
Properties
Methods
Parameter | Type | Description |
---|---|---|
bbox | dojox.gfx.Rectangle | Rectangle: the bounding box of the associated container. |
Parameter | Type | Description |
---|---|---|
proposedSize |
Parameter | Type | Description |
---|---|---|
args |
Parameter | Type | Description |
---|---|---|
contBounds | Rect |
This method post a layout request to the layout engine.
Parameter | Type | Description |
---|---|---|
contBounds |
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)
Parameter | Type | Description |
---|---|---|
shape | dojox.gfx.Shape | |
slotBounds | dojox.gfx.Rectangle | |
hAlign | Boolean | : indicates whether the shape must be aligned horizontally according to the value of its halign property. |
vAlign | Boolean | : indicates whether the shape must be aligned vertically according to the value of its valign property. |
Parameter | Type | Description |
---|---|---|
value | Boolean | Boolean: the automatic flow direction. |
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.
Parameter | Type | Description |
---|---|---|
value |
Events
This method should be called by layout subclasses when a property change needs the layout to be refreshed.