Abstract Class sap.ui.core.UIComponentModule: sap/ui/core/UIComponent

extends Component

Creates and initializes a new UIComponent with the given sId and settings.

The set of allowed entries in the mSettings object depends on the concrete subclass and is described there. See sap.ui.core.Component for a general description of this argument.


Since: 1.9.2.
Constructor Summary
new sap.ui.core.UIComponent(sId?, mSettings?)Base Class for UIComponent.
Method Summary
sap.ui.core.UIComponent.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.UIComponent with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.UIComponent.getMetadata()Returns a metadata object for class sap.ui.core.UIComponent.
sap.ui.core.UIComponent.getRouterFor(oControllerOrView)Returns the reference to the router instance.
byId(sId)Returns an element by its ID in the context of the component.
createContent()The method to create the content (UI Control Tree) of the Component.
createId(sId)Convert the given component local element ID to a globally unique ID by prefixing it with the component ID.
getAutoPrefixId()A method to be implemented by UIComponents, returning the flag whether to prefix the IDs of controls automatically or not if the controls are created inside the sap.ui.core.UIComponent#createContent function.
getRouter()Returns the reference to the router instance which has been created by the UIComponent once the routes in the routing metadata has been defined.
getTargets()Returns the reference to the Targets instance which has been created by the UIComponent once the targets in the routing metadata has been defined.
getUIArea()Returns the reference to the UIArea of the container.
init()Initializes the Component instance after creation.
onAfterRendering()Function is called when the rendering of the ComponentContainer is completed.
onBeforeRendering()Function is called when the rendering of the ComponentContainer is started.
render(oRenderManager)Renders the the root control of the UIComponent.
setContainer(oContainer)Sets the reference to the ComponentContainer - later required for the determination of the UIArea for the UIComponent.
Constructor Detail
new sap.ui.core.UIComponent(sId?, mSettings?)
Base Class for UIComponent.

If you are extending an UIComponent make sure you read the .extend documentation since the metadata is special.

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:

  • Aggregations

    In addition, all settings applicable to the base type sap.ui.core.Component can be used as well.

    Parameters:
    {string}sId? Optional ID for the new control; generated automatically if no non-empty ID is given Note: this can be omitted, no matter whether mSettings will be given or not!
    {object}mSettings? optional map/JSON-object with initial settings for the new component instance
    Method Detail
    sap.ui.core.UIComponent.extend(sClassName, oClassInfo?, FNMetaImpl?): function
    Creates a new subclass of class sap.ui.core.UIComponent 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.Component.extend.

    Parameters:
    {string}sClassName Name of the class being created
    {object}oClassInfo? Object literal with information about the class
    {function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
    Returns:
    {function} Created class / constructor function
    sap.ui.core.UIComponent.getMetadata(): sap.ui.base.Metadata
    Returns a metadata object for class sap.ui.core.UIComponent.
    Returns:
    {sap.ui.base.Metadata} Metadata object describing this class
    sap.ui.core.UIComponent.getRouterFor(oControllerOrView): sap.ui.core.routing.Router
    Returns the reference to the router instance. The passed controller or view has to be created in the context of a UIComponent to return the router instance. Otherwise this function will return undefined. You may define the routerClass property in the config section of the routing to make the Component create your router extension. Example: routing: { config: { routerClass : myAppNamespace.MyRouterClass ... } ...
    Parameters:
    {sap.ui.core.mvc.View|sap.ui.core.mvc.Controller}oControllerOrView either a view or controller
    Since:
    1.16.1
    Returns:
    {sap.ui.core.routing.Router} the router instance
    Returns an element by its ID in the context of the component.
    Parameters:
    {string}sId Component local ID of the element
    Returns:
    {sap.ui.core.Element} element by its ID or undefined
    createContent()
    The method to create the content (UI Control Tree) of the Component. This method has to be overwritten in the implementation of the component if the root view is not declared in the component metadata.
    createId(sId): string
    Convert the given component local element ID to a globally unique ID by prefixing it with the component ID.
    Parameters:
    {string}sId Component local ID of the element
    Returns:
    {string} prefixed id
    getAutoPrefixId(): boolean
    A method to be implemented by UIComponents, returning the flag whether to prefix the IDs of controls automatically or not if the controls are created inside the sap.ui.core.UIComponent#createContent function. By default this feature is not activated.

    You can overwrite this function and return true to activate the automatic prefixing. In addition the default behavior can be configured in the manifest by specifying the entry sap.ui5/autoPrefixId.

    Since:
    1.15.1
    Returns:
    {boolean} true, if the Controls IDs should be prefixed automatically
    Returns the reference to the router instance which has been created by the UIComponent once the routes in the routing metadata has been defined.
    Since:
    1.16.1
    Returns:
    {sap.ui.core.routing.Router} the router instance
    Returns the reference to the Targets instance which has been created by the UIComponent once the targets in the routing metadata has been defined. If routes have been defined, it will be the Targets instance created and used by the router.
    Since:
    1.28
    Returns:
    {sap.ui.core.routing.Targets} the targets instance
    getUIArea(): sap.ui.core.UIArea
    Returns the reference to the UIArea of the container.
    Returns:
    {sap.ui.core.UIArea} reference to the UIArea of the container
    init()
    Initializes the Component instance after creation.

    Applications must not call this hook method directly, it is called by the framework while the constructor of a Component is executed.

    Subclasses of Component should override this hook to implement any necessary initialization. When overriding this function make sure to invoke the init function of the UIComponent as well!

    onAfterRendering()
    Function is called when the rendering of the ComponentContainer is completed.

    Applications must not call this hook method directly, it is called from ComponentContainer.

    Subclasses of UIComponent override this hook to implement any necessary actions after the rendering.

    onBeforeRendering()
    Function is called when the rendering of the ComponentContainer is started.

    Applications must not call this hook method directly, it is called from ComponentContainer.

    Subclasses of UIComponent override this hook to implement any necessary actions before the rendering.

    render(oRenderManager)
    Renders the the root control of the UIComponent.
    Parameters:
    {sap.ui.core.RenderManager}oRenderManager a RenderManager instance
    setContainer(oContainer): sap.ui.core.UIComponent
    Sets the reference to the ComponentContainer - later required for the determination of the UIArea for the UIComponent.
    Parameters:
    {sap.ui.core.ComponentContainer}oContainer reference to a ComponentContainer
    Returns:
    {sap.ui.core.UIComponent} reference to this instance to allow method chaining