Packagecom.addicted2flash.layout.core
Classpublic class UIContainer
InheritanceUIContainer Inheritance UIComponent Inheritance flash.display.Sprite
ImplementsIUIContainer
SubclassesAbstractGridBox, Application, Canvas, FlowBox, HBox, UIPanel, UIScrollBar, UIScroller, VBox

Visual container for layouting components. The container is able to add/remove components. In addition it can be configured with a specific ILayout implementation for layouting its child components.



Public Properties
 PropertyDefined by
 Inheritedbounds : Rectangle
Returns a copy of the bounds of the component.
UIComponent
  componentCount : int
[read-only] Returns the total amount of components in the container.
UIContainer
 Inheritedconstraint : Object
Returns the constraint of the component.
UIComponent
  contentHeight : Number
[read-only] Returns the occupied height of all components.
UIContainer
  contentWidth : Number
[read-only] Returns the occupied width of all components.
UIContainer
 InheriteddesiredHeight : Number
Returns the desired height of the component.
UIComponent
 InheriteddesiredPercentHeight : Number
Sets the desired height of the component as percent value.
UIComponent
 InheriteddesiredPercentWidth : Number
Sets the desired width of the component as percent value.
UIComponent
 InheriteddesiredWidth : Number
Returns the desired width of the component.
UIComponent
 InheritedhasPercentagedHeight : Boolean
Returns true if desired height should be calculated in percentaged values.
UIComponent
 InheritedhasPercentagedWidth : Boolean
Returns true if desired width should be calculated in percentaged values.
UIComponent
 Inheritedheight : Number
Returns the height of the component.
UIComponent
 InheritedhorizontalAlignment : int
Returns the horiziontal alignment of the component.
UIComponent
 InheritedisValid : Boolean
Returns true if component is in a valid state.
UIComponent
  layout : ILayout
Returns the layout of the container.
UIContainer
 InheritedlayoutObserverCount : int
Returns the total amount of ILayoutObserver of this ILayoutObservable.
UIComponent
 Inheritedmargin : Margin
Returns the margin of the component.
UIComponent
 InheritedmaximumHeight : Number
Returns the maximum height of the component.
UIComponent
 InheritedmaximumWidth : Number
Returns the maximum width of the component.
UIComponent
 InheritedmeasuredDesiredHeight : Number
Sets the measured desired height of the component.
UIComponent
 InheritedmeasuredDesiredWidth : Number
Sets the measured desired width of the component.
UIComponent
 InheritedmeasuredMinimumHeight : Number
Sets the measured minimum height of the component.
UIComponent
 InheritedmeasuredMinimumWidth : Number
Sets the measured minimum width of the component.
UIComponent
 InheritedminimumHeight : Number
Returns the minimum height of the component.
UIComponent
 InheritedminimumWidth : Number
Returns the minimum width of the component.
UIComponent
 Inheritedpadding : Padding
Returns the padding of the component.
UIComponent
 InheritedparentContainer : IUIContainer
Returns the parent IUIContainer of the component.
UIComponent
 Inheritedstate : int
Returns the state of the component.
UIComponent
 InheritedverticalAlignment : int
Returns the vertical alignment of the component.
UIComponent
 Inheritedwidth : Number
Returns the width of the component.
UIComponent
 Inheritedx : Number
Returns the x position of the component.
UIComponent
 Inheritedy : Number
Returns the y position of the component.
UIComponent
Public Methods
 MethodDefined by
  
UIContainer(layout:ILayout = null)
Creates a new UIContainer.
UIContainer
  
add(c:IUIComponent, constraint:Object = null):IUIComponent
Adds a component to the container with a given constraint.
UIContainer
  
addAt(i:int, c:IUIComponent, constraint:Object = null):IUIComponent
Adds a component to the container, at a spcific index, with a given constraint.
UIContainer
 Inherited
Adds an ILayoutObserver to the set of observers for this object, provided that it is not the same as some observer already in the set.
UIComponent
  
Returns true if given component exists within containers list.
UIContainer
  
dispose():void
free memory for garbage collection.
UIContainer
  
findComponent(x:Number, y:Number):IUIComponent
Returns the component at the given position.
UIContainer
  
Returns the component at the given index.
UIContainer
  
Returns the index of the given component.
UIContainer
 Inherited
invalidate():void
Component will be measured and rearranged.
UIComponent
  
lock():void
Locks invalidation lifecycle when adding/removing components (no internal invalidate() calls after add/remove).
UIContainer
 Inherited
move(x:Number, y:Number):Boolean
Sets the position of the component and returns true if position has changed.
UIComponent
 Inherited
notifyLayoutObservers(type:int):void
Registered ILayoutObserver will be notified.
UIComponent
  
Removes a component from the container.
UIContainer
  
removeAll():void
Removes all components from the container.
UIContainer
  
Removes a component from the container, at a specific index.
UIContainer
 Inherited
Deletes an ILayoutObserver from the set of observers of this object.
UIComponent
 Inherited
resize(w:Number, h:Number):Boolean
Sets the size of the bounds and the desired size (pixel values) of the component.
UIComponent
  
setAt(i:int, c:IUIComponent, constraint:Object = null):IUIComponent
Replaces a component at a given index.
UIContainer
 Inherited
setLayoutSize(w:Number, h:Number):Boolean
This method is used for updating the size of the bounds within a validation lifecycle (in arrange process within a container).
UIComponent
  
toString():String
Returns the string representation of the UIContainer.
UIContainer
  
unlock():void
Unlocks invalidation lifecycle and calls invalidate() if container is not valid.
UIContainer
Protected Methods
 MethodDefined by
  
arrange():void
Concrete implementations need to override this method to arrange and size their components, depending on their bounds.
UIContainer
  
Concrete implementations need to override this method to handle horizontal overflow.
UIContainer
  
measure():void
Concrete implemenations need to override this method to set its sizes (measured desired, measured minimum size).
UIContainer
  
Validates the content bounds of the UIContainer.
UIContainer
  
Concrete implementations need to override this method to handle vertical overflow.
UIContainer
Property detail
componentCountproperty
componentCount:int  [read-only]

Returns the total amount of components in the container.

Implementation
    public function get componentCount():int
contentHeightproperty 
contentHeight:Number  [read-only]

Returns the occupied height of all components.

NOTE: the height and the content height can vary. If added components take more space than the height, the content height is bigger. The content height are necessary for handling overflows.

Implementation
    public function get contentHeight():Number
contentWidthproperty 
contentWidth:Number  [read-only]

Returns the occupied width of all components.

NOTE: the width and the content width can vary. If added components take more space than the width, the content width is bigger. The content width are necessary for handling overflows.

Implementation
    public function get contentWidth():Number
layoutproperty 
layout:ILayout  [read-write]

Returns the layout of the container.

Implementation
    public function get layout():ILayout
    public function set layout(value:ILayout):void
Constructor detail
UIContainer()constructor
public function UIContainer(layout:ILayout = null)

Creates a new UIContainer.

Parameters
layout:ILayout (default = null) — layout
Method detail
add()method
public function add(c:IUIComponent, constraint:Object = null):IUIComponent

Adds a component to the container with a given constraint.

NOTE: when multiple components must be added/removed and performance is an issue, use lock() before and unlock after adding/removing of components<./p> Parameters

c:IUIComponent — component to be added
 
constraint:Object (default = null) — specific layout constraint

Returns
IUIComponent — the given component
addAt()method 
public function addAt(i:int, c:IUIComponent, constraint:Object = null):IUIComponent

Adds a component to the container, at a spcific index, with a given constraint.

NOTE: when multiple components must be added/removed and performance is an issue, use lock() before and unlock after adding/removing of components<./p> Parameters

i:int — index of component
 
c:IUIComponent — component to be added
 
constraint:Object (default = null) — specific layout constraint

Returns
IUIComponent — the given component
arrange()method 
protected override function arrange():void

Concrete implementations need to override this method to arrange and size their components, depending on their bounds.

containsComponent()method 
public function containsComponent(c:IUIComponent):Boolean

Returns true if given component exists within containers list.

Parameters
c:IUIComponent — component

Returns
Boolean — true if given component exists within containers list
dispose()method 
public override function dispose():void

free memory for garbage collection.

findComponent()method 
public function findComponent(x:Number, y:Number):IUIComponent

Returns the component at the given position.

Parameters
x:Number — x-position
 
y:Number — y-position

Returns
IUIComponent — the component at the given position (null if it does not exist)
getAt()method 
public function getAt(i:int):IUIComponent

Returns the component at the given index.

Parameters
i:int — index of the component

Returns
IUIComponent — component at the given index or null if it does not exist
horizontalOverflow()method 
protected function horizontalOverflow():void

Concrete implementations need to override this method to handle horizontal overflow.

indexOfComponent()method 
public function indexOfComponent(c:IUIComponent):int

Returns the index of the given component.

Parameters
c:IUIComponent — component

Returns
int — index of the given component (-1 if it does not exist)
lock()method 
public function lock():void

Locks invalidation lifecycle when adding/removing components (no internal invalidate() calls after add/remove).

This is an efficient way to add/remove multiple components without unnecessary layout calculations.

measure()method 
protected override function measure():void

Concrete implemenations need to override this method to set its sizes (measured desired, measured minimum size).

This offers the possibility for container implementations to adjust their minimum size to the size of its components.

measureContentBounds()method 
protected function measureContentBounds():void

Validates the content bounds of the UIContainer.

NOTE: this method internally calculates the maximum needed size of all UIComponents and invokes processOverflow() when content bounds is bigger than the bounds.

remove()method 
public function remove(c:IUIComponent):IUIComponent

Removes a component from the container.

NOTE: when multiple components must be added/removed and performance is an issue, use lock() before and unlock after adding/removing of components<./p> Parameters

c:IUIComponent — component to be removed

Returns
IUIComponent — the given component
removeAll()method 
public function removeAll():void

Removes all components from the container.

removeAt()method 
public function removeAt(i:int):IUIComponent

Removes a component from the container, at a specific index.

NOTE: when multiple components must be added/removed and performance is an issue, use lock() before and unlock after adding/removing of components<./p> Parameters

i:int — the index of the component

Returns
IUIComponent — the removed component
setAt()method 
public function setAt(i:int, c:IUIComponent, constraint:Object = null):IUIComponent

Replaces a component at a given index.

Parameters
i:int — index of the component
 
c:IUIComponent — component to be added
 
constraint:Object (default = null) — specific layout constraint

Returns
IUIComponent — the given component
toString()method 
public override function toString():String

Returns the string representation of the UIContainer.

Returns
String — the string representation of the UIContainer
unlock()method 
public function unlock():void

Unlocks invalidation lifecycle and calls invalidate() if container is not valid.

verticalOverflow()method 
protected function verticalOverflow():void

Concrete implementations need to override this method to handle vertical overflow.