Packageardisia.components.rating
Classpublic class Rating
InheritanceRating Inheritance spark.components.SkinnableDataContainer
Implements mx.managers.IFocusManagerComponent

Provides a customizable rating control.

View the technical documentation on the Ardisia Labs website for more information.

Default MXML PropertydataProvider



Public Properties
 PropertyDefined By
  alignment : String
Set the alignment of the renderers.
Rating
  dataTipFormatFunction : Function
User provided callback function that formats the string displayed in the data tip.
Rating
  dataTipHideDelay : Number = 350
Delay before the data tip is hidden.
Rating
  dataTipInstance : DataTip
Instance of the data tip.
Rating
  dataTipPrecision : int = 2
Number of decimal places to use for the data tip text.
Rating
  editable : Boolean = true
Whether users can select values via hover.
Rating
  gap : Number
The gap between renderers in the layout.
Rating
  layoutAxis : String
The axis along which the renderers are laid out.
Rating
  maxValue : Number
The maximum allowed value and also sets the number of renderers that are created.
Rating
  showDataTip : Boolean = true
Set to true to display the highlight value in a dataTip.
Rating
  snapInterval : Number
Defines how precise the selected value is.
Rating
  value : Number
Holds the rating value selected by the user or set programatically.
Rating
  verticalLayoutDirection : String
The direction the renderers are laid out if the layoutAxis is set to "vertical".
Rating
Protected Properties
 PropertyDefined By
  collection : ArrayCollection
Collection used to populate the internal dataProvider.
Rating
  lastHighlightValue : Number = NaN
Stores the value of the last highlighted or hovered value that was not necessarily committed to the "value" property.
Rating
  numberFormatter : NumberFormatter
Reference to the numberFormatter used if a dataTip format function is not defined.
Rating
  tileLayout : TileLayout
Layout class that is hard-wired.
Rating
Public Methods
 MethodDefined By
  
Hide the data tip.
Rating
Protected Methods
 MethodDefined By
  
Display the data tip.
Rating
  
eventHandler(event:Event):void
Handles renderer mouse events.
Rating
  
getDataTipContent(data:Object):Object
Returns the contents for the data tip.
Rating
  
mouseHandler(event:MouseEvent):void
Handles mouse events over the control.
Rating
  
rendererAddHandler(event:RendererExistenceEvent):void
Add mouse listeners to renderers as they are added.
Rating
  
rendererRemoveHandler(event:RendererExistenceEvent):void
Remove mouse listeners from renderers as they are removed.
Rating
  
Sets the "percentHighlightFill" property on the passed renderer.
Rating
  
setupDataTip(data:Object):void
Setup the data tip.
Rating
  
setValue(value:Number, dispatch:Boolean = true):void
Update the "value" property without invalidating properties and optionally updating any binding(s).
Rating
  
Update the dataGroup skin part.
Rating
Events
 Event Summary Defined By
  Dispatched when the committed value changes due to user interaction.Rating
  Dispatched when the committed value changes.Rating
Skin Parts

This component uses skins made up of skin parts. Do not set the skin parts directly. The component's skin sets the skin parts.


 Skin Part Description Defined By
  
dataTipFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
The data tip.

The IFactory must return an object of type DataTip
Rating
Property Detail
alignmentproperty
alignment:String

Set the alignment of the renderers. Has the same options as the "horizontalAlignment" and "verticalAlignment" properties for the TileLayout class.

Not relevant if the Rating is sized to its measured dimensions.

The default value is "noJustify".


Implementation
    public function get alignment():String
    public function set alignment(value:String):void
collectionproperty 
protected var collection:ArrayCollection

Collection used to populate the internal dataProvider.

Not exposed.

dataTipFormatFunctionproperty 
public var dataTipFormatFunction:Function

User provided callback function that formats the string displayed in the data tip. The function takes a float as an argument and returns either a TextFlow or a String for the data tip contents.

The function has the following signature:

	 	funcName(value:Number):Object
	 	

The default value is null.

dataTipHideDelayproperty 
public var dataTipHideDelay:Number = 350

Delay before the data tip is hidden.

The default value is 350.

dataTipInstanceproperty 
public var dataTipInstance:DataTip

Instance of the data tip.

dataTipPrecisionproperty 
public var dataTipPrecision:int = 2

Number of decimal places to use for the data tip text.

Ignored if the "dataTipFormatFunction" property is not null.

The default value is 2.

editableproperty 
public var editable:Boolean = true

Whether users can select values via hover.

The default value is true.

gapproperty 
gap:Number

The gap between renderers in the layout.

Ignored if the "alignment" property is set to "justifyUsingGap" or "justifyUsingSpace".

The default value is 2.


Implementation
    public function get gap():Number
    public function set gap(value:Number):void
lastHighlightValueproperty 
protected var lastHighlightValue:Number = NaN

Stores the value of the last highlighted or hovered value that was not necessarily committed to the "value" property.

The value that is displayed in the dataTip.

layoutAxisproperty 
layoutAxis:String

The axis along which the renderers are laid out. Recognized values are "horizontal" or "vertical".

The default value is "horizontal".


Implementation
    public function get layoutAxis():String
    public function set layoutAxis(value:String):void
maxValueproperty 
maxValue:Number

The maximum allowed value and also sets the number of renderers that are created.

The default value is 5.


Implementation
    public function get maxValue():Number
    public function set maxValue(value:Number):void
numberFormatterproperty 
protected var numberFormatter:NumberFormatter

Reference to the numberFormatter used if a dataTip format function is not defined.

showDataTipproperty 
public var showDataTip:Boolean = true

Set to true to display the highlight value in a dataTip.

The default value is true.

snapIntervalproperty 
snapInterval:Number

Defines how precise the selected value is. Defaults to "1", meaning that the user selects 1 point, 2 points, etc. Set to a different float between 0 and 1 to define a more precise rating.

For example, 0.5, would allow users to select ratings in 0.5 point intervals.

Values that are 0 or negative will default to as small a snapInterval as possible. Values greater than 1 will be set to 1.

The default value is 1.


Implementation
    public function get snapInterval():Number
    public function set snapInterval(value:Number):void
tileLayoutproperty 
protected var tileLayout:TileLayout

Layout class that is hard-wired.

valueproperty 
value:Number

Holds the rating value selected by the user or set programatically.

Is bindable; dispatches "valueCommit" events.

The default value is 0.

This property can be used as the source for data binding.


Implementation
    public function get value():Number
    public function set value(value:Number):void
verticalLayoutDirectionproperty 
verticalLayoutDirection:String

The direction the renderers are laid out if the layoutAxis is set to "vertical".

top to bottom "ttb" or bottom to top "btt".

The default value is "ttb".


Implementation
    public function get verticalLayoutDirection():String
    public function set verticalLayoutDirection(value:String):void
Method Detail
displayDataTip()method
protected function displayDataTip(renderer:IRatingRenderer):void

Display the data tip.

Parameters

renderer:IRatingRenderer

eventHandler()method 
protected function eventHandler(event:Event):void

Handles renderer mouse events. Presumes renderers implement the IRatingRenderer interface.

Ignored if disableSelection is true.

Parameters

event:Event — The Event that triggered the handler.

getDataTipContent()method 
protected function getDataTipContent(data:Object):Object

Returns the contents for the data tip. Uses the "dataTipField" first, then the "dataTipFormatFunction" function, then the class default.

Can return a TextFlow or a String.

Parameters

data:Object — Object

Returns
Object — Object
hideDataTip()method 
public function hideDataTip():void

Hide the data tip.

mouseHandler()method 
protected function mouseHandler(event:MouseEvent):void

Handles mouse events over the control.

Useful to hold renderer highlighting until the mouse leaves the entire control, rather than a single renderer. This stops flickering of the renderers when mousing between them.

Parameters

event:MouseEvent — the MouseEvent that triggered the handler.

rendererAddHandler()method 
protected function rendererAddHandler(event:RendererExistenceEvent):void

Add mouse listeners to renderers as they are added.

Parameters

event:RendererExistenceEvent — the RendererExistenceEvent event that triggered the handler

rendererRemoveHandler()method 
protected function rendererRemoveHandler(event:RendererExistenceEvent):void

Remove mouse listeners from renderers as they are removed.

Parameters

event:RendererExistenceEvent — the RendererExistenceEvent event that triggered the handler

setHighlightOnRenderer()method 
protected function setHighlightOnRenderer(renderer:IRatingRenderer):void

Sets the "percentHighlightFill" property on the passed renderer. Calculations depend on whether layout is horizontal or vertical and whether the "verticalLayoutDirection" is "btt" or "ttb".

Parameters

renderer:IRatingRenderer — a renderer that implements IRatingRenderer

setupDataTip()method 
protected function setupDataTip(data:Object):void

Setup the data tip. Must be positioned elsewhere.

Parameters

data:Object — Object the data to setup the content of the data tip

setValue()method 
protected function setValue(value:Number, dispatch:Boolean = true):void

Update the "value" property without invalidating properties and optionally updating any binding(s).

Parameters

value:Number — the Number to set the "value" property to
 
dispatch:Boolean (default = true) — true to dispatch a FlexEvent.CHANGE event

updateDataGroup()method 
protected function updateDataGroup():void

Update the dataGroup skin part.

Event Detail
change Event
Event Object Type: ardisia.components.rating.events.RatingEvent
RatingEvent.type property = ardisia.components.rating.events.RatingEvent

Dispatched when the committed value changes due to user interaction.

valueCommit Event  
Event Object Type: mx.events.FlexEvent
FlexEvent.type property = mx.events.FlexEvent

Dispatched when the committed value changes.