Container that embeds a sap/ui/core/UIComponent
in a control tree.
Concerning asynchronous component loading:
To activate a fully asynchronous loading behavior of components and their dependencies, the property async
needs to be set to true
and the manifest
property needs to be set to a 'truthy' value, e.g. true
or a URL to the manifest location. If both options are correctly set, the component factory will load and evaluate the component manifest first. In this way, the additional dependencies of the Component are already known before the Component preload/controller is loaded. Both the component preload/controller and the additional dependencies can thus be loaded asynchronously and in parallel.
Sample usage of the ComponentContainer:
<!-- inside XML view --> ... <core:ComponentContainer usage="someComponent" manifest="true" async="true" />
See also module:sap/ui/core/ComponentSupport.
Constructor for a new ComponentContainer.
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.core.ComponentContainer(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 |
---|---|---|---|
async | boolean | false | Flag whether the component should be created sync (default) or async. The default will be async when initially the property |
autoPrefixId | boolean | false | Flag, whether to auto-prefix the ID of the nested Component or not. If this property is set to true the ID of the Component will be prefixed with the ID of the ComponentContainer followed by a single dash. This property can only be applied initially. Visibility: public |
handleValidation | boolean | false | Enable/disable validation handling by MessageManager for this component. The resulting Messages will be propagated to the controls. This property can only be applied initially. Visibility: public |
height | sap.ui.core.CSSSize | Container height in CSS size Visibility: public |
|
lifecycle | sap.ui.core.ComponentLifecycle | Legacy | Lifecycle behavior for the Component associated by the |
manifest | any | Controls when and from where to load the manifest for the Component. When set to any truthy value, the manifest will be loaded asynchronously by default and evaluated before the Component controller, if it is set to a falsy value other than |
|
name | string | Component name, the package where the component is contained. This property can only be applied initially. Visibility: public |
|
propagateModel | boolean | false | Defines whether binding information is propagated to the component. Visibility: public |
settings | object | The settings object passed to the component when created. This property can only be applied initially. Visibility: public |
|
url | sap.ui.core.URI | The URL of the component. This property can only be applied initially. Visibility: public |
|
usage | string | The name of a component usage as configured in the app descriptor of the component owning this The configuration from the named usage will be used to create a component instance for this See Using and Nesting Components for more information about component usages. This property can only be applied initially. Visibility: public |
|
width | sap.ui.core.CSSSize | Container width in CSS size Visibility: public |
Name | Type | Default Value | Description |
---|---|---|---|
blocked | boolean | false | Whether the control is currently in blocked state. Visibility: public |
busy | boolean | false | Whether the control is currently in busy state. Visibility: public |
busyIndicatorDelay | int | 1000 | The delay in milliseconds, after which the busy indicator will show up for this control. Visibility: public |
busyIndicatorSize | sap.ui.core.BusyIndicatorSize | Medium | The size of the BusyIndicator. For controls with a width smaller 3rem a |
fieldGroupIds | string[] | The IDs of a logical field group that this control belongs to. All fields in a logical field group should share the same For backward compatibility with older releases, field group IDs are syntactically not limited, but it is suggested to use only valid sap.ui.core.IDs. See #attachValidateFieldGroup or consult the Field Group documentation. |
|
visible | boolean | true | Whether the control should be visible on the screen. If set to false, a placeholder will be rendered to mark the location of the invisible control in the DOM of the current page. The placeholder will be hidden and have zero dimensions ( Also see InvisibleRenderer. Visibility: public |
Name | Cardinality | Type | Description |
---|---|---|---|
customData | 0..n | sap.ui.core.CustomData |
Custom Data, a data structure like a map containing arbitrary key value pairs. |
dependents | 0..n | sap.ui.core.Element |
Dependents are not rendered, but their databinding context and lifecycle are bound to the aggregating Element. |
dragDropConfig | 0..n | sap.ui.core.dnd.DragDropBase |
Defines the drag-and-drop configuration. Note: This configuration might be ignored due to control metadata restrictions. |
layoutData | 0..1 | sap.ui.core.LayoutData |
Defines the layout constraints for this control when it is used inside a Layout. LayoutData classes are typed classes and must match the embedding Layout. See VariantLayoutData for aggregating multiple alternative LayoutData instances to a single Element. |
tooltip | 0..1 | sap.ui.core.TooltipBase |
The tooltip that should be shown for this Element. In the most simple case, a tooltip is a string that will be rendered by the control and displayed by the browser when the mouse pointer hovers over the control's DOM. In this variant, Controls need to explicitly support this kind of tooltip as they have to render it, but most controls do. Exceptions will be documented for the corresponding controls (e.g. Alternatively, UI5 currently does not provide a recommended implementation of See the section Using Tooltips
|
Name | Cardinality | Type | Description |
---|---|---|---|
component | 0..1 | sap.ui.core.UIComponent |
The component displayed in this ComponentContainer. |
Event | Description |
---|---|
componentCreated |
Fired when the component instance has been created by the ComponentContainer. |
componentFailed |
Fired when the creation of the component instance has failed. By default, the Listeners may prevent the default action of this event by calling the |
Fired when the component instance has been created by the ComponentContainer.
Since: 1.50.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
component | sap.ui.core.UIComponent |
Reference to the created component instance |
Fired when the creation of the component instance has failed.
By default, the ComponentContainer
also logs the error that occurred. Since 1.83, this default behavior can be prevented by calling preventDefault()
on the event object.
Listeners may prevent the default action of this event by calling the preventDefault
method on the event object.
Since: 1.60.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
reason | object |
The reason object as returned by the component promise |
Method | Description |
---|---|
attachComponentCreated |
Attaches event handler When called, the context of the event handler (its Fired when the component instance has been created by the ComponentContainer. |
attachComponentFailed |
Attaches event handler When called, the context of the event handler (its Fired when the creation of the component instance has failed. By default, the |
detachComponentCreated |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachComponentFailed |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.core.ComponentContainer.extend |
Creates a new subclass of class sap.ui.core.ComponentContainer with name
|
fireComponentCreated |
Fires event componentCreated to attached listeners. |
fireComponentFailed |
Fires event componentFailed to attached listeners. Listeners may prevent the default action of this event by calling the |
getAsync |
Gets current value of property async. Flag whether the component should be created sync (default) or async. The default will be async when initially the property Default value is |
getAutoPrefixId |
Gets current value of property autoPrefixId. Flag, whether to auto-prefix the ID of the nested Component or not. If this property is set to true the ID of the Component will be prefixed with the ID of the ComponentContainer followed by a single dash. This property can only be applied initially. Default value is |
getComponent |
ID of the element which is the current target of the association component, or |
getHandleValidation |
Gets current value of property handleValidation. Enable/disable validation handling by MessageManager for this component. The resulting Messages will be propagated to the controls. This property can only be applied initially. Default value is |
getHeight |
Gets current value of property height. Container height in CSS size |
getLifecycle |
Gets current value of property lifecycle. Lifecycle behavior for the Component associated by the Default value is |
getManifest |
Gets current value of property manifest. Controls when and from where to load the manifest for the Component. When set to any truthy value, the manifest will be loaded asynchronously by default and evaluated before the Component controller, if it is set to a falsy value other than |
sap.ui.core.ComponentContainer.getMetadata |
Returns a metadata object for class sap.ui.core.ComponentContainer. |
getName |
Gets current value of property name. Component name, the package where the component is contained. This property can only be applied initially. |
getPropagateModel |
Gets current value of property propagateModel. Defines whether binding information is propagated to the component. Default value is |
getSettings |
Gets current value of property settings. The settings object passed to the component when created. This property can only be applied initially. |
getUrl |
Gets current value of property url. The URL of the component. This property can only be applied initially. |
getUsage |
Gets current value of property usage. The name of a component usage as configured in the app descriptor of the component owning this The configuration from the named usage will be used to create a component instance for this See Using and Nesting Components for more information about component usages. This property can only be applied initially. |
getWidth |
Gets current value of property width. Container width in CSS size |
hidePlaceholder |
Hides the placeholder that is shown on the component container. |
setAsync |
Sets a new value for property async. Flag whether the component should be created sync (default) or async. The default will be async when initially the property When called with a value of Default value is |
setAutoPrefixId |
Sets a new value for property autoPrefixId. Flag, whether to auto-prefix the ID of the nested Component or not. If this property is set to true the ID of the Component will be prefixed with the ID of the ComponentContainer followed by a single dash. This property can only be applied initially. When called with a value of Default value is |
setComponent |
Sets the component of the container. Depending on the ComponentContainer's lifecycle this might destroy the old associated Component. Once the component is associated with the container the cross connection to the component will be set and the models will be propagated if defined. If the |
setHandleValidation |
Sets a new value for property handleValidation. Enable/disable validation handling by MessageManager for this component. The resulting Messages will be propagated to the controls. This property can only be applied initially. When called with a value of Default value is |
setHeight |
Sets a new value for property height. Container height in CSS size When called with a value of |
setLifecycle |
Sets a new value for property lifecycle. Lifecycle behavior for the Component associated by the When called with a value of Default value is |
setManifest |
Sets a new value for property manifest. Controls when and from where to load the manifest for the Component. When set to any truthy value, the manifest will be loaded asynchronously by default and evaluated before the Component controller, if it is set to a falsy value other than When called with a value of |
setName |
Sets a new value for property name. Component name, the package where the component is contained. This property can only be applied initially. When called with a value of |
setPropagateModel |
Sets a new value for property propagateModel. Defines whether binding information is propagated to the component. When called with a value of Default value is |
setSettings |
Sets a new value for property settings. The settings object passed to the component when created. This property can only be applied initially. When called with a value of |
setUrl |
Sets a new value for property url. The URL of the component. This property can only be applied initially. When called with a value of |
setUsage |
Sets a new value for property usage. The name of a component usage as configured in the app descriptor of the component owning this The configuration from the named usage will be used to create a component instance for this See Using and Nesting Components for more information about component usages. This property can only be applied initially. When called with a value of |
setWidth |
Sets a new value for property width. Container width in CSS size When called with a value of |
showPlaceholder |
Shows the provided placeholder on the component container. |
Attaches event handler fnFunction
to the componentCreated event of this sap.ui.core.ComponentContainer
.
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.core.ComponentContainer
itself.
Fired when the component instance has been created by the ComponentContainer.
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 |
Attaches event handler fnFunction
to the componentFailed event of this sap.ui.core.ComponentContainer
.
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.core.ComponentContainer
itself.
Fired when the creation of the component instance has failed.
By default, the ComponentContainer
also logs the error that occurred. Since 1.83, this default behavior can be prevented by calling preventDefault()
on the event object.
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 componentCreated event of this sap.ui.core.ComponentContainer
.
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 |
Detaches event handler fnFunction
from the componentFailed event of this sap.ui.core.ComponentContainer
.
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.core.ComponentContainer 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 componentCreated to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
component | sap.ui.core.UIComponent |
Reference to the created component instance |
Fires event componentFailed to attached listeners.
Listeners may prevent the default action of this event by calling the preventDefault
method on the event object. The return value of this method indicates whether the default action should be executed.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
reason | object |
The reason object as returned by the component promise |
Gets current value of property async.
Flag whether the component should be created sync (default) or async. The default will be async when initially the property manifest
is set to a truthy value and for the property async
no value has been specified. This property can only be applied initially.
Default value is false
.
Gets current value of property autoPrefixId.
Flag, whether to auto-prefix the ID of the nested Component or not. If this property is set to true the ID of the Component will be prefixed with the ID of the ComponentContainer followed by a single dash. This property can only be applied initially.
Default value is false
.
Gets current value of property handleValidation.
Enable/disable validation handling by MessageManager for this component. The resulting Messages will be propagated to the controls. This property can only be applied initially.
Default value is false
.
Gets current value of property lifecycle.
Lifecycle behavior for the Component associated by the ComponentContainer
. The default behavior is Legacy
. This means that the ComponentContainer
takes care that the Component is destroyed when the ComponentContainer
is destroyed, but it is not destroyed when a new Component is associated. If you use the usage
property to create the Component, the default behavior is Container
. This means that the Component is destroyed when the ComponentContainer
is destroyed or a new Component is associated. This property must only be applied before a component instance is created.
Default value is Legacy
.
Gets current value of property manifest.
Controls when and from where to load the manifest for the Component. When set to any truthy value, the manifest will be loaded asynchronously by default and evaluated before the Component controller, if it is set to a falsy value other than undefined
, the manifest will be loaded after the controller. A non-empty string value will be interpreted as the URL location from where to load the manifest. A non-null object value will be interpreted as manifest content. This property can only be applied initially.
Returns a metadata object for class sap.ui.core.ComponentContainer.
Gets current value of property name.
Component name, the package where the component is contained. This property can only be applied initially.
Gets current value of property propagateModel.
Defines whether binding information is propagated to the component.
Default value is false
.
Gets current value of property settings.
The settings object passed to the component when created. This property can only be applied initially.
Gets current value of property url.
The URL of the component. This property can only be applied initially.
Gets current value of property usage.
The name of a component usage as configured in the app descriptor of the component owning this ComponentContainer
.
The configuration from the named usage will be used to create a component instance for this ComponentContainer
. If there's no owning component or if its app descriptor does not contain a usage with the given name, an error will be logged.
See Using and Nesting Components for more information about component usages.
This property can only be applied initially.
Sets a new value for property async.
Flag whether the component should be created sync (default) or async. The default will be async when initially the property manifest
is set to a truthy value and for the property async
no value has been specified. This property can only be applied initially.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bAsync | boolean | false |
New value for property |
Sets a new value for property autoPrefixId.
Flag, whether to auto-prefix the ID of the nested Component or not. If this property is set to true the ID of the Component will be prefixed with the ID of the ComponentContainer followed by a single dash. This property can only be applied initially.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bAutoPrefixId | boolean | false |
New value for property |
Sets the component of the container. Depending on the ComponentContainer's lifecycle this might destroy the old associated Component.
Once the component is associated with the container the cross connection to the component will be set and the models will be propagated if defined. If the usage
property is set the ComponentLifecycle is processed like a "Container" lifecycle.
Param | Type | DefaultValue | Description |
---|---|---|---|
vComponent | string sap.ui.core.UIComponent |
ID of an element which becomes the new target of this component association. Alternatively, an element instance may be given. |
Sets a new value for property handleValidation.
Enable/disable validation handling by MessageManager for this component. The resulting Messages will be propagated to the controls. This property can only be applied initially.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bHandleValidation | boolean | false |
New value for property |
Sets a new value for property height.
Container height in CSS size
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 lifecycle.
Lifecycle behavior for the Component associated by the ComponentContainer
. The default behavior is Legacy
. This means that the ComponentContainer
takes care that the Component is destroyed when the ComponentContainer
is destroyed, but it is not destroyed when a new Component is associated. If you use the usage
property to create the Component, the default behavior is Container
. This means that the Component is destroyed when the ComponentContainer
is destroyed or a new Component is associated. This property must only be applied before a component instance is created.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Legacy
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sLifecycle | sap.ui.core.ComponentLifecycle | Legacy |
New value for property |
Sets a new value for property manifest.
Controls when and from where to load the manifest for the Component. When set to any truthy value, the manifest will be loaded asynchronously by default and evaluated before the Component controller, if it is set to a falsy value other than undefined
, the manifest will be loaded after the controller. A non-empty string value will be interpreted as the URL location from where to load the manifest. A non-null object value will be interpreted as manifest content. This property can only be applied initially.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
oManifest | any |
New value for property |
Sets a new value for property name.
Component name, the package where the component is contained. This property can only be applied initially.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sName | string |
New value for property |
Sets a new value for property propagateModel.
Defines whether binding information is propagated to the component.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bPropagateModel | boolean | false |
New value for property |
Sets a new value for property settings.
The settings object passed to the component when created. This property can only be applied initially.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
oSettings | object |
New value for property |
Sets a new value for property url.
The URL of the component. This property can only be applied initially.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sUrl | sap.ui.core.URI |
New value for property |
Sets a new value for property usage.
The name of a component usage as configured in the app descriptor of the component owning this ComponentContainer
.
The configuration from the named usage will be used to create a component instance for this ComponentContainer
. If there's no owning component or if its app descriptor does not contain a usage with the given name, an error will be logged.
See Using and Nesting Components for more information about component usages.
This property can only be applied initially.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sUsage | string |
New value for property |
Sets a new value for property width.
Container width in CSS size
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 |
Shows the provided placeholder on the component container.
Param | Type | DefaultValue | Description |
---|---|---|---|
mSettings | object |
Object containing the placeholder object |
|
placeholder | sap.ui.core.Placeholder |
The placeholder instance |