class sap.ui.commons.RatingIndicator

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/commons/RatingIndicator
Application Component: CA-UI5-CTR

RatingIndicator is used to let the user do some rating on a given topic. The amount of rating symbols can be specified, as well as the URIs to the image icons which shall be used as rating symbols. When the user performs a rating, an event is fired.


Constructor

Constructor for a new RatingIndicator.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.commons.RatingIndicator(sId?, mSettings?)
Param Type Default Value Description
sId? string

ID for the new control, generated automatically if no ID is given

mSettings? object

Initial settings for the new control


Properties

Name Type Default Value Description
averageValue float 0

Determines the average value. This value is shown if no value is set. This can be used to display an average Value before the user votes.

Visibility: public
editable boolean true

Determines if the rating symbols can be edited.

Visibility: public
iconHovered sap.ui.core.URI

The URI to the image which is displayed when the mouse hovers onto a rating symbol. If used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

Visibility: public
iconSelected sap.ui.core.URI

The URI to the image which shall be displayed for all selected rating symbols. Note that when this attribute is used, also the other icon attributes need to be set.

Visibility: public
iconUnselected sap.ui.core.URI

The URI to the image which shall be displayed for all unselected rating symbols. If this attribute is used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

Visibility: public
maxValue int 5

Determines the number of displayed rating symbols

Visibility: public
value float 0

Determines the currently selected value. If value is set to sap.ui.commons.RatingIndicator.NoValue, the averageValue is shown.

Visibility: public
visualMode sap.ui.commons.RatingIndicatorVisualMode Half

Defines how float values are visualized: Full, Half, Continuous (see enumeration RatingIndicatorVisualMode)

Visibility: public

Associations

Name Cardinality Type Description
ariaDescribedBy 0..n sap.ui.core.Control

Association to controls / ids which describe this control (see WAI-ARIA attribute aria-describedby).

ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby).


Events Overview

Event Description
change

The event is fired when the user has done a rating.

change

The event is fired when the user has done a rating.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
value int

The value of the user rating


Methods Overview

Method Description
addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

attachChange

Attaches event handler fnFunction to the change event of this sap.ui.commons.RatingIndicator.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.RatingIndicator itself.

The event is fired when the user has done a rating.

bindValue

Binds property value to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

detachChange

Detaches event handler fnFunction from the change event of this sap.ui.commons.RatingIndicator.

The passed function and listener object must match the ones used for event registration.

sap.ui.commons.RatingIndicator.extend

Creates a new subclass of class sap.ui.commons.RatingIndicator with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

fireChange

Fires event change to attached listeners.

getAccessibilityInfo

References:

  • sap.ui.core.Control#getAccessibilityInfo

getAriaDescribedBy

Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getAverageValue

Gets current value of property averageValue.

Determines the average value. This value is shown if no value is set. This can be used to display an average Value before the user votes.

Default value is 0.

getEditable

Gets current value of property editable.

Determines if the rating symbols can be edited.

Default value is true.

getIconHovered

Gets current value of property iconHovered.

The URI to the image which is displayed when the mouse hovers onto a rating symbol. If used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

getIconSelected

Gets current value of property iconSelected.

The URI to the image which shall be displayed for all selected rating symbols. Note that when this attribute is used, also the other icon attributes need to be set.

getIconUnselected

Gets current value of property iconUnselected.

The URI to the image which shall be displayed for all unselected rating symbols. If this attribute is used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

getMaxValue

Gets current value of property maxValue.

Determines the number of displayed rating symbols

Default value is 5.

sap.ui.commons.RatingIndicator.getMetadata

Returns a metadata object for class sap.ui.commons.RatingIndicator.

getValue

Gets current value of property value.

Determines the currently selected value. If value is set to sap.ui.commons.RatingIndicator.NoValue, the averageValue is shown.

Default value is 0.

getVisualMode

Gets current value of property visualMode.

Defines how float values are visualized: Full, Half, Continuous (see enumeration RatingIndicatorVisualMode)

Default value is Half.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

setAverageValue

Sets a new value for property averageValue.

Determines the average value. This value is shown if no value is set. This can be used to display an average Value before the user votes.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 0.

setEditable

Sets a new value for property editable.

Determines if the rating symbols can be edited.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

setIconHovered

Sets a new value for property iconHovered.

The URI to the image which is displayed when the mouse hovers onto a rating symbol. If used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

When called with a value of null or undefined, the default value of the property will be restored.

setIconSelected

Sets a new value for property iconSelected.

The URI to the image which shall be displayed for all selected rating symbols. Note that when this attribute is used, also the other icon attributes need to be set.

When called with a value of null or undefined, the default value of the property will be restored.

setIconUnselected

Sets a new value for property iconUnselected.

The URI to the image which shall be displayed for all unselected rating symbols. If this attribute is used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

When called with a value of null or undefined, the default value of the property will be restored.

setMaxValue

Setter for property maxValue.

Default value is 5 Minimum value is 1

setValue

Sets a new value for property value.

Determines the currently selected value. If value is set to sap.ui.commons.RatingIndicator.NoValue, the averageValue is shown.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 0.

setVisualMode

Sets a new value for property visualMode.

Defines how float values are visualized: Full, Half, Continuous (see enumeration RatingIndicatorVisualMode)

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Half.

unbindValue

Unbinds property value from model data.

addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

Param Type DefaultValue Description
vAriaDescribedBy sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to add; if empty, nothing is inserted

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

attachChange

Attaches event handler fnFunction to the change event of this sap.ui.commons.RatingIndicator.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.RatingIndicator itself.

The event is fired when the user has done a rating.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.commons.RatingIndicator itself

bindValue

Binds property value to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

Param Type DefaultValue Description
oBindingInfo sap.ui.base.ManagedObject.PropertyBindingInfo

The binding information

detachChange

Detaches event handler fnFunction from the change event of this sap.ui.commons.RatingIndicator.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.ui.commons.RatingIndicator.extend

Creates a new subclass of class sap.ui.commons.RatingIndicator with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

fireChange

Fires event change to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

value int

The value of the user rating

getAccessibilityInfo

References:

getAriaDescribedBy

Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getAverageValue

Gets current value of property averageValue.

Determines the average value. This value is shown if no value is set. This can be used to display an average Value before the user votes.

Default value is 0.

getEditable

Gets current value of property editable.

Determines if the rating symbols can be edited.

Default value is true.

getIconHovered

Gets current value of property iconHovered.

The URI to the image which is displayed when the mouse hovers onto a rating symbol. If used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

getIconSelected

Gets current value of property iconSelected.

The URI to the image which shall be displayed for all selected rating symbols. Note that when this attribute is used, also the other icon attributes need to be set.

getIconUnselected

Gets current value of property iconUnselected.

The URI to the image which shall be displayed for all unselected rating symbols. If this attribute is used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

getMaxValue

Gets current value of property maxValue.

Determines the number of displayed rating symbols

Default value is 5.

sap.ui.commons.RatingIndicator.getMetadata

Returns a metadata object for class sap.ui.commons.RatingIndicator.

getValue

Gets current value of property value.

Determines the currently selected value. If value is set to sap.ui.commons.RatingIndicator.NoValue, the averageValue is shown.

Default value is 0.

getVisualMode

Gets current value of property visualMode.

Defines how float values are visualized: Full, Half, Continuous (see enumeration RatingIndicatorVisualMode)

Default value is Half.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

Param Type DefaultValue Description
vAriaDescribedBy int sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to be removed or its index or ID

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

setAverageValue

Sets a new value for property averageValue.

Determines the average value. This value is shown if no value is set. This can be used to display an average Value before the user votes.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 0.

Param Type DefaultValue Description
fAverageValue float 0

New value for property averageValue

setEditable

Sets a new value for property editable.

Determines if the rating symbols can be edited.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bEditable boolean true

New value for property editable

setIconHovered

Sets a new value for property iconHovered.

The URI to the image which is displayed when the mouse hovers onto a rating symbol. If used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sIconHovered sap.ui.core.URI

New value for property iconHovered

setIconSelected

Sets a new value for property iconSelected.

The URI to the image which shall be displayed for all selected rating symbols. Note that when this attribute is used, also the other icon attributes need to be set.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sIconSelected sap.ui.core.URI

New value for property iconSelected

setIconUnselected

Sets a new value for property iconUnselected.

The URI to the image which shall be displayed for all unselected rating symbols. If this attribute is used, a requirement is that all custom icons need to have the same size. Note that when this attribute is used also the other icon attributes need to be set.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sIconUnselected sap.ui.core.URI

New value for property iconUnselected

setMaxValue

Setter for property maxValue.

Default value is 5 Minimum value is 1

Param Type DefaultValue Description
iMaxValue int

new value for property maxValue

setValue

Sets a new value for property value.

Determines the currently selected value. If value is set to sap.ui.commons.RatingIndicator.NoValue, the averageValue is shown.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 0.

Param Type DefaultValue Description
fValue float 0

New value for property value

setVisualMode

Sets a new value for property visualMode.

Defines how float values are visualized: Full, Half, Continuous (see enumeration RatingIndicatorVisualMode)

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Half.

Param Type DefaultValue Description
sVisualMode sap.ui.commons.RatingIndicatorVisualMode Half

New value for property visualMode

unbindValue

Unbinds property value from model data.