abstract class sap.ui.core.tmpl.Template

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

Base Class for Template.


Constructor

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

The set of allowed entries in the mSettings object depends on the concrete subclass and is described there.

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

optional id for the new template; 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

optional map/JSON-object with initial settings for the new component instance


Properties

Name Type Default Value Description
content string

The Template definition as a String.

Visibility: public

Methods Overview

Method Description
sap.ui.core.tmpl.Template.byId

Returns the registered template for the given ID, if any.

createControl

Creates an anonymous TemplateControl for the Template.

declareControl

Declares a new control based on this template and returns the created class / constructor function. The class is based on the information coming from the abstract functions createMetadata and createRenderer.

sap.ui.core.tmpl.Template.extend

Creates a new subclass of class sap.ui.core.tmpl.Template 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.base.ManagedObject.extend.

getContent

Gets current value of property content.

The Template definition as a String.

getInterface

Templates don't have a facade and therefore return themselves as their interface.

References:

  • sap.ui.base.Object#getInterface

sap.ui.core.tmpl.Template.getMetadata

Returns a metadata object for class sap.ui.core.tmpl.Template.

placeAt

Creates an anonymous TemplateControl for the Template and places the control into the specified DOM element.

setContent

Sets a new value for property content.

The Template definition as a String.

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

sap.ui.core.tmpl.Template.byId

Returns the registered template for the given ID, if any.

Param Type DefaultValue Description
sId string

createControl

Creates an anonymous TemplateControl for the Template.

Param Type DefaultValue Description
sId string

the control ID

oContext object

the context for the renderer/templating

oView sap.ui.core.mvc.View

declareControl

Declares a new control based on this template and returns the created class / constructor function. The class is based on the information coming from the abstract functions createMetadata and createRenderer.

Param Type DefaultValue Description
sControl string

the fully qualified name of the control

sap.ui.core.tmpl.Template.extend

Creates a new subclass of class sap.ui.core.tmpl.Template 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.base.ManagedObject.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

getContent

Gets current value of property content.

The Template definition as a String.

getInterface

Templates don't have a facade and therefore return themselves as their interface.

References:

sap.ui.core.tmpl.Template.getMetadata

Returns a metadata object for class sap.ui.core.tmpl.Template.

placeAt

Creates an anonymous TemplateControl for the Template and places the control into the specified DOM element.

Param Type DefaultValue Description
oRef string Element sap.ui.core.Control

the id or the DOM reference where to render the template

oContext object

The context to use to evaluate the Template. It will be applied as value for the context property of the created control.

vPosition string int

Describes the position where the control should be put into the container

bInline boolean

setContent

Sets a new value for property content.

The Template definition as a String.

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

Param Type DefaultValue Description
sContent string

New value for property content