class sap.ui.commons.ResponsiveContainer

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/commons/ResponsiveContainer
Application Component: CA-UI5-CTR

Is used to provide a container, which can show different content depending on its current width. It fires an event, whenever a new range is reached. In addition the content of the new range is automatically shown, if it is set.


Constructor

Constructor for a new ResponsiveContainer.

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.ResponsiveContainer(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


Properties

Name Type Default Value Description
height sap.ui.core.CSSSize 100%

The width of the responsive container.

Visibility: public
width sap.ui.core.CSSSize 100%

The width of the responsive container.

Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
content 0..1 sap.ui.core.Control

The currently shown content, either the default content or content of a range

ranges 0..n sap.ui.commons.ResponsiveContainerRange

The ranges defined for this container


Associations

Name Cardinality Type Description
defaultContent 0..1 sap.ui.core.Control

The default content to show, in case the range does not provide content


Events Overview

Event Description
rangeSwitch

The event is fired the width of the container reaches a new range.

rangeSwitch

The event is fired the width of the container reaches a new range.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
currentRange sap.ui.commons.ResponsiveContainerRange

The current range


Methods Overview

Method Description
addRange

Adds some range to the aggregation ranges.

attachRangeSwitch

Attaches event handler fnFunction to the rangeSwitch event of this sap.ui.commons.ResponsiveContainer.

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

The event is fired the width of the container reaches a new range.

destroyRanges

Destroys all the ranges in the aggregation ranges.

detachRangeSwitch

Detaches event handler fnFunction from the rangeSwitch event of this sap.ui.commons.ResponsiveContainer.

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

sap.ui.commons.ResponsiveContainer.extend

Creates a new subclass of class sap.ui.commons.ResponsiveContainer 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.

fireRangeSwitch

Fires event rangeSwitch to attached listeners.

getDefaultContent

ID of the element which is the current target of the association defaultContent, or null.

getHeight

Gets current value of property height.

The width of the responsive container.

Default value is '100%'.

sap.ui.commons.ResponsiveContainer.getMetadata

Returns a metadata object for class sap.ui.commons.ResponsiveContainer.

getRanges

Gets content of aggregation ranges.

The ranges defined for this container

getWidth

Gets current value of property width.

The width of the responsive container.

Default value is '100%'.

indexOfRange

Checks for the provided sap.ui.commons.ResponsiveContainerRange in the aggregation ranges. and returns its index if found or -1 otherwise.

insertRange

Inserts a range into the aggregation ranges.

removeAllRanges

Removes all the controls from the aggregation ranges.

Additionally, it unregisters them from the hosting UIArea.

removeRange

Removes a range from the aggregation ranges.

setDefaultContent

Sets the associated defaultContent.

setHeight

Sets a new value for property height.

The width of the responsive container.

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

Default value is '100%'.

setWidth

Sets a new value for property width.

The width of the responsive container.

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

Default value is '100%'.

addRange

Adds some range to the aggregation ranges.

Param Type DefaultValue Description
oRange sap.ui.commons.ResponsiveContainerRange

The range to add; if empty, nothing is inserted

attachRangeSwitch

Attaches event handler fnFunction to the rangeSwitch event of this sap.ui.commons.ResponsiveContainer.

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

The event is fired the width of the container reaches a new range.

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 sap.ui.commons.ResponsiveContainer itself

destroyRanges

Destroys all the ranges in the aggregation ranges.

detachRangeSwitch

Detaches event handler fnFunction from the rangeSwitch event of this sap.ui.commons.ResponsiveContainer.

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

sap.ui.commons.ResponsiveContainer.extend

Creates a new subclass of class sap.ui.commons.ResponsiveContainer 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

fireRangeSwitch

Fires event rangeSwitch to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

currentRange sap.ui.commons.ResponsiveContainerRange

The current range

getDefaultContent

ID of the element which is the current target of the association defaultContent, or null.

getHeight

Gets current value of property height.

The width of the responsive container.

Default value is '100%'.

sap.ui.commons.ResponsiveContainer.getMetadata

Returns a metadata object for class sap.ui.commons.ResponsiveContainer.

getRanges

Gets content of aggregation ranges.

The ranges defined for this container

getWidth

Gets current value of property width.

The width of the responsive container.

Default value is '100%'.

indexOfRange

Checks for the provided sap.ui.commons.ResponsiveContainerRange in the aggregation ranges. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oRange sap.ui.commons.ResponsiveContainerRange

The range whose index is looked for

insertRange

Inserts a range into the aggregation ranges.

Param Type DefaultValue Description
oRange sap.ui.commons.ResponsiveContainerRange

The range to insert; if empty, nothing is inserted

iIndex int

The 0-based index the range should be inserted at; for a negative value of iIndex, the range is inserted at position 0; for a value greater than the current size of the aggregation, the range is inserted at the last position

removeAllRanges

Removes all the controls from the aggregation ranges.

Additionally, it unregisters them from the hosting UIArea.

removeRange

Removes a range from the aggregation ranges.

Param Type DefaultValue Description
vRange int string sap.ui.commons.ResponsiveContainerRange

The range to remove or its index or id

setDefaultContent

Sets the associated defaultContent.

Param Type DefaultValue Description
oDefaultContent sap.ui.core.ID sap.ui.core.Control

ID of an element which becomes the new target of this defaultContent association; alternatively, an element instance may be given

setHeight

Sets a new value for property height.

The width of the responsive container.

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

Default value is '100%'.

Param Type DefaultValue Description
sHeight sap.ui.core.CSSSize '100%'

New value for property height

setWidth

Sets a new value for property width.

The width of the responsive container.

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

Default value is '100%'.

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize '100%'

New value for property width