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 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 |
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 |
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 |
Name | Cardinality | Type | Description |
---|---|---|---|
defaultContent | 0..1 | sap.ui.core.Control |
The default content to show, in case the range does not provide content |
Event | Description |
---|---|
rangeSwitch |
The event is fired the width of the container reaches a new range. |
Method | Description |
---|---|
addRange |
Adds some range to the aggregation ranges. |
attachRangeSwitch |
Attaches event handler When called, the context of the event handler (its 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 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
|
fireRangeSwitch |
Fires event rangeSwitch to attached listeners. |
getDefaultContent |
ID of the element which is the current target of the association defaultContent, or |
getHeight |
Gets current value of property height. The width of the responsive container. Default value is |
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 |
indexOfRange |
Checks for the provided |
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 Default value is |
setWidth |
Sets a new value for property width. The width of the responsive container. When called with a value of Default value is |
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 |
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 |
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 |
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 |
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 |
ID of the element which is the current target of the association defaultContent, or null
.
Gets current value of property height.
The width of the responsive container.
Default value is '100%'
.
Returns a metadata object for class sap.ui.commons.ResponsiveContainer.
Gets current value of property width.
The width of the responsive container.
Default value is '100%'
.
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 |
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 |
Removes all the controls from the aggregation ranges.
Additionally, it unregisters them from the hosting UIArea.
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 |
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 |
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 |
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 |