<mvc:View controllerName="bourneMyChildApp.controller.View1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
displayBlock="true" xmlns="sap.m">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<Text text="World" />
</content>
</Page>
</pages>
</App>
</mvc:View>
<mvc:View controllerName="bourneMyParentApp.controller.View1" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
displayBlock="true" xmlns="sap.m">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<Text text="Hello"/>
<core:ComponentContainer width="100%"
name="bourneMyChildApp"
component="bourneMyChildApp" />
</content>
</Page>
</pages>
</App>
</mvc:View>
jQuery.sap.registerModulePath("bourneMyChildApp", "../../mychildapp/");
jQuery.sap.require("bourneMyChildApp.Component");
{
"path": "/mychildapp/",
"target": {
"type": "application",
"name": "mychildapp"
},
"description": "My Child App"
}
<mvc:View controllerName="bourneMyParentApp.controller.View1" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
displayBlock="true" xmlns="sap.m">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<VBox>
<Text id="myNumber" text="{ path: '/MyNumber',
formatter: '.sharedFormatter.numberUnit' }" />
<Text text="Hello"/>
</VBox>
<core:ComponentContainer width="100%"
name="bourneMyChildApp"
component="bourneMyChildApp" />
</content>
</Page>
</pages>
</App>
</mvc:View>
var oModel = this.getModel(),
oJsonData = {
MyNumber: 100000.1234
};
oModel.setData(oJsonData);
sap.ui.define([
"sap/ui/core/mvc/Controller",
"mysharedlibrary/SharedFormatter"
], function(Controller, SharedFormatter) {
"use strict";
return Controller.extend("bourneMyParentApp.controller.View1", {
sharedFormatter: SharedFormatter
});
});
{
"path": "/resources/mysharedlibrary/",
"target": {
"type": "application",
"name": "mysharedlibrary",
"entryPath": "/"
},
"description": "My shared library"
}
<mvc:View controllerName="bourneMyChildApp.controller.View1"
xmlns:bourne="mysharedlibrary"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:mvc="sap.ui.core.mvc"
displayBlock="true" xmlns="sap.m">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<Text text="World" />
<bourne:ProductRating />
</content>
</Page>
</pages>
</App>
</mvc:View>
{
"path": "/resources/mysharedlibrary/",
"target": {
"type": "application",
"name": "mysharedlibrary",
"entryPath": "/"
},
"description": "My shared library"
}
{
"routes": [
{
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
},
{
"path": "/test-resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/test-resources"
},
"description": "SAPUI5 Test Resources"
}
]
}
{
"_version": "1.7.0",
"sap.app": {
"id": "mysharedlibrary",
"type": "library",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "1.0.0"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"sourceTemplate": {
"id": "ui5template.basicSAPUI5ApplicationProject",
"version": "1.40.12"
}
},
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": ["sap_hcb", "sap_belize"]
},
"sap.ui5": {
"dependencies": {
"minUI5Version": "1.30.0",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.layout": {},
"sap.ushell": {},
"sap.collaboration": {},
"sap.ui.comp": {},
"sap.uxap": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "BournemySharedLibrary.i18n.i18n"
}
}
},
"resources": {
"css": [{
"uri": "css/style.css"
}]
}
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<library xmlns="http://www.sap.com/sap.ui.library.xsd" >
<name>sap.ui.unified</name>
<vendor>SAP SE</vendor>
<copyright>${copyright}</copyright>
<version>${version}</version>
<documentation>Unified controls intended for both, mobile and desktop scenarios</documentation>
<dependencies>
<dependency>
<libraryName>sap.ui.core</libraryName>
</dependency>
</dependencies>
<appData>
<selenium xmlns="http://www.sap.com/ui5/buildext/selenium" package="com.sap.ui5.selenium.unified" />
<!-- excludes for the JSCoverage -->
<jscoverage xmlns="http://www.sap.com/ui5/buildext/jscoverage" >
<exclude name="sap.ui.unified.js." />
</jscoverage>
<documentation xmlns="http://www.sap.com/ui5/buildext/documentation"
indexUrl="../../../../test-resources/sap/ui/unified/demokit/docuindex.json"
resolve="lib" />
</appData>
</library>
/* global my:true */
sap.ui.define([
"jquery.sap.global",
"sap/ui/core/library"
], // library dependency
function(jQuery) {
"use strict";
sap.ui.getCore().initLibrary({
name: "mysharedlibrary",
version: "1.0.0",
dependencies: ["sap.ui.core"],
types: [],
interfaces: [],
controls: [
"mysharedlibrary.ProductRating"
],
elements: []
});
return my.custom.control;
}, /* bExport= */ false);
sap.ui.define([
"sap/ui/core/Control",
"sap/m/RatingIndicator",
"sap/m/Label",
"sap/m/Button"
], function (Control, RatingIndicator, Label, Button) {
"use strict";
return Control.extend("mysharedlibrary.ProductRating", {
metadata : {
properties : {
value: {type : "float", defaultValue : 0}
},
aggregations : {
_rating : {type : "sap.m.RatingIndicator", multiple: false, visibility : "hidden"},
_label : {type : "sap.m.Label", multiple: false, visibility : "hidden"},
_button : {type : "sap.m.Button", multiple: false, visibility : "hidden"}
},
events : {
change : {
parameters : {
value : {type : "int"}
}
}
}
},
init : function () {
this.setAggregation("_rating", new RatingIndicator({
value: this.getValue(),
iconSize: "2rem",
visualMode: "Half",
liveChange: this._onRate.bind(this)
}));
this.setAggregation("_label", new Label({
text: "{i18n>productRatingLabelInitial}"
}).addStyleClass("sapUiTinyMargin"));
this.setAggregation("_button", new Button({
text: "{i18n>productRatingButton}",
press: this._onSubmit.bind(this)
}));
},
setValue: function (iValue) {
this.setProperty("value", iValue, true);
this.getAggregation("_rating").setValue(iValue);
},
_onRate : function (oEvent) {
var oRessourceBundle = this.getModel("i18n").getResourceBundle();
var fValue = oEvent.getParameter("value");
this.setValue(fValue);
this.getAggregation("_label").setText(oRessourceBundle.getText("productRatingLabelIndicator", [fValue, oEvent.getSource().getMaxValue()]));
this.getAggregation("_label").setDesign("Bold");
},
_onSubmit : function (oEvent) {
var oResourceBundle = this.getModel("i18n").getResourceBundle();
this.getAggregation("_rating").setEnabled(false);
this.getAggregation("_label").setText(oResourceBundle.getText("productRatingLabelFinal"));
this.getAggregation("_button").setEnabled(false);
this.fireEvent("change", {
value: this.getValue()
});
},
renderer : function (oRM, oControl) {
oRM.write("<div");
oRM.writeControlData(oControl);
oRM.addClass("myAppDemoWTProductRating");
oRM.writeClasses();
oRM.write(">");
oRM.renderControl(oControl.getAggregation("_rating"));
oRM.renderControl(oControl.getAggregation("_label"));
oRM.renderControl(oControl.getAggregation("_button"));
oRM.write("</div>");
}
});
});
sap.ui.define(["sap/ui/core/format/DateFormat"], function(DateFormat) {
"use strict";
return {
/**
* Rounds the number unit value to 2 digits
* @public
* @param {string} sValue the number string to be rounded
* @returns {string} sValue with 2 digits rounded
*/
numberUnit: function(sValue) {
if (!sValue) {
return "";
}
return sValue.toLocaleString();
}
};
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 |