qnx.fuse.ui.listClasses.SectionList

SectionList

Properties | Methods | Events | Examples


Packageqnx.fuse.ui.listClasses
Classpublic class SectionList
InheritanceSectionList Inheritance List Inheritance UIComponent Inheritance flash.display.MovieClip
Subclasses SectionTileList

The SectionList class allows you to group sections of data in a list.

For example, you can group a list of contacts based on the letters in the alphabet. You can provide custom headers for your list by calling the setHeader method. Your header must set the ICellRenderer.isHeader to true.

The following image shows a basic SectionList instance.

A section list.

Class information:
BlackBerry 10 Version:   10.0.0

View the examples

See also

SectionTileList



Public Properties

 PropertyDefined By
 InheritedallowDeselect : Boolean
Determines if a selected cell in the list can be deselected when pressed.
List
 InheritedcellRenderer : Object
Sets the cell renderer to use to populate the list.
List
 InheritedcolumnWidth : int
Gets or sets the width of each column in the list.
List
 InheritedcontextActions : Vector.<ActionSet>
Gets or Sets a Vector of ActionSet objects.
UIComponent
 InheritedcontextMultiSelectText : String
Gets or Sets a String to be displayed when showing the Multi Select Context Menu.
UIComponent
 InheritedcurrentTheme : String
[read-only] Returns the current theme this component is styled with.
UIComponent
  dataProvider : IDataProvider
[override] Gets or sets the DataProvider for the list.
SectionList
 InheritedenableShadows : Boolean
Sets or gets whether the scroll shadows should be shown.
List
 InheritedexplicitHeight : Number
[read-only] Returns the explicit height (actual height, in pixels) of the UI component.
UIComponent
 InheritedexplicitWidth : Number
[read-only] Returns the explicit width (actual width, in pixels) of the UI component.
UIComponent
 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
  headerHeight : int
Gets or sets the height of the header (in pixels).
SectionList
  headerSkin : Object
Sets the header renderer skin.
SectionList
  headerWidth : int
Gets or sets the width of the header (in pixels).
SectionList
 Inheritedid : String
The id is a name for the component that can be used in CSS using the # selector.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
 InheritedlastVisibleItem : ICellRenderer
[read-only] Returns the last visible item in the view port area as defined by the width and height
List
 InheritedlayoutData : Object
Gets or sets the layoutData.
UIComponent
 Inheritedlocale : String
Gets or sets the current locale of the component.
UIComponent
 InheritedlongPressedItem : Object
[read-only] Returns the item of the cell that is currently being long pressed.
List
 InheritedminHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
 InheritedminWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent
 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 : uint
Deprecated: scrollBarColor has been deprecated. The color can no longer be set.
Gets or sets the color of the scroll bar.
List
 InheritedscrollBarMargin : int
Gets or sets the margin between the list edge and the scrollbar, in pixels.
List
 InheritedscrollBarOffset : int
Gets or sets the x or y postion of the scrollbar relative to the edge of the content, in pixels.
List
 InheritedscrollDirection : String
Gets or sets the scroll direction of the list.
List
 Inheritedscrolling : Boolean
[read-only] Returns true if the List is currently scrolling.
List
  selectedIndex : int
[override] Setting the selectedIndex property will have no effect on the list and will cause an error to be thrown.
SectionList
  selectedIndices : 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
 InheritedstyleChildren : Boolean
Allows you to style the children of this component with CSS.
UIComponent

Protected Properties

 PropertyDefined By
 InheritedaccessibilityImplimentationClass : Class
UIComponent
  cssID : String
[override] [read-only] Returns the CSS ID of the component.
SectionList
 InheritedexplicitLocale : Boolean
Set to true when the locale property has been set externally.
UIComponent
 InheritedinternalID : String
The Component's Id used for styling.
UIComponent
 InheritedlongPressEnabled : Boolean
Specifies whether the UIComponent can detect a long press.
UIComponent

Public Methods

 MethodDefined By
  
Creates a new SectionList instance.
SectionList
  
addChildToIndex(item:Object, index:int):void
Appends a child item to a section in the list, given the index of the section.
SectionList
  
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
Cancels a long press from occuring on the component.
UIComponent
 Inherited
childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout.
UIComponent
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
Returns the CSS selector for the object, composing it from its position in the display hierarchy and an optional ID selector.
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
[override] Returns a flag indicating whether or not the list can grow vertically or horizontally.
List
 Inherited
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered.
UIComponent
 Inherited
Calling this method results in a call to the components validateProperties() method before the display list is rendered.
UIComponent
 Inherited
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
This method calls doMeasure() in order to calculate the preferred size of the control.
UIComponent
 Inherited
removeAll():void
Removes all the items from the list.
List
  
Removes all child items from a section at the specified index.
SectionList
  
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
  
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
  
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
scrollPages(pages:int, seconds:Number = 1):void
Scrolls a given number of pages in the list.
List
  
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
  
scrollToIndexInSection(section:int, index:int, seconds:int = 1):void
Animates the child of a section into view.
SectionList
 Inherited
setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting the explicitWidth and explicitHeight.
UIComponent
 Inherited
setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified by the arguments.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
  
updateChildInIndexAt(index:int, item:Object, childindex:int):void
Updates an item in a section at a specified index.
SectionList
 Inherited
updateDefaultLocale(updateChildren:Boolean = true):void
Updates the locale property to be the same as the locale of the device.
UIComponent
 Inherited
Lets a component that contains text know that it should update its font formats as the font settings have changed.
UIComponent
 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
 Inherited
Validates the display list of the component by calling the updateDisplayList().
UIComponent
 Inherited
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.
UIComponent
 Inherited
Validates the properties of the component by calling the commitProperties() method.
UIComponent

Protected Methods

 MethodDefined By
 Inherited
allowShowContextMenu(target:IEventDispatcher):Boolean
When the user presses on the component this method is called with the object that dispatched the event.
UIComponent
 Inherited
Process properties of the component.
UIComponent
 Inherited
Process the state of the component.
UIComponent
 Inherited
Style the component after the style has changed.
UIComponent
 Inherited
doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.
UIComponent
 Inherited
excemptFromCSSStyling(target:*, property:String = null):void
Exempts a property on an object from being styled by CSS.
UIComponent
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
UIComponent
 Inherited
getStyleApplier():Function
A style applier is a method that gets called every time a property from the stylesheet should be applied to the component.
UIComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
Is called when a user is no longer long pressing on the component.
UIComponent
 Inherited
Is called when a user long presses on the component.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
Invalidates the parent's size and display list if includeInLayout property is set to true.
UIComponent
 Inherited
Calling this function will refresh the ContextMenu with whatever actions were set by contextActions.
UIComponent
 Inherited
Shows the context menu if there are contextActions associated with the control.
UIComponent
 Inherited
styleState():void
Style the component after state has changed.
UIComponent
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent

Events

 Event Summary Defined By
 InheritedDispatched when an action in the Context Menu is selected.UIComponent
 InheritedDispatched when a change has occurred in the DataProvider.List
 InheritedDispatched when the Context Menu has closed to the DISMISSED state.UIComponent
 InheritedDispatched when the ContextMenu is closing to the DISMISSED state.UIComponent
 InheritedDispatched when the Context Menu has opened to the PEEK or EXPANDED state.UIComponent
 InheritedDispatched when the ContextMenu is opening from the DISMISSED state.UIComponent
 InheritedDispatched when a cell in the list is clicked.List
 InheritedDispatched when the CrossCut multiselect has been canceled.UIComponent
 InheritedDispached when the list beings to scroll.List
 InheritedDispatched when scrolling has finished.List
 InheritedDispatched when the list items change position during a scroll action.List

Property Detail

cssID


cssID:String  [read-only]
[override]

Returns the CSS ID of the component. The CSS ID is used for identifying the type of component in CSS.

The default value is SectionList.


Implementation

protected function get cssID():String

dataProvider


dataProvider:IDataProvider
[override]

Gets or sets the DataProvider for the list.

Unlike the List class, the dataProvider property for the SectionList class must be of type ISectionDataProvider class.


Implementation

public function get dataProvider():IDataProvider
public function set dataProvider(value:IDataProvider):void

headerHeight


headerHeight:int

Gets or sets the height of the header (in pixels).

The default value is 24.


Implementation

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

headerSkin


headerSkin:Object

Sets the header renderer skin. You can apply a custom header skin to customize the look of each section in the list.

You can pass in a qualified class name String, or the actual class. In either instance the class that is used must implement the ICellRenderer interface, and the isHeader property must return true.

Note: Do not pass in an instance of a skin class. This may cause unexpected behavior.

The default value is DefaultHeaderRenderer.


Implementation

public function get headerSkin():Object
public function set headerSkin(value:Object):void

Throws
ArgumentError — Throws an argument error if the isHeader property of the skin is not set to true.

headerWidth


headerWidth:int

Gets or sets the width of the header (in pixels).

The default value is 100.


Implementation

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

selectedIndex


selectedIndex:int
[override]

Setting the selectedIndex property will have no effect on the list and will cause an error to be thrown. Use selectedItem instead.


Implementation

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

Throws
Error — An error stating the selectedIndices cannot be set.

selectedIndices


selectedIndices:Array
[override]

Setting the selectedIndices property will have no effect on the list and will cause an error to be thrown. Use selectedItems instead.


Implementation

public function get selectedIndices():Array
public function set selectedIndices(value:Array):void

Throws
Error — An error stating the selectedIndices cannot be set.

Constructor Detail

SectionList()


public function SectionList()

Creates a new SectionList instance.

Method Detail

addChildToIndex()


public function addChildToIndex(item:Object, index:int):void

Appends a child item to a section in the list, given the index of the section.

Parameters

item:Object — The child item to add to the list.
index:int — The index of the section for which to add the child item.

addChildToIndexAt()


public function addChildToIndexAt(item:Object, index:int, childindex:int):void

Adds a child item to a section at a specified index.

Parameters

item:Object — The child item to add.
index:int — The index of the section for which to add the child item.
childindex:int — The index of the child item in the section.


Throws

RangeError — thrown if the specified index is less than 0 or greater than or equal to the length of the DataProvider.
RangeError — thrown if the specified childindex is less than 0 or greater than or equal to the length of the section.

removeAllChildrenFromIndex()


public function removeAllChildrenFromIndex(index:int):void

Removes all child items from a section at the specified index.

Parameters

index:int — The index of the section.

removeChildFromIndexAt()


public function removeChildFromIndexAt(index:int, childindex:int):void

Removes a child item from a section at a specified index.

mySectionList.removeChildFromIndexAt(1, 30);
mySectionList.removeChildFromIndexAt(1, 29);
mySectionList.removeChildFromIndexAt(1, 28); 
        

Parameters

index:int — The index of the section.
childindex:int — The index of the child in the section.


Throws

RangeError — thrown if the specified index is less than 0 or greater than or equal to the length of the DataProvider.
RangeError — thrown if the specified childindex is less than 0 or greater than or equal to the length of the section.

replaceChildInIndexAt()


public function replaceChildInIndexAt(index:int, item:Object, childindex:int):void

Replaces a child item in a section at a specified index.

Parameters

index:int — The index of the section.
item:Object — The new child item.
childindex:int — The index of the child item in the section.


Throws

RangeError — thrown if the specified index is less than 0 or greater than or equal to the length of the DataProvider.
RangeError — thrown if the specified childindex is less than 0 or greater than or equal to the length of the section.

scrollIndexVisible()


override public function scrollIndexVisible(index:int, seconds:Number = 1):void

Scrolls a given item into view, given an index and an animation duration (in seconds).

This function checks to see if the cell is currently visible before scrolling it into view. If the cell is not fully visible within the viewport of the list, it will scroll it into the viewport. If the cell is fully visible in the viewport, the list will not scroll.

Parameters

index:int — The index of the cell to animate into view.
seconds:Number (default = 1) — The duration of the animation in seconds. Default is 1 second.

scrollToIndex()


override public function scrollToIndex(index:int, seconds:Number = 1):void

Animates the section into view so that the header is at the top of the list.

Parameters

index:int — The index of the section for which to animate.
seconds:Number (default = 1) — The duration of the animation in seconds. Default is 1 second.

scrollToIndexInSection()


public function scrollToIndexInSection(section:int, index:int, seconds:int = 1):void

Animates the child of a section into view.

Parameters

section:int — The section that contains the child.
index:int — The index of the child for which to animate to.
seconds:int (default = 1) — The duration of the animation in seconds. Default is 1 second.

updateChildInIndexAt()


public function updateChildInIndexAt(index:int, item:Object, childindex:int):void

Updates an item in a section at a specified index.

Parameters

index:int — The index of the section.
item:Object — The new item.
childindex:int — The index of the item in the section.


Throws

RangeError — thrown if the specified index is less than 0 or greater than or equal to the length of the DataProvider.
RangeError — thrown if the specified childindex is less than 0 or greater than or equal to the length of the section.

Examples

The following example creates a SectionList instance that contains calendar data.

package
{
    import flash.display.Sprite;
    
    import qnx.ui.data.SectionDataProvider;
    import qnx.fuse.ui.listClasses.SectionList;
    
    [SWF(height="1280", width="768", frameRate="60", backgroundColor="#FFFFFF")]
    public class SectionSample extends Sprite
    {
        private var mySectionList:SectionList;
        
        public function SectionSample()
        {
            initializeUI();
            normalizeDays();
        }
        
        private function initializeUI():void
        {
            //create and setup section list 
            mySectionList = new SectionList();
            
            mySectionList.setPosition(100, 50);            
            mySectionList.width = 300;
            mySectionList.height = 500;    
            mySectionList.headerHeight = 48;    
            mySectionList.dataProvider = createDataProvider();
            
            this.addChild(mySectionList);    
        }
        
        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
            mySectionList.removeChildFromIndexAt(1, 30);
            mySectionList.removeChildFromIndexAt(1, 29);
            mySectionList.removeChildFromIndexAt(1, 28);
            
            //Remove April Day
            mySectionList.removeChildFromIndexAt(3, 30);
            
            //Remove June Day
            mySectionList.removeChildFromIndexAt(5, 30);
            
            //Remove September Day
            mySectionList.removeChildFromIndexAt(8, 30);
            
            //Remove November Day
            mySectionList.removeChildFromIndexAt(10, 30);
            
        }
    }
}
     




comments powered by Disqus