abstract class sap.ui.app.Application

Control sample: sap.ui.app.Application
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/app/Application
Application Component: CA-UI5-COR

Abstract application class. Extend this class to create a central application class.


Constructor

Creates an application instance, only one instance is allowed (singleton).

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.app.Application(sId?, mSettings?)
Param Type Default Value Description
sId? string

Optional ID for the application; generated automatically if no non-empty ID is given. Note: this can be omitted, no matter whether mSettings will be given or not

mSettings? object

Initial settings for the new application instance


Properties

Name Type Default Value Description
config any Visibility: public
root string Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
rootComponent 0..1 sap.ui.core.UIComponent

Methods Overview

Method Description
createRootComponent

Creates and returns the root component. Override this method in your application implementation, if you want to override the default creation by metadata.

destroy

References:

  • sap.ui.core.Component#destroy

destroyRootComponent

Destroys the rootComponent in the aggregation rootComponent.

sap.ui.app.Application.extend

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

getConfig

Gets current value of property config.

sap.ui.app.Application.getMetadata

Returns a metadata object for class sap.ui.app.Application.

getRoot

Gets current value of property root.

getRootComponent

Gets content of aggregation rootComponent.

getView

Returns the application root component.

main

The main method is called when the DOM and UI5 is completely loaded. Override this method in your Application class implementation to execute code which relies on a loaded DOM / UI5.

onBeforeExit

On before exit application hook. Override this method in your Application class implementation, to handle cleanup before the real exit or to prompt a question to the user, if the application should be exited.

onError

On error hook. Override this method in your Application class implementation to listen to unhandled errors.

onExit

On exit application hook. Override this method in your Application class implementation, to handle cleanup of the application.

setConfig

Sets the configuration model.

setRoot

Sets a new value for property root.

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

setRootComponent

Sets the aggregated rootComponent.

createRootComponent

Creates and returns the root component. Override this method in your application implementation, if you want to override the default creation by metadata.

destroy

References:

destroyRootComponent

Destroys the rootComponent in the aggregation rootComponent.

sap.ui.app.Application.extend

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

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

getConfig

Gets current value of property config.

sap.ui.app.Application.getMetadata

Returns a metadata object for class sap.ui.app.Application.

getRoot

Gets current value of property root.

getRootComponent

Gets content of aggregation rootComponent.

getView

Returns the application root component.

main

The main method is called when the DOM and UI5 is completely loaded. Override this method in your Application class implementation to execute code which relies on a loaded DOM / UI5.

onBeforeExit

On before exit application hook. Override this method in your Application class implementation, to handle cleanup before the real exit or to prompt a question to the user, if the application should be exited.

onError

On error hook. Override this method in your Application class implementation to listen to unhandled errors.

Param Type DefaultValue Description
sMessage string

The error message.

sFile string

The file where the error occurred

iLine number

The line number of the error

onExit

On exit application hook. Override this method in your Application class implementation, to handle cleanup of the application.

setConfig

Sets the configuration model.

Param Type DefaultValue Description
vConfig string object sap.ui.model.Model

the configuration model, the configuration object or a URI string to load a JSON configuration file.

setRoot

Sets a new value for property root.

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

Param Type DefaultValue Description
sRoot string

New value for property root

setRootComponent

Sets the aggregated rootComponent.

Param Type DefaultValue Description
oRootComponent sap.ui.core.UIComponent

The rootComponent to set