Class sap.ui.commons.ImageModule: sap/ui/commons/Image

extends Control

A wrapper around the IMG tag. The image can be loaded from a remote or local server. There are various size setting options available, and the images can be combined with actions.

Deprecated API:Since version 1.38. Instead, use the sap.m.Image control.

Constructor Summary
new sap.ui.commons.Image(sId?, mSettings?)Constructor for a new Image.
Event Summary
press(oControlEvent)Event is fired when the user clicks on the control.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.commons.Image.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.Image with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.Image.getMetadata()Returns a metadata object for class sap.ui.commons.Image.
attachPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the press event of this sap.ui.commons.Image.
detachPress(fnFunction, oListener)Detaches event handler fnFunction from the press event of this sap.ui.commons.Image.
firePress(mArguments?)Fires event press to attached listeners.
getAlt()Gets current value of property alt.
getDecorative()Gets current value of property decorative.
getHeight()Gets current value of property height.
getSrc()Gets current value of property src.
getUseMap()Gets current value of property useMap.
getWidth()Gets current value of property width.
setAlt(sAlt)Sets a new value for property alt.
setDecorative(bDecorative)Sets a new value for property decorative.
setHeight(sHeight)Sets a new value for property height.
setSrc(sSrc)Sets a new value for property src.
setUseMap(sUseMap)Sets a new value for property useMap.
setWidth(sWidth)Sets a new value for property width.
Constructor Detail
new sap.ui.commons.Image(sId?, mSettings?)
Constructor for a new Image.

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
  • Events
    • press : 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
Deprecated:
Since version 1.38. Instead, use the sap.m.Image control.
Event Detail
press(oControlEvent)
Event is fired when the user clicks on the control.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
Method Detail
sap.ui.commons.Image.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.commons.Image 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.ui.commons.Image.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.Image.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
attachPress(oData?, fnFunction, oListener?): sap.ui.commons.Image
Attaches event handler fnFunction to the press event of this sap.ui.commons.Image.

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.Image itself.

Event is fired when the user clicks on the control.

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.ui.commons.Image itself
Returns:
{sap.ui.commons.Image} Reference to this in order to allow method chaining
detachPress(fnFunction, oListener): sap.ui.commons.Image
Detaches event handler fnFunction from the press event of this sap.ui.commons.Image.

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.ui.commons.Image} Reference to this in order to allow method chaining
firePress(mArguments?): sap.ui.commons.Image
Fires event press to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.Image} Reference to this in order to allow method chaining
getAlt(): string
Gets current value of property alt.

The alternative text that is displayed in case the Image is not available, or cannot be displayed. If the image is set to decorative this property is ignored.

Returns:
{string} Value of property alt
getDecorative(): boolean
Gets current value of property decorative.

A decorative image is included for design reasons. Accessibility tools will ignore decorative images. Note: If the Image has an image map (useMap is set), this property will be overridden (the image will not be rendered as decorative). A decorative image has no ALT attribute, so the Alt property is ignored if the image is decorative.

Default value is true.

Returns:
{boolean} Value of property decorative
getHeight(): sap.ui.core.CSSSize
Gets current value of property height.

When the empty value is kept, the original size is not changed. It is also possible to make settings for width or height only, the overall size is maintained then, considering the aspect ratio.

Returns:
{sap.ui.core.CSSSize} Value of property height
getSrc(): sap.ui.core.URI
Gets current value of property src.

Relative or absolute path to URL where the image file is stored.

Returns:
{sap.ui.core.URI} Value of property src
getUseMap(): string
Gets current value of property useMap.

The name of the image map that defines the clickable areas

Returns:
{string} Value of property useMap
getWidth(): sap.ui.core.CSSSize
Gets current value of property width.

When the empty value is kept, the original size is not changed. It is also possible to make settings for width or height only, the overall size is maintained then, considering the aspect ratio.

Returns:
{sap.ui.core.CSSSize} Value of property width
setAlt(sAlt): sap.ui.commons.Image
Sets a new value for property alt.

The alternative text that is displayed in case the Image is not available, or cannot be displayed. If the image is set to decorative this property is ignored.

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

Parameters:
{string}sAlt New value for property alt
Returns:
{sap.ui.commons.Image} Reference to this in order to allow method chaining
setDecorative(bDecorative): sap.ui.commons.Image
Sets a new value for property decorative.

A decorative image is included for design reasons. Accessibility tools will ignore decorative images. Note: If the Image has an image map (useMap is set), this property will be overridden (the image will not be rendered as decorative). A decorative image has no ALT attribute, so the Alt property is ignored if the image is decorative.

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

Default value is true.

Parameters:
{boolean}bDecorative New value for property decorative
Returns:
{sap.ui.commons.Image} Reference to this in order to allow method chaining
setHeight(sHeight): sap.ui.commons.Image
Sets a new value for property height.

When the empty value is kept, the original size is not changed. It is also possible to make settings for width or height only, the overall size is maintained then, considering the aspect ratio.

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

Parameters:
{sap.ui.core.CSSSize}sHeight New value for property height
Returns:
{sap.ui.commons.Image} Reference to this in order to allow method chaining
setSrc(sSrc): sap.ui.commons.Image
Sets a new value for property src.

Relative or absolute path to URL where the image file is stored.

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

Parameters:
{sap.ui.core.URI}sSrc New value for property src
Returns:
{sap.ui.commons.Image} Reference to this in order to allow method chaining
setUseMap(sUseMap): sap.ui.commons.Image
Sets a new value for property useMap.

The name of the image map that defines the clickable areas

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

Parameters:
{string}sUseMap New value for property useMap
Returns:
{sap.ui.commons.Image} Reference to this in order to allow method chaining
setWidth(sWidth): sap.ui.commons.Image
Sets a new value for property width.

When the empty value is kept, the original size is not changed. It is also possible to make settings for width or height only, the overall size is maintained then, considering the aspect ratio.

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

Parameters:
{sap.ui.core.CSSSize}sWidth New value for property width
Returns:
{sap.ui.commons.Image} Reference to this in order to allow method chaining