Packageqnx.ui.listClasses
Classpublic class CellRenderer
InheritanceCellRenderer Inheritance SkinnableComponent Inheritance UIComponent Inheritance flash.display.MovieClip
Implements ICellRenderer
Subclasses AlternatingCellRenderer, DropDownCellRenderer, PickerListCellRenderer, SectionHeaderRenderer

The CellRenderer class provides the base functionality for cell renderers in any of the list classes, such as List, TileList, SectionList, and SectionTileList.

The CellRenderer class consists of a skin and a label.

See also

AlternatingCellRenderer


Public Properties
 PropertyDefined By
  column : int
Gets or sets the column of the cell.
CellRenderer
 Inheritedcontainment : String
Gets or sets a property that determines how a component is contained within a parent container.
UIComponent
  data : Object
Gets or sets the data object for the cell renderer.
CellRenderer
  index : int
Gets or sets the index of the cell.
CellRenderer
  isHeader : Boolean
[read-only] Returns a Boolean indicating whether or not the cell is a header.
CellRenderer
  row : int
Gets or sets the row of the cell.
CellRenderer
  section : int
Gets or sets the section of the cell.
CellRenderer
 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
  state : String
Gets or sets the state of the cell.
CellRenderer
Public Methods
 MethodDefined By
  
Creates a CellRenderer instance.
CellRenderer
 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
  
getTextFormatForState(state:String):TextFormat
Returns the TextFormat object for a specified state.
CellRenderer
 Inherited
invalidate(property:String, 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
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
  
setSize(w:Number, h:Number):void
[override] Sets the width and height of the component.
CellRenderer
 Inherited
setSkin(cellSkin:Object):void
Set the skin object on the component for it to render.
SkinnableComponent
  
setTextFormatForState(format:TextFormat, state:String):void
Sets the TextFormat object for the label of a given state.
CellRenderer
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
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):void
Lets the component know that the specified property has been validated.
UIComponent
Property Detail
columnproperty
column:int

Gets or sets the column of the cell.


Implementation
    public function get column():int
    public function set column(value:int):void
dataproperty 
data:Object

Gets or sets the data object for the cell renderer.

The set method expects the data object to contain a non-null label property. This property is used to set an internal label textfield.


Implementation
    public function get data():Object
    public function set data(value:Object):void
indexproperty 
index:int

Gets or sets the index of the cell.


Implementation
    public function get index():int
    public function set index(value:int):void
isHeaderproperty 
isHeader:Boolean  [read-only]

Returns a Boolean indicating whether or not the cell is a header.


Implementation
    public function get isHeader():Boolean
rowproperty 
row:int

Gets or sets the row of the cell.


Implementation
    public function get row():int
    public function set row(value:int):void
sectionproperty 
section:int

Gets or sets the section of the cell.


Implementation
    public function get section():int
    public function set section(value:int):void
stateproperty 
state:String

Gets or sets the state of the cell.


Implementation
    public function get state():String
    public function set state(value:String):void
Constructor Detail
CellRenderer()Constructor
public function CellRenderer()

Creates a CellRenderer instance.

Method Detail
getTextFormatForState()method
public function getTextFormatForState(state:String):TextFormat

Returns the TextFormat object for a specified state.

Parameters

state:String — The state (as a String) for the TextFormat object to return.

Returns
TextFormat — The TextFormat object for the specified state.

See also

setSize()method 
override public function setSize(w:Number, h:Number):void

Sets the width and height of the component.

Parameters

w:Number — The new height of the component (in pixels).
 
h:Number — The new width of the component (in pixels).

setTextFormatForState()method 
public function setTextFormatForState(format:TextFormat, state:String):void

Sets the TextFormat object for the label of a given state.

Valid states are SkinStates.UP, SkinStates.DOWN, SkinStates.SELECTED, SkinStates.DISABLED.

In the following example, TextFormat objects are created and applied to each button state by calling the setTextFormatForState method. The TextFormat objects are used to differentiate the appearance of the label text for the various button states. In the following example, unique TextFormat objects are created for the disabled, up, and down states.

         
            var format:TextFormat = new TextFormat();
            format.font = "BBAlpha Sans";
            format.size = 16;
            format.color = 0xcc0000;
            format.align = TextFormatAlign.CENTER;
            
            var formatDown:TextFormat = new TextFormat();
            formatDown.font = "BBAlpha Sans";
            formatDown.size = 16;
            formatDown.color = 0xFFFFFF;
            formatDown.align = TextFormatAlign.CENTER;
            
            var formatDisable:TextFormat = new TextFormat();
            formatDisable.font = "BBAlpha Sans";
            formatDisable.size = 16;
            formatDisable.color = 0xCCCCCC;
            formatDisable.align = TextFormatAlign.CENTER;
            var myButton:LabelButton = new LabelButton();
            
            myButton.setTextFormatForState(formatDisable,SkinStates.DISABLED);
            myButton.setTextFormatForState(format,SkinStates.UP);
            myButton.setTextFormatForState(formatDown,SkinStates.DOWN);
            myButton.setTextFormatForState(format,SkinStates.SELECTED);
            myButton.setTextFormatForState(format,SkinStates.DISABLED_SELECTED);
            myButton.label = "OK";
            myButton.x = myButton.y = 175; 
         

Parameters

format:TextFormat — The TextFormat object to apply to the button state.
 
state:String — The button state for which to apply the TextFormat object.

See also