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(mParameters?)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:
stringsId?id for the new control, generated automatically if no id is given
objectmSettings?initial settings for the new control
Event Detail
press(oControlEvent)
Event is fired when the user clicks on the control.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.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:
stringsClassNameName of the class being created
objectoClassInfo?Object literal with information about the class
functionFNMetaImpl?Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
functionCreated 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.MetadataMetadata 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:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.ui.commons.Image itself
Returns:
sap.ui.commons.ImageReference 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:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.ui.commons.ImageReference to this in order to allow method chaining
firePress(mParameters?): sap.ui.commons.Image
Fires event press to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
Returns:
sap.ui.commons.ImageReference 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:
stringValue 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:
booleanValue 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.CSSSizeValue 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.URIValue of property src
getUseMap(): string

Gets current value of property useMap.

The name of the image map that defines the clickable areas

Returns:
stringValue 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.CSSSizeValue 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:
stringsAltNew value for property alt
Returns:
sap.ui.commons.ImageReference 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:
booleanbDecorativeNew value for property decorative
Returns:
sap.ui.commons.ImageReference 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.CSSSizesHeightNew value for property height
Returns:
sap.ui.commons.ImageReference 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.URIsSrcNew value for property src
Returns:
sap.ui.commons.ImageReference 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:
stringsUseMapNew value for property useMap
Returns:
sap.ui.commons.ImageReference 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.CSSSizesWidthNew value for property width
Returns:
sap.ui.commons.ImageReference to this in order to allow method chaining