Packagefeathers.layout
Classpublic class VerticalLayout
InheritanceVerticalLayout Inheritance BaseLinearLayout Inheritance BaseVariableVirtualLayout Inheritance starling.events.EventDispatcher
Implements IVariableVirtualLayout, ITrimmedVirtualLayout, IGroupedLayout, IDragDropLayout

Product Version : Feathers 1.0.0

Positions items from top to bottom in a single column.

See also

How to use VerticalLayout with Feathers containers


Public Properties
 PropertyDefined By
 InheritedafterVirtualizedItemCount : int
BaseLinearLayout
 InheritedbeforeVirtualizedItemCount : int
BaseLinearLayout
  distributeHeights : Boolean
Distributes the height of the view port equally to each item.
VerticalLayout
 InheritedfirstGap : Number
The space, in pixels, between the first and second items.
BaseLinearLayout
 Inheritedgap : Number
The space, in pixels, between items.
BaseLinearLayout
 InheritedhasVariableItemDimensions : Boolean
When the layout is virtualized, and this value is true, the items may have variable dimensions.
BaseVariableVirtualLayout
  headerIndices : Vector.<int>
Used internally by a component with grouped data to indicate which indices are headers for a group.
VerticalLayout
  headerScrollPositionVerticalAlign : String
When the scroll position is calculated for a header (specified by a GroupedList or another component with the headerIndicies property, an attempt will be made to align the header to this position.
VerticalLayout
  horizontalAlign : String
[override] The alignment of the items horizontally, on the x-axis.
VerticalLayout
 InheritedlastGap : Number
The space, in pixels, between the last and second to last items.
BaseLinearLayout
  maxRowCount : int
The maximum number of rows to display.
VerticalLayout
 Inheritedpadding : Number
Quickly sets all padding properties to the same value.
BaseLinearLayout
 InheritedpaddingBottom : Number
The space, in pixels, that appears on the bottom.
BaseLinearLayout
 InheritedpaddingLeft : Number
The minimum space, in pixels, to the left of the items.
BaseLinearLayout
 InheritedpaddingRight : Number
The minimum space, in pixels, to the right of the items.
BaseLinearLayout
 InheritedpaddingTop : Number
The space, in pixels, that appears on top.
BaseLinearLayout
  requestedRowCount : int
Requests that the layout set the view port dimensions to display a specific number of rows (plus gaps and padding), if possible.
VerticalLayout
  requiresLayoutOnScroll : Boolean
[override] [read-only] Determines if the container calls layout() when the scroll position changes.
VerticalLayout
 InheritedresetTypicalItemDimensionsOnMeasure : Boolean
If set to true, the width and height of the typicalItem will be reset to typicalItemWidth and typicalItemHeight, respectively, whenever the typical item needs to be measured.
BaseLinearLayout
  scrollPositionVerticalAlign : String
When the scroll position is calculated for an item, an attempt will be made to align the item to this position.
VerticalLayout
  stickyHeader : Boolean
If a non-null value for the headerIndices property is provided (by a component like GroupedList), and the stickyHeader property is set to true, a header will stick to the top of the view port until the current group completely scrolls out of the view port.
VerticalLayout
 InheritedtypicalItem : DisplayObject
Used internally by a component that supports layout virtualization, such as List, to provide a display object with dimensions that represent a "typical" item in the layout.
BaseVariableVirtualLayout
 InheritedtypicalItemHeight : Number
Used to reset the height, in pixels, of the typicalItem for measurement.
BaseLinearLayout
 InheritedtypicalItemWidth : Number
Used to reset the width, in pixels, of the typicalItem for measurement.
BaseLinearLayout
 InheriteduseVirtualLayout : Boolean
Determines if virtual layout should be used.
BaseVariableVirtualLayout
  verticalAlign : String
[override] If the total item height is less than the bounds, the positions of the items can be aligned vertically, on the y-axis.
VerticalLayout
Public Methods
 MethodDefined By
  
Constructor.
VerticalLayout
 Inherited
addToVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void
Inserts an item in to the cache at the specified index, pushing the old cached value at that index, and all following values, up one index.
BaseVariableVirtualLayout
  
calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int
Using the current index and a key press, calculates the new index.
VerticalLayout
  
getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
Calculates the scroll position nearest to the current scroll position that will display the full bounds of the item within the view port.
VerticalLayout
  
getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
Using the item dimensions, calculates a scroll position that will ensure that the item at a given index will be visible within the specified bounds.
VerticalLayout
  
getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>
Used internally by a component, such as List, to determines which indices are visible with the specified view port bounds and scroll position.
VerticalLayout
  
layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult
Positions (and possibly resizes) the supplied items within the optional bounds argument.
VerticalLayout
  
measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point
Used internally by a component, such as List, to measure the view port based on the typical item dimensions or cached dimensions, if available.
VerticalLayout
 Inherited
Removes an item in to the cache at the specified index, moving the values at following indexes down by one.
BaseVariableVirtualLayout
 Inherited
Clears the cached dimensions for all virtualized indices.
BaseVariableVirtualLayout
 Inherited
resetVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void
Clears the cached dimensions for one specific virtualized index.
BaseVariableVirtualLayout
Events
 Event Summary Defined By
 InheritedDispatched when a property of the layout changes, indicating that a redraw is probably needed.BaseVariableVirtualLayout
 InheritedDispatched when the layout would like to adjust the container's scroll position.BaseVariableVirtualLayout
Property Detail
distributeHeightsproperty
distributeHeights:Boolean

Distributes the height of the view port equally to each item. If the view port height needs to be measured, the largest item's height will be used for all items, subject to any specified minimum and maximum height values.

The default value is false.


Implementation
    public function get distributeHeights():Boolean
    public function set distributeHeights(value:Boolean):void
headerIndicesproperty 
headerIndices:Vector.<int>

Used internally by a component with grouped data to indicate which indices are headers for a group.


Implementation
    public function get headerIndices():Vector.<int>
    public function set headerIndices(value:Vector.<int>):void
headerScrollPositionVerticalAlignproperty 
headerScrollPositionVerticalAlign:String

When the scroll position is calculated for a header (specified by a GroupedList or another component with the headerIndicies property, an attempt will be made to align the header to this position.

The default value is feathers.layout.VerticalAlign.TOP.


Implementation
    public function get headerScrollPositionVerticalAlign():String
    public function set headerScrollPositionVerticalAlign(value:String):void

See also

horizontalAlignproperty 
horizontalAlign:String[override]

The alignment of the items horizontally, on the x-axis.

If the horizontalAlign property is set to feathers.layout.HorizontalAlign.JUSTIFY, the width, minWidth, and maxWidth properties of the items may be changed, and their original values ignored by the layout. In this situation, if the width needs to be constrained, the width, minWidth, or maxWidth properties should instead be set on the parent container using the layout.

The default value is feathers.layout.HorizontalAlign.LEFT.


Implementation
    public function get horizontalAlign():String
    public function set horizontalAlign(value:String):void

See also

maxRowCountproperty 
maxRowCount:int

The maximum number of rows to display. If the explicit height of the view port is set or if requestedRowCount is set, then this value will be ignored. If the view port's minimum and/or maximum height are set, the actual number of visible rows may be adjusted to meet those requirements. Set this value to 0 to display as many rows as possible.

The default value is 0.


Implementation
    public function get maxRowCount():int
    public function set maxRowCount(value:int):void
requestedRowCountproperty 
requestedRowCount:int

Requests that the layout set the view port dimensions to display a specific number of rows (plus gaps and padding), if possible. If the explicit height of the view port is set, then this value will be ignored. If the view port's minimum and/or maximum height are set, the actual number of visible rows may be adjusted to meet those requirements. Set this value to 0 to display as many rows as possible.

The default value is 0.


Implementation
    public function get requestedRowCount():int
    public function set requestedRowCount(value:int):void

See also

requiresLayoutOnScrollproperty 
requiresLayoutOnScroll:Boolean  [read-only] [override]

Determines if the container calls layout() when the scroll position changes. Useful for transforming items as the view port scrolls. This value should be true for layouts that implement the IVirtualLayout interface and the useVirtualLayout property is set to true. May also be used by layouts that toggle item visibility as the items scroll into and out of the view port.


Implementation
    public function get requiresLayoutOnScroll():Boolean
scrollPositionVerticalAlignproperty 
scrollPositionVerticalAlign:String

When the scroll position is calculated for an item, an attempt will be made to align the item to this position.

The default value is feathers.layout.VerticalAlign.MIDDLE.


Implementation
    public function get scrollPositionVerticalAlign():String
    public function set scrollPositionVerticalAlign(value:String):void

See also

stickyHeaderproperty 
stickyHeader:Boolean

If a non-null value for the headerIndices property is provided (by a component like GroupedList), and the stickyHeader property is set to true, a header will stick to the top of the view port until the current group completely scrolls out of the view port.

The default value is false.


Implementation
    public function get stickyHeader():Boolean
    public function set stickyHeader(value:Boolean):void
verticalAlignproperty 
verticalAlign:String[override]

If the total item height is less than the bounds, the positions of the items can be aligned vertically, on the y-axis.

Note: The VerticalAlign.JUSTIFY constant is not supported.

The default value is feathers.layout.VerticalAlign.TOP.


Implementation
    public function get verticalAlign():String
    public function set verticalAlign(value:String):void

See also

Constructor Detail
VerticalLayout()Constructor
public function VerticalLayout()

Constructor.

Method Detail
calculateNavigationDestination()method
public function calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int

Using the current index and a key press, calculates the new index. This might be use to change a list's selectedIndex when a key is pressed.

Parameters

items:Vector.<DisplayObject>
 
index:int
 
keyCode:uint
 
bounds:LayoutBoundsResult

Returns
int
getNearestScrollPositionForIndex()method 
public function getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point

Calculates the scroll position nearest to the current scroll position that will display the full bounds of the item within the view port. If the item is already fully displayed in the view port, the current scroll position will be returned unchanged.

While the item will be displayed in the view port without being clipped in any way, it may not be placed in the most prominent position possible. To give the item a more prominent location, use getScrollPositionForIndex() instead.

This function should always be called after the layout() function. The width and height arguments are the final bounds of the view port, which may be calculated in the layout() function.

Parameters

index:int
 
scrollX:Number
 
scrollY:Number
 
items:Vector.<DisplayObject>
 
x:Number
 
y:Number
 
width:Number
 
height:Number
 
result:Point (default = null)

Returns
Point
getScrollPositionForIndex()method 
public function getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point

Using the item dimensions, calculates a scroll position that will ensure that the item at a given index will be visible within the specified bounds.

Typically, this function is used to show the item in the most prominent way, such as centering. To scroll a minimum distance required to display the full bounds of the item in the view port, use getNearestScrollPositionForIndex() instead.

This function should always be called after the layout() function. The width and height arguments are the final bounds of the view port, which may be calculated in the layout() function.

Parameters

index:int
 
items:Vector.<DisplayObject>
 
x:Number
 
y:Number
 
width:Number
 
height:Number
 
result:Point (default = null)

Returns
Point
getVisibleIndicesAtScrollPosition()method 
public function getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>

Used internally by a component, such as List, to determines which indices are visible with the specified view port bounds and scroll position. Indices that aren't returned are typically not displayed and can be replaced virtually. Uses the typical items dimensions, or cached dimensions, if available.

This function is meant to be called by the List or other component that uses the virtual layout. If you're simply creating a layout for a List or another component, do not call this function. It is meant for developers creating custom components only.

Parameters

scrollX:Number
 
scrollY:Number
 
width:Number
 
height:Number
 
itemCount:int
 
result:Vector.<int> (default = null)

Returns
Vector.<int>
layout()method 
public function layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult

Positions (and possibly resizes) the supplied items within the optional bounds argument. If no bounds are specified, the layout algorithm will assume that the bounds start a 0,0 and have unbounded dimensions. Returns the actual bounds of the content, which may be different than the specified bounds.

Note: The items are not absolutely restricted to appear only within the bounds. The bounds can affect positioning, but the algorithm may very well ignore them completely.

If a layout implementation needs to access accurate width and height values from items that are of type IFeathersControl, it must call validate() manually. For performance reasons, the container that is the parent of the items will not call validate() before passing the items to a layout implementation. Meeting this requirement may be as simple as looping through the items at the beginning of layout() and validating all items that are Feathers UI controls:

const itemCount:int = items.length;
for(var i:int = 0; i < itemCount; i++)
{
    var item:IFeathersControl = items[i] as IFeathersControl;
    if(item)
    {
        item.validate();
    }
}

Parameters

items:Vector.<DisplayObject>
 
viewPortBounds:ViewPortBounds (default = null)
 
result:LayoutBoundsResult (default = null)

Returns
LayoutBoundsResult
measureViewPort()method 
public function measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point

Used internally by a component, such as List, to measure the view port based on the typical item dimensions or cached dimensions, if available.

This function is meant to be called by the List or other component that uses the virtual layout. If you're simply creating a layout for a List or another component, do not call this function. It is meant for developers creating custom components only.

Parameters

itemCount:int
 
viewPortBounds:ViewPortBounds (default = null)
 
result:Point (default = null)

Returns
Point