@sap/generator-fiori
Version:
Create an SAPUI5 application using SAP Fiori elements or a freestyle approach
69 lines (64 loc) • 1.52 kB
JavaScript
/*!
* ${copyright}
*/
// Provides control <%= libraryNamespace %>.Example.
sap.ui.define([
"./library",
"sap/ui/core/Control",
"./ExampleRenderer"
], function (library, Control, ExampleRenderer) {
"use strict";
// refer to library types
var ExampleColor = library.ExampleColor;
/**
* Constructor for a new <code><%= libraryNamespace %>.Example</code> control.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* Some class description goes here.
* @extends sap.ui.core.Control
*
* @author <%= author %>
* @version ${version}
*
* @constructor
* @public
* @alias <%= libraryNamespace %>.Example
*/
var Example = Control.extend("<%= libraryNamespace %>.Example", /** @lends <%= libraryNamespace %>.Example.prototype */ {
metadata: {
library: "<%= libraryNamespace %>",
properties: {
/**
* The text to display.
*/
text: {
type: "string",
group: "Data",
defaultValue: null
},
/**
* The color to use (default to "Default" color).
*/
color: {
type: "<%= libraryNamespace %>.ExampleColor",
group: "Appearance",
defaultValue: ExampleColor.Default
}
},
events: {
/**
* Event is fired when the user clicks the control.
*/
press: {}
}
},
renderer: ExampleRenderer,
onclick: function() {
this.firePress();
}
});
return Example;
});