As an application developer using SAP UI5, when I deal with some issues reported by end users, it turns out that I cannot find out the root cause without debugging UI5 framework code.
Why an UI5 application developer needs to study framework code
Normally an UI5 application consists of various controls provided by UI5 library. If you just want to use a certain control and make it work in your application, it is enough for you to just go through the control API document, play it around in UI5 demokit. But if you meet with issues with the control, or you would like to know how the control is manipulated by UI5 framework to write a more robust and more efficient application, it is then inevitable that you need to dive into the UI5 framework source code.
During my struggle against customer issues during this year, I gained some experience how to debug UI5 framework code. I would like to share them with you here. Thus I write this tutorial, using the more simple button control for example, to illustrate how to thoroughly understand this control, together with theinvolved framework code in an step-by-step way.
Another benefit of studying UI5 framework code is, since the code are written by JavaScript veterans, by being familiar with those code everyday, you can learn how to program JavaScript in a more robust, elegant, generic, and efficient way, to upgrade your JavaScript skills.
Since all of the knowledge introduced here is gained through the debugging on my own, so if you find anything wrong within this tutorial, please do point it out and I will correct it.
The content of this tutorial
Part 1 UI5 module lazy load mechanism
You run UI5 application in Chrome and you observe lots of JavaScript files loaded in the network tab of Chrome development tool. And you wonder who triggers their download. For example, as long as you have used UI5 button control, you will see Button.js downloaded. Why? See answer here.
Part 2 Control renderer
You have used UI5 button control, and you find in Chrome development tool that it is drawn as “button” tag in generated html page. However you never declared any native html tag in your application, where does it come from?
You assume it is Framework which does this trick, and you want to know more: when and where this button tag is generated by who? See answer here.
Part 3 Native html event VS UI5 semantic event
If you have some basic html knowledge, you will probably know the “click” event of button tag. However, after you go through the UI5 button API document, you find that its available event it exposes for your application to register is not “click”, but “press”. Would like to know why? See answer here.
Or if you would also like to know something about event handling design of other popular framework like Angular, you can read this blog: Compare Event handling mechanism: SAPUI5 and Angular.
Part 4 control metadata
You have one variable which points to a button control instance, for example “oButton”. You type “oButton.” in Chrome console, and you will see lots of functions in auto-complete list. You want to know by which rules are these functions chosen to display here, and where do they come from? See answer here.
Part 5 control instance data
Take button control’s text property for example, you use getText and setText to read and change it. Take another property, width, for example, can you imagine whether the getWidth and setWidth are implemented in a similar way? See answer here.
Part 6 control data binding
Data binding is an important concept in MVC world. It should never be the first time you touched this concept. You know for example after you bind the text property of control to a field of a JSON model, in the runtime the control will display the value in that JSON model field accordingly. However have you even thought about how UI5 framework implements this for you under the hood? See answer here.
Part 7 Implementations for different binding mode: OneWay, TwoWay, OneTime
You probably see these different mode in SAP help document and you learn their different use scenarios through the documentation, and perhaps you never explicitly specify the binding mode in your application, that is, you use the default one.
So, what is the default binding mode? How does UI5 framework treat each binding mode differently?
See answer here.
Part 8 Control ID
You create a button control in the sample application and use Chrome development tool “inspect element” function to get the id of generated button tag and you get its id “button0”. You would like to know where does this prefix “button” and the zero come from? See answer here.
Part 9 Control internationalization support
If you use Chrome development tool to observe a standard SAP Fiori application running under debug mode, you probably could observe there are several files like i18n_en.properties downloaded. What are usage of these files? See answer here.
Part 10 Button control in XML view
In all previous nine blogs so far, you directly create button control via JavaScript code – you are the god who determines the born of button control. How about the control defined in xml view? Since you never use JavaScript code any more to explicitly create it, it makes sense that UI5 framework will act as God this time. You want to know in which code the button control is created by framework? See answer here.
Part 11 Button control and its underlying DOM node
You want to change the text color and the background color of button control, however there is no functions such as setText or setBackgroundColor available. Would like to know how to achieve? See answer here.
相关推荐
对于开发者而言,文档中还包含了关于管理UI和服务器消息、路由和导航、应用程序性能优化、适应不同的操作系统和设备、以及SAPUI5的灵活性服务等方面的指南。这些服务使得用户界面能够轻松地适应不同屏幕和用户交互。...
**注**:您可以通过在线方式访问 Demo Kit:[SAP UI5 Demo Kit on SAP HANA Cloud](https://sapui5.hana.ondemand.com/)。请注意,这可能并不是您本地版本的 Demo Kit。 #### 三、选择浏览器 SAP UI5 对浏览器的...
- **UI5 与 SAP Fiori 的关系**:UI5 是具体的前端框架,用于实现 SAP Fiori 所定义的用户体验标准。SAP 官方基于 UI5 构建的一系列应用程序集合被称为 SAP Fiori Apps。 #### 二、SAP UI5 开发环境搭建 ##### 2.1...
SAPUI5作为一款现代化的企业级前端框架,不仅提供了丰富的UI组件和工具,还支持灵活的数据绑定、国际化、模块化等特性,使得开发者能够快速构建高质量的企业应用。通过深入了解其架构和关键技术点,可以更好地利用...
SAP UI5 是一个用于构建企业级 Web 应用的框架,它由 SAP 公司开发,提供了丰富的 UI 控件库和强大的数据绑定机制。UI5 的通用组件(commons)是这个控件库的一部分,包含了多种常见且实用的 UI 元素,如按钮、...
SAPUI5是SAP提供的一个强大的JavaScript框架,用于构建企业级的Web应用程序。而oData是一种开放的协议,它允许客户端通过HTTP访问和操作服务端的数据。 首先,我们需要确保EPM(Enterprise Product Management)的...
标题"SAP UI5 Installation Guide"和描述"SAP UI5的安装指南,SAP UI5一个强大的js框架,刚出来的,懂得人很少,最近项目用到,与大家分享"表明本篇指南主要是为用户提供如何安装和配置SAP UI5框架的详细步骤。SAP UI...
【标题】"sap.m.sample.Image.zip_UI5_sap ui5_sap.m.Image"是一个与SAP UI5框架相关的示例项目,重点展示了如何在应用程序中使用`sap.m.Image`控件来显示图像。这个压缩包包含了开发和运行该示例所需的所有文件。 ...
SAPUI5,也被称为SAP Fiori,是SAP公司推出的一套用户界面技术标准,用于构建企业级应用。SAP Fiori的设计宗旨是提供一种...因此,SAPUI5开发者需要不断学习和掌握相关的知识和技能,以便能够创建出高质量的应用程序。
随着对SAPUI5框架的深入理解和实践,学习者将能够构建更加复杂的业务应用场景。例如,在练习7中,学习者将学习如何设计和实现一个供应商标签页;在练习8中,则会构建一个审批流程;练习9深入到行项目的处理;最后在...
### SAPUI5 学习知识点概述 #### 一、引言 SAPUI5 是一个基于 HTML5 的客户端渲染库,提供了丰富的标准控件和扩展控件。它为桌面及移动应用开发提供了一个轻量级的编程模型。由于基于 JavaScript 开发,SAPUI5 支持...
SAP UI5是一种用于构建企业级Web应用程序的开放源代码框架,主要由SAP公司开发。这个名为"SAP UI5 walkthrough代码"的压缩包文件很可能包含了一组示例代码和教程,帮助用户逐步理解并掌握SAP UI5的使用。 UI5的核心...
在学习和开发 SAP UI5 应用时,可以通过一系列的教程,如 SAP UI5 Walkthrough,来掌握基本的开发流程、数据绑定、导航、控件扩展和响应式设计等概念,以及最佳的开发实践和测试技巧。 总的来说,SAP UI5 是一个...
"ui5" 是 SAP 的开放源代码框架,用于构建企业级的 Web 应用程序。"proudX4v" 可能是指这个示例所基于的特定版本或分支,"sap_ui5" 则是 SAP UI5 的标准标记。 【压缩包子文件的文件名称列表】: 1. **index.html** ...
SAPUI5是一种由SAP开发的开源JavaScript框架,用于构建企业级的用户界面,尤其在B2B领域广泛应用。它基于OpenUI5,并且专为SAP的业务应用程序进行了优化。SAPUI5的核心是模型-视图-控制器(MVC)设计模式,它提供了...
在本篇文章中,我们将深入探讨如何为SAPUI5中的`TextField`添加占位符功能。此技术是在SAPUI5框架...此外,这种方法还可以作为学习如何扩展SAPUI5组件的一个很好的示例,对于熟悉SAPUI5框架的开发者来说非常有价值。
在"SAPUI5-Samples"这个项目中,包含了各种示例和测试用例,这有助于开发者学习和理解这两个框架的基本用法和高级特性。例如,"我的第一步"可能是一个入门级别的教程,引导开发者如何设置基本的SAPUI5应用。"交付...
【SAPUI5_MyDashboard】是一个基于SAPUI5技术构建的简单仪表板应用,主要展示了如何利用SAPUI5框架设计和实现一个交互式的前端界面。SAPUI5是SAP公司提供的一个用于开发企业级Web应用程序的开放源代码库,它集成了...
在本文中,我们将深入探讨SAP UI5,这是一种由SAP公司开发的开源JavaScript库,专...你可以通过阅读官方文档、参加在线教程,或者通过分析`sapui5_1-master`项目来加深对SAP UI5的理解,从而开始你的SAP UI5开发之旅。
《SAP B1 UI及DI文档》是一份深入解析SAP Business One (SAP B1)用户界面(UI)和数据集成(DI)组件的重要参考资料。这份文档详细介绍了SAP B1系统的各个层面,旨在帮助开发者和IT专业人员更好地理解和利用SAP的SDK...