YUI Flash Component Documentation | All Packages | All Classes | Index | Frames No Frames |
Class BorderLayout

Package | com.yahoo.astra.layout.modes
Class | public class BorderLayout
Inheritance | BorderLayout BaseLayoutMode flash.events.EventDispatcher
Implements | IAdvancedLayoutMode

Arranges a DisplayObjectContainer's children using a page-like border algorithm. Children with TOP and BOTTOM constraints will be positioned and sized like page headers and footers. LEFT and RIGHT constrained children will be positioned and sized like sidebars and CENTER constrained children will be positioned and stretched to fill the remaining space.

Advanced Client Options:

Client configuration parameters allow a developer to specify behaviors for individual children of the target container. To set these advanced options, one must call `addClient()` on the BorderLayout instance and pass the child to configure along with an object specifying the configuration parameters.

Example
The following code adds clients to a BorderLayout instance:

      var border:BorderLayout = new BorderLayout();
      border.addClient( headerSprite, { constraint: BorderConstraints.TOP } );
      border.addClient( contentSprite,
      {
          constraint: BorderConstraints.CENTER,
          maintainAspectRatio: true,
          horizontalAlign: HorizontalAlignment.CENTER,
          verticalAlign: VerticalAlignment.MIDDLE
      });
      border.addClient( footerSprite, { constraint: BorderConstraints.BOTTOM } );

      var container:LayoutContainer = new LayoutContainer();
      container.layoutMode = border;
      this.addChild( container );

Several client parameters are available with the BorderLayout algorithm:

`constraint` : String
  The BorderConstraints value to be used on the target by the layout algorithm. The default value is `BorderConstraints.CENTER`.
`maintainAspectRatio` : Boolean
  If true, the aspect ratio of the target will be maintained if it is resized.
`horizontalAlign` : String
  The horizontal alignment used when positioning the target. Used in combination with `maintainAspectRatio`.
`verticalAlign` : String
  The vertical alignment used when positioning the target. Used in combination with `maintainAspectRatio`.
`aspectRatio` : Number
  The desired aspect ratio to use with `maintainAspectRatio`. This value is optional. If no aspect ratio is provided, it will be determined based on the target's original width and height.
`includeInLayout` : Boolean
  If `false`, the target will not be included in layout calculations. The default value is `true`.

See also

BorderConstraints
HorizontalAlignment
VerticalAlignment
com.yahoo.astra.layout.LayoutContainer

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined by
--- | --- | ---
|  | horizontalGap : Number The number of horizontal pixels between each item displayed by this container. | BorderLayout
|  | paddingBottom : Number The number of pixels displayed at the bottom of the target's children. | BaseLayoutMode
|  | paddingLeft : Number The number of pixels displayed at the left of the target's children. | BaseLayoutMode
|  | paddingRight : Number The number of pixels displayed at the right of the target's children. | BaseLayoutMode
|  | paddingTop : Number The number of pixels displayed at the top of the target's children. | BaseLayoutMode
|  | verticalGap : Number The number of vertical pixels between each item displayed by this container. | BorderLayout

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined by
--- | --- | ---
|  | BorderLayout() Constructor. | BorderLayout
|  | addClient(target:DisplayObject, configuration:Object = null):void Registers a specific display object with the layout algorithm. | BaseLayoutMode
|  | layoutChildren(target:DisplayObjectContainer, bounds:Rectangle):Rectangle Children of the target DisplayObjectContainer will be positioned and sized based on a specified rectangle. | BorderLayout
|  | removeClient(target:DisplayObject):void Unregisters a specific display object from the layout algorithm. | BaseLayoutMode

Property detail

horizontalGap | property

`horizontalGap:Number` [read-write]

The number of horizontal pixels between each item displayed by this container.

Implementation
`public function get horizontalGap():Number`
`public function set horizontalGap(value:Number):void`

verticalGap | property |

`verticalGap:Number` [read-write]

The number of vertical pixels between each item displayed by this container.

Implementation
`public function get verticalGap():Number`
`public function set verticalGap(value:Number):void`
Constructor detail

BorderLayout | () | constructor

`public function BorderLayout()`

Constructor.

Method detail

layoutChildren | () | method

`public override function layoutChildren(target:DisplayObjectContainer, bounds:Rectangle):Rectangle`

Children of the target DisplayObjectContainer will be positioned and sized based on a specified rectangle. There is no requirement that the children remain entirely within that rectangle.

Returns the actual rectangular region in which the laid out children will appear. This may be larger or smaller than the suggested rectangle. This returned value is expected to be used by container components to determine if scrollbars are needed.

Parameters

| `target:DisplayObjectContainer` — The DisplayObjectContainer whose children will be laid out.
| `bounds:Rectangle` — The rectangular region in which the children should be laid out.

Returns

| `Rectangle` — The actual region in which the children are contained.