Abstract Class sap.ui.core.tmpl.TemplateModule: sap/ui/core/tmpl/Template

known direct subclasses: HandlebarsTemplate

Base Class for Template.

Experimental API:Since 1.15.0. The Template concept is still under construction, so some implementation details can be changed in future.

Constructor Summary
new sap.ui.core.tmpl.Template(sId?, mSettings?)Creates and initializes a new template with the given sId and settings.
Method Summary
sap.ui.core.tmpl.Template.byId(sId)Returns the registered template for the given id, if any.
sap.ui.core.tmpl.Template.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.tmpl.Template with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.tmpl.Template.getMetadata()Returns a metadata object for class sap.ui.core.tmpl.Template.
sap.ui.core.tmpl.Template.parsePath(sPath)parses the given path and extracts the model and path
createControl(sId, oContext?, oView)Creates an anonymous TemplateControl for the Template.
declareControl(sControl)Declares a new control based on this template and returns the created class / constructor function.
getContent()Gets current value of property content.
placeAt(oRef, oContext?, vPosition?, bInline)Creates an anonymous TemplateControl for the Template and places the control into the specified DOM element.
setContent(sContent)Sets a new value for property content.
Constructor Detail
new sap.ui.core.tmpl.Template(sId?, mSettings?)
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 for a general description of the syntax of the settings object.

The supported settings are:

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

Parameters:
{string}sId? 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!
{object}mSettings? optional map/JSON-object with initial settings for the new component instance
Method Detail
sap.ui.core.tmpl.Template.byId(sId): sap.ui.core.tmpl.Template
Returns the registered template for the given id, if any.
Parameters:
{string}sId
Returns:
{sap.ui.core.tmpl.Template} the template for the given id
sap.ui.core.tmpl.Template.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.

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.tmpl.Template.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.tmpl.Template.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
sap.ui.core.tmpl.Template.parsePath(sPath): object
parses the given path and extracts the model and path
Parameters:
{string}sPath the path
Returns:
{object} the model and the path
createControl(sId, oContext?, oView): sap.ui.core.tmpl.TemplateControl
Creates an anonymous TemplateControl for the Template.
Parameters:
{string}sId the control ID
{object}oContext? the context for the renderer/templating
{sap.ui.core.mvc.View}oView
Returns:
{sap.ui.core.tmpl.TemplateControl} the created control instance
declareControl(sControl): function
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.
Parameters:
{string}sControl the fully qualified name of the control
Returns:
{function} the created class / constructor function
getContent(): string
Gets current value of property content.

The Template definition as a String.

Returns:
{string} Value of property content
placeAt(oRef, oContext?, vPosition?, bInline): sap.ui.core.tmpl.TemplateControl
Creates an anonymous TemplateControl for the Template and places the control into the specified DOM element.
Parameters:
{string|DomRef}oRef the id or the DOM reference where to render the template
{object}oContext? The context to use to evaluate the Template. It will be applied as value for the context property of the created control.
{string|int}vPosition? Describes the position where the control should be put into the container
{boolean}bInline
Returns:
{sap.ui.core.tmpl.TemplateControl} the created control instance
setContent(sContent): sap.ui.core.tmpl.Template
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.

Parameters:
{string}sContent New value for property content
Returns:
{sap.ui.core.tmpl.Template} Reference to this in order to allow method chaining