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.
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#constructor for a general description of the syntax of the settings object.
new sap.ui.commons.Image(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 |
---|---|---|---|
alt | string | 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. Visibility: public |
|
decorative | boolean | true | 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. Visibility: public |
height | sap.ui.core.CSSSize | 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. Visibility: public |
|
src | sap.ui.core.URI | Relative or absolute path to URL where the image file is stored. Visibility: public |
|
useMap | string | The name of the image map that defines the clickable areas Visibility: public |
|
width | sap.ui.core.CSSSize | 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. Visibility: public |
Method | Description |
---|---|
attachPress |
Attaches event handler When called, the context of the event handler (its Event is fired when the user clicks on the control. |
detachPress |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.commons.Image.extend |
Creates a new subclass of class sap.ui.commons.Image with name
|
firePress |
Fires event press to attached listeners. |
getAlt |
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. |
getDecorative |
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 |
getHeight |
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. |
sap.ui.commons.Image.getMetadata |
Returns a metadata object for class sap.ui.commons.Image. |
getSrc |
Gets current value of property src. Relative or absolute path to URL where the image file is stored. |
getUseMap |
Gets current value of property useMap. The name of the image map that defines the clickable areas |
getWidth |
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. |
setAlt |
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 |
setDecorative |
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 Default value is |
setHeight |
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 |
setSrc |
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 |
setUseMap |
Sets a new value for property useMap. The name of the image map that defines the clickable areas When called with a value of |
setWidth |
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 |
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.
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 |
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.
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.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.
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 press to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
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.
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
.
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.
Gets current value of property src.
Relative or absolute path to URL where the image file is stored.
Gets current value of property useMap.
The name of the image map that defines the clickable areas
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.
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sAlt | string |
New value for property |
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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bDecorative | boolean | true |
New value for property |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sHeight | sap.ui.core.CSSSize |
New value for property |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sSrc | sap.ui.core.URI |
New value for property |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sUseMap | string |
New value for property |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sWidth | sap.ui.core.CSSSize |
New value for property |