Class sap.m.TokenModule: sap/m/Token

extends Control

The sap.m.Token is a container of a single text item with a delete icon if the token is in edit mode.

Constructor Summary
new sap.m.Token(sId?, mSettings?)Constructor for a new Token.
Event Summary
delete(oControlEvent)This event is fired if the user clicks the token's delete icon.
press(oControlEvent)This event is fired when the user clicks on the token.
select(oControlEvent)This event is fired when the token gets selected.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.Token.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.Token with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.Token.getMetadata()Returns a metadata object for class sap.m.Token.
addAriaDescribedBy(vAriaDescribedBy)Adds some ariaDescribedBy into the association ariaDescribedBy.
addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy.
attachDelete(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the delete event of this sap.m.Token.
attachPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the press event of this sap.m.Token.
attachSelect(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the select event of this sap.m.Token.
detachDelete(fnFunction, oListener)Detaches event handler fnFunction from the delete event of this sap.m.Token.
detachPress(fnFunction, oListener)Detaches event handler fnFunction from the press event of this sap.m.Token.
detachSelect(fnFunction, oListener)Detaches event handler fnFunction from the select event of this sap.m.Token.
fireDelete(mArguments?)Fires event delete to attached listeners.
firePress(mArguments?)Fires event press to attached listeners.
fireSelect(mArguments?)Fires event select to attached listeners.
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.
getEditable()Gets current value of property editable.
getKey()Gets current value of property key.
getSelected()Gets current value of property selected.
getText()Gets current value of property text.
getTextDirection()Gets current value of property textDirection.
removeAllAriaDescribedBy()Removes all the controls in the association named ariaDescribedBy.
removeAllAriaLabelledBy()Removes all the controls in the association named ariaLabelledBy.
removeAriaDescribedBy(vAriaDescribedBy)Removes an ariaDescribedBy from the association named ariaDescribedBy.
removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy.
setEditable(bEditable)Sets a new value for property editable.
setKey(sKey)Sets a new value for property key.
setText(sText)Sets a new value for property text.
setTextDirection(sTextDirection)Sets a new value for property textDirection.
Constructor Detail
new sap.m.Token(sId?, mSettings?)
Constructor for a new Token.

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

The supported settings are:

  • Properties
  • Aggregations
    • Events
      • delete : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
      • press : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
      • select : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

    In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.

    Parameters:
    {string}sId? ID for the new control, generated automatically if no ID is given.
    {object}mSettings? Initial settings for the new control.
    Event Detail
    delete(oControlEvent)
    This event is fired if the user clicks the token's delete icon.
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    press(oControlEvent)
    This event is fired when the user clicks on the token.
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    select(oControlEvent)
    This event is fired when the token gets selected.
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    Method Detail
    sap.m.Token.extend(sClassName, oClassInfo?, FNMetaImpl?): function
    Creates a new subclass of class sap.m.Token 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.

    Parameters:
    {string}sClassName Name of the class being created
    {object}oClassInfo? Object literal with information about the class
    {function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
    Returns:
    {function} Created class / constructor function
    sap.m.Token.getMetadata(): sap.ui.base.Metadata
    Returns a metadata object for class sap.m.Token.
    Returns:
    {sap.ui.base.Metadata} Metadata object describing this class
    addAriaDescribedBy(vAriaDescribedBy): sap.m.Token
    Adds some ariaDescribedBy into the association ariaDescribedBy.
    Parameters:
    {string|sap.ui.core.Control}vAriaDescribedBy the ariaDescribedBy to add; if empty, nothing is inserted
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    addAriaLabelledBy(vAriaLabelledBy): sap.m.Token
    Adds some ariaLabelledBy into the association ariaLabelledBy.
    Parameters:
    {string|sap.ui.core.Control}vAriaLabelledBy the ariaLabelledBy to add; if empty, nothing is inserted
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    attachDelete(oData?, fnFunction, oListener?): sap.m.Token
    Attaches event handler fnFunction to the delete event of this sap.m.Token.

    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.m.Token itself.

    This event is fired if the user clicks the token's delete icon.

    Parameters:
    {object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
    {function}fnFunction The function to be called when the event occurs
    {object}oListener? Context object to call the event handler with. Defaults to this sap.m.Token itself
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    attachPress(oData?, fnFunction, oListener?): sap.m.Token
    Attaches event handler fnFunction to the press event of this sap.m.Token.

    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.m.Token itself.

    This event is fired when the user clicks on the token.

    Parameters:
    {object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
    {function}fnFunction The function to be called when the event occurs
    {object}oListener? Context object to call the event handler with. Defaults to this sap.m.Token itself
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    attachSelect(oData?, fnFunction, oListener?): sap.m.Token
    Attaches event handler fnFunction to the select event of this sap.m.Token.

    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.m.Token itself.

    This event is fired when the token gets selected.

    Parameters:
    {object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
    {function}fnFunction The function to be called when the event occurs
    {object}oListener? Context object to call the event handler with. Defaults to this sap.m.Token itself
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    detachDelete(fnFunction, oListener): sap.m.Token
    Detaches event handler fnFunction from the delete event of this sap.m.Token.

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

    Parameters:
    {function}fnFunction The function to be called, when the event occurs
    {object}oListener Context object on which the given function had to be called
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    detachPress(fnFunction, oListener): sap.m.Token
    Detaches event handler fnFunction from the press event of this sap.m.Token.

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

    Parameters:
    {function}fnFunction The function to be called, when the event occurs
    {object}oListener Context object on which the given function had to be called
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    detachSelect(fnFunction, oListener): sap.m.Token
    Detaches event handler fnFunction from the select event of this sap.m.Token.

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

    Parameters:
    {function}fnFunction The function to be called, when the event occurs
    {object}oListener Context object on which the given function had to be called
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    fireDelete(mArguments?): sap.m.Token
    Fires event delete to attached listeners.
    Parameters:
    {Map}mArguments? The arguments to pass along with the event
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    firePress(mArguments?): sap.m.Token
    Fires event press to attached listeners.
    Parameters:
    {Map}mArguments? The arguments to pass along with the event
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    fireSelect(mArguments?): sap.m.Token
    Fires event select to attached listeners.
    Parameters:
    {Map}mArguments? The arguments to pass along with the event
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    getAriaDescribedBy(): sap.ui.core.Control[]
    Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
    Returns:
    {sap.ui.core.Control[]}
    getAriaLabelledBy(): sap.ui.core.Control[]
    Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
    Returns:
    {sap.ui.core.Control[]}
    getEditable(): boolean
    Gets current value of property editable.

    Indicates the editable status of the token. If it is set to true, token displays a delete icon.

    Default value is true.

    Returns:
    {boolean} Value of property editable
    getKey(): string
    Gets current value of property key.

    Key of the token.

    Default value is .

    Returns:
    {string} Value of property key
    getSelected(): boolean
    Gets current value of property selected.

    Indicates the current selection status of the token.

    Default value is false.

    Returns:
    {boolean} Value of property selected
    getText(): string
    Gets current value of property text.

    Displayed text of the token.

    Default value is .

    Returns:
    {string} Value of property text
    getTextDirection(): sap.ui.core.TextDirection
    Gets current value of property textDirection.

    This property specifies the text directionality with enumerated options. By default, the control inherits text direction from the DOM.

    Default value is Inherit.

    Since:
    1.28.0
    Returns:
    {sap.ui.core.TextDirection} Value of property textDirection
    removeAllAriaDescribedBy(): sap.ui.core.Control[]
    Removes all the controls in the association named ariaDescribedBy.
    Returns:
    {sap.ui.core.Control[]} An array of the removed elements (might be empty)
    removeAllAriaLabelledBy(): sap.ui.core.Control[]
    Removes all the controls in the association named ariaLabelledBy.
    Returns:
    {sap.ui.core.Control[]} An array of the removed elements (might be empty)
    removeAriaDescribedBy(vAriaDescribedBy): sap.ui.core.Control
    Removes an ariaDescribedBy from the association named ariaDescribedBy.
    Parameters:
    {int|string|sap.ui.core.Control}vAriaDescribedBy The ariaDescribedByto be removed or its index or ID
    Returns:
    {sap.ui.core.Control} the removed ariaDescribedBy or null
    removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.Control
    Removes an ariaLabelledBy from the association named ariaLabelledBy.
    Parameters:
    {int|string|sap.ui.core.Control}vAriaLabelledBy The ariaLabelledByto be removed or its index or ID
    Returns:
    {sap.ui.core.Control} the removed ariaLabelledBy or null
    setEditable(bEditable): sap.m.Token
    Sets a new value for property editable.

    Indicates the editable status of the token. If it is set to true, token displays a delete icon.

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

    Default value is true.

    Parameters:
    {boolean}bEditable New value for property editable
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    setKey(sKey): sap.m.Token
    Sets a new value for property key.

    Key of the token.

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

    Default value is .

    Parameters:
    {string}sKey New value for property key
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    setText(sText): sap.m.Token
    Sets a new value for property text.

    Displayed text of the token.

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

    Default value is .

    Parameters:
    {string}sText New value for property text
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining
    setTextDirection(sTextDirection): sap.m.Token
    Sets a new value for property textDirection.

    This property specifies the text directionality with enumerated options. By default, the control inherits text direction from the DOM.

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

    Default value is Inherit.

    Parameters:
    {sap.ui.core.TextDirection}sTextDirection New value for property textDirection
    Since:
    1.28.0
    Returns:
    {sap.m.Token} Reference to this in order to allow method chaining