qnx.ui.listClasses.SectionTileList

SectionTileList

Properties | Methods | Events | Examples


Packageqnx.ui.listClasses
Classpublic class SectionTileList
InheritanceSectionTileList Inheritance SectionList Inheritance List Inheritance UIComponent Inheritance flash.display.MovieClip

The SectionTileList class allows you to group sections of data in a grid.

When the list is set to scroll vertically, the columnCount property is used to layout the grid. You can use the rowHeight and columnWidth height properties to set the dimensions of each cell. You can use the cellPadding property to set the padding between each cell.

The following image shows a basic calendar that is provided as an example:

A calendar.



Class information:
PlayBook Tablet OS Version:   1.0.6

View the examples

See also

SectionList
SectionDataProvider



Public Properties

 PropertyDefined By
 InheritedallowDeselect : Boolean
Determines if a selected cell in the list can be deselected when pressed.
List
  cellPadding : int
Gets or sets the amount of padding used between each cell in the grid.
SectionTileList
  columnCount : int
Gets or sets the number of columns in the grid.
SectionTileList
 InheritedcolumnWidth : int
Gets or sets the width of each column in the list.
List
 Inheritedcontainment : String
Gets or sets a property that determines how a component is contained within a parent container.
UIComponent
 InheriteddataProvider : IDataProvider
[override] Gets or sets the DataProvider for the list.
SectionList
 InheritedenableShadows : Boolean
Sets or gets whether the scroll shadows should be shown.
List
 InheritedfirstVisibleItem : ICellRenderer
[read-only] Returns the first visible item in the view port area as defined by the width and height
List
 InheritedfooterView : DisplayObject
Gets or sets the footer view.
List
 InheritedheaderHeight : int
Gets or sets the height of the header (in pixels).
SectionList
 InheritedheaderWidth : int
Gets or sets the width of the header (in pixels).
SectionList
 InheritedlastVisibleItem : ICellRenderer
[read-only] Returns the last visible item in the view port area as defined by the width and height
List
 InheritedrowHeight : int
Gets or sets the height of each row in the list.
List
 Inheritedscrollable : Boolean
Gets or sets a value that determines whether a list can be scrolled.
List
 InheritedscrollBarAlpha : Number
Gets or sets the opacity value for the scroll bar on the list.
List
 InheritedscrollBarColor : Number
Gets or sets the color of the scroll bar.
List
 InheritedscrollBarOffset : int
Gets or sets the x or y postion of the scrollbar, in pixels.
List
  scrollDirection : String
[override] A section tile list can only be scrolled vertically and will return a scroll direction of VERTICAL.
SectionTileList
 InheritedselectedIndex : int
[override] Setting the selectedIndex property will have no effect on the list and will cause an error to be thrown.
SectionList
 InheritedselectedIndices : Array
[override] Setting the selectedIndices property will have no effect on the list and will cause an error to be thrown.
SectionList
 InheritedselectedItem : Object
Gets or sets the currently selected item in a single-selectable list.
List
 InheritedselectedItems : Array
Gets or sets the group of selected items (selectedItems) in a multi-selectable list.
List
 InheritedselectionMode : int
Gets or sets a value that determines whether or not selection mode is enabled.
List
 Inheritedsize : Number
Gets or sets the size for this component (as a percentage of the container's size, or in pixels).
UIComponent
 InheritedsizeMode : String
Gets or sets the size mode for this component.
UIComponent
 InheritedsizeUnit : String
Gets or sets the unit of measure for the size property.
UIComponent

Public Methods

 MethodDefined By
  
Creates a new SectionTileList instance.
SectionTileList
 Inherited
addChildToIndex(item:Object, index:int):void
Appends a child item to a section in the list, given the index of the section.
SectionList
 Inherited
addChildToIndexAt(item:Object, index:int, childindex:int):void
Adds a child item to a section at a specified index.
SectionList
 Inherited
addItem(item:Object):void
Appends an item to the end of the list.
List
 Inherited
addItemAt(item:Object, index:int):void
Adds an item to the list at the specified index.
List
 Inherited
addItemsAt(items:Array, index:int):void
Adds an array item at the specified index.
List
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
drawNow():void
Calls the draw() method.
UIComponent
 Inherited
getIsCellVisibleAtIndex(index:int):Boolean
Returns a Boolean indicating whether or not a cell at a given index is visible in the virtual area.
List
 Inherited
getItemAt(index:int):Object
Returns the item in the DataProvider at the specified index.
List
 Inherited
invalidate(property:String = all, invalidateNow:Boolean = false):void
Marks the property as invalid and the draw() method is called on the next frame or the next render, whichever comes first.
UIComponent
 Inherited
removeAll():void
Removes all the items from the list.
List
 Inherited
Removes all child items from a section at the specified index.
SectionList
 Inherited
removeChildFromIndexAt(index:int, childindex:int):void
Removes a child item from a section at a specified index.
SectionList
 Inherited
removeItem(item:Object):void
Removes a given item from the list.
List
 Inherited
removeItemAt(index:int):void
Removes an item from list at the specified index.
List
 Inherited
replaceChildInIndexAt(index:int, item:Object, childindex:int):void
Replaces a child item in a section at a specified index.
SectionList
 Inherited
replaceItem(item:Object, oldObject:Object):void
Replaces an item, given the new item object and the old item.
List
 Inherited
replaceItemAt(item:Object, index:int):void
Replaces the item in the list at the specified index with a new item.
List
 Inherited
scrollIndexVisible(index:int, seconds:Number = 1):void
[override] Scrolls a given item into view, given an index and an animation duration (in seconds).
SectionList
 Inherited
scrollToIndex(index:int, seconds:Number = 1):void
[override] Animates the section into view so that the header is at the top of the list.
SectionList
 Inherited
scrollToIndexInSection(section:int, index:int, seconds:int = 1):void
Animates the child of a section into view.
SectionList
 Inherited
setHeaderSkin(skin:Object):void
Sets the header renderer skin.
SectionList
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
 Inherited
setSize(w:Number, h:Number):void
Sets the width and height of the component.
UIComponent
 Inherited
setSkin(skin:Object):void
Sets the cell renderer to use to populate the list.
List
 Inherited
updateChildInIndexAt(index:int, item:Object, childindex:int):void
Updates an item in a section at a specified index.
SectionList
 Inherited
updateItem(value:Object, oldObject:Object):void
Updates an item in the list, given the new item and the item to update.
List
 Inherited
updateItemAt(item:Object, index:int):void
Updates the item in the list at the specified index, given the new item.
List
 Inherited
updateItemsAt(items:Array, index:int):void
Updates the items starting at the specified index with new items.
List

Protected Methods

 MethodDefined By
 Inherited
callLater(method:Function):void
Calls the specified method on the next frame or the next render, which ever happens first.
UIComponent
 Inherited
createInstance(linkage:Object):DisplayObject
Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.
UIComponent
 Inherited
draw():void
Called every time you set the width and height of the component.
UIComponent
 Inherited
isInvalid(property:String, ... properties):Boolean
Checks to see if the property is invalid and returns true if it is.
UIComponent
 Inherited
mouseWheel(event:MouseEvent):void
List
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
setEnabled(val:Boolean):void
Called when the enabled property changes.
UIComponent
 Inherited
validate(property:String = all):void
Lets the component know that the specified property has been validated.
UIComponent

Events

 Event Summary Defined By
 InheritedDispatched when a change has occurred in the DataProvider.List
 Inherited Dispatched when a cell renderer is clicked.List
 Inherited Dispatched when scrolling begins.List
 Inherited Dispatched when scrolling ends.List
 Inherited Dispatched when scrolling occurs.List

Property Detail

cellPadding


cellPadding:int

Gets or sets the amount of padding used between each cell in the grid.

The default value is 10.


Implementation

public function get cellPadding():int
public function set cellPadding(value:int):void

columnCount


columnCount:int

Gets or sets the number of columns in the grid.

The default value is 1.


Implementation

public function get columnCount():int
public function set columnCount(value:int):void

scrollDirection


scrollDirection:String
[override]

A section tile list can only be scrolled vertically and will return a scroll direction of VERTICAL.


Implementation

public function get scrollDirection():String
public function set scrollDirection(value:String):void

See also

ScrollDirection

Constructor Detail

SectionTileList()


public function SectionTileList()

Creates a new SectionTileList instance.

Examples

In the following example, a SectionTileList instance is used to render a basic calendar.

package
{
    import flash.display.Sprite;
    
    import qnx.ui.data.SectionDataProvider;
    import qnx.ui.listClasses.SectionTileList;
    
    [SWF(height="600", width="1024", 
    frameRate="30", backgroundColor="#FFFFFF")]
    public class SectionTileSample extends Sprite
    {
        private var mySectionTileList:SectionTileList;
        
        
        public function SectionTileSample()
        {
            initializeUI();
            normalizeDays();
        }
        
        private function initializeUI():void
        {
        
            var bg:Sprite = new Sprite();
            bg.graphics.lineStyle(2,0xCCCCCC);
            bg.graphics.beginFill(0x333333,1);
            bg.graphics.drawRect(0,0,540,520);
            bg.graphics.endFill();
            bg.x = 90;
            bg.y = 40;
            this.addChild(bg);
            
            //create and setup section list 
            mySectionTileList = new SectionTileList();
            
            mySectionTileList.setPosition(100, 50);            
            mySectionTileList.width = 520;
            mySectionTileList.height = 500;
            mySectionTileList.columnCount = 5;
            mySectionTileList.cellPadding = 5;
            mySectionTileList.dataProvider = createDataProvider();
            
            
            
            this.addChild(mySectionTileList);
            
        }
        private function createDataProvider():SectionDataProvider
        {
            //populate month name array
            var arrMonth:Array=[];
            
            arrMonth.push({label: "January"});
            arrMonth.push({label: "February"});
            arrMonth.push({label: "March"});
            arrMonth.push({label: "April"});
            arrMonth.push({label: "May"});
            arrMonth.push({label: "June"});
            arrMonth.push({label: "July"});
            arrMonth.push({label: "August"});
            arrMonth.push({label: "September"});
            arrMonth.push({label: "October"});
            arrMonth.push({label: "November"});
            arrMonth.push({label: "December"});
            
            var mySDP:SectionDataProvider = new SectionDataProvider();
            
            //populate section data provider
            for( var i:int = 0; i < arrMonth.length; i++ )
            {
                
                //add month names
                var section:Object = new Object();
                section.label = arrMonth[i].label;
                
                mySDP.addItem( section );
                
                //add day numbers, all 31 for now
                for( var j:int = 1; j<32; j++ )
                {
                    mySDP.addChildToItem( {label:  j}, section );    
                }
                
            }
            
            
            
            return(mySDP);
        }
        
        
        private function normalizeDays():void{
            
            //Remove February Days
            //TODO: account for leap years
            mySectionTileList.removeChildFromIndexAt(1, 30);
            mySectionTileList.removeChildFromIndexAt(1, 29);
            mySectionTileList.removeChildFromIndexAt(1, 28);
            
            //Remove April Day
            mySectionTileList.removeChildFromIndexAt(3, 30);
            
            //Remove June Day
            mySectionTileList.removeChildFromIndexAt(5, 30);
            
            //Remove September Day
            mySectionTileList.removeChildFromIndexAt(8, 30);
            
            //Remove November Day
            mySectionTileList.removeChildFromIndexAt(10, 30);
            
        }
    }
}