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 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 |
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 |
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). |
Method | Description |
---|---|
addAriaDescribedBy |
Adds some ariaDescribedBy into the association ariaDescribedBy. |
addAriaLabelledBy |
Adds some ariaLabelledBy into the association ariaLabelledBy. |
attachChange |
Attaches event handler When called, the context of the event handler (its 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 |
detachChange |
Detaches event handler 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
|
fireChange |
Fires event change to attached listeners. |
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 |
getEditable |
Gets current value of property editable. Determines if the rating symbols can be edited. Default value is |
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 |
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 |
getVisualMode |
Gets current value of property visualMode. Defines how float values are visualized: Full, Half, Continuous (see enumeration RatingIndicatorVisualMode) Default value is |
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 Default value is |
setEditable |
Sets a new value for property editable. Determines if the rating symbols can be edited. When called with a value of Default value is |
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 |
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 |
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 |
setMaxValue |
Setter for property Default value is |
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 Default value is |
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 Default value is |
unbindValue |
Unbinds property value from model data. |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
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
.
Gets current value of property editable.
Determines if the rating symbols can be edited.
Default value is true
.
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.
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.
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.
Gets current value of property maxValue.
Determines the number of displayed rating symbols
Default value is 5
.
Returns a metadata object for class sap.ui.commons.RatingIndicator.
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
.
Gets current value of property visualMode.
Defines how float values are visualized: Full, Half, Continuous (see enumeration RatingIndicatorVisualMode)
Default value is Half
.
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Setter for property maxValue
.
Default value is 5
Minimum value is 1
Param | Type | DefaultValue | Description |
---|---|---|---|
iMaxValue | int |
new value for property |
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 |
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 |