当前位置:网站首页>Understand the staticarea initialization logic of SAP ui5 application through the initialization of fileuploader
Understand the staticarea initialization logic of SAP ui5 application through the initialization of fileuploader
2022-07-27 17:11:00 【Wang Zixi】
SAP UI5 FileUploader Dependence on realization :

sap.ui.define([
'sap/ui/core/Control',
'./library',
'sap/ui/core/LabelEnablement',
'sap/ui/core/InvisibleText',
'sap/ui/core/library',
'sap/ui/Device',
'./FileUploaderRenderer',
'sap/ui/dom/containsOrEquals',
'sap/ui/events/KeyCodes',
'sap/base/Log',
'sap/base/security/encodeXML',
"sap/ui/thirdparty/jquery",
// jQuery Plugin "addAriaDescribedBy"
'sap/ui/dom/jquery/Aria'
], function(
Control, library, LabelEnablement, InvisibleText, coreLibrary, Device, FileUploaderRenderer, containsOrEquals, KeyCodes, Log, encodeXML, jQuery
) {
It can be seen that jQuery.
SAP UI5 The framework automatically generates a input The element and one contain browse… The button .
And the following two interfaces are implemented :
- sap.ui.core.IFormContent
- sap.ui.unified.IProcessableBlobs
sendXHR The default value is false, At this time to use form submit Submit upload data . If it is true, Use XHR Request Submission .Form Submit Data submitted , the Jerry test , Cannot be in Chrome Developer tools network The uploaded file content is observed in .
XMLTemplateProcessor.js detected XML Defined in the view FileUploader Control , Instantiate it , And call init Method :

Create a TextField:
Used to select local files :
this.oFilePath = library.FileUploaderHelper.createTextField(this.getId() + "-fu_input").addEventDelegate({
onAfterRendering: function () {
if (that.getWidth()) {
that._resizeDomElements();
}
}
});
This TextField The type is sap.m.Text:

And then create upload button:
this.oBrowse = library.FileUploaderHelper.createButton(this.getId() + "-fu_button");
Then put the current to be created FileUploader example , namely this The control instance pointed to , Set to TextField and Button Example of parent:
this.oFilePath.setParent(this);
this.oBrowse.setParent(this);
Here is a demonstration of how to detect with code sap.m Whether the library is used , Just check button Control metadata , namely getMetadata The result returned by the method is sap.m.Button that will do .
// check if sap.m library is used
this.bMobileLib = this.oBrowse.getMetadata().getName() == "sap.m.Button";
SAP UI5 Of applySettings Method , Will in turn XML The settings specified for the control in the view , Set one by one :
These attributes in the above figure , It's me. XML Properties defined in the view , As shown in the figure below :
We are SAP UI5 This method call can often be observed in the source code :sap.ui.getCore().getStaticAreaRef():

This is a SAP UI5 Apply the last rendered HTML An element in native code ,id by :sap-ui-static

By constant STATIC_UIAREA_ID Express . This static area Used to hide shapes such as Popups, Shadow, Blocklayer Equal elements .
This static area The initialization of takes Lazy loading Inert loading method : Initialization will only be performed when it is really needed .
var oStaticArea = document.getElementById(STATIC_UIAREA_ID),
oConfig, oFirstFocusElement;
if (!oStaticArea) {
oStaticArea = document.createElement("div");
oFirstFocusElement = document.createElement("span");
oConfig = this.getConfiguration();
if (!this.bDomReady) {
throw new Error("DOM is not ready yet. Static UIArea cannot be created.");
}
边栏推荐
- 三表联查1
- 大厂们终于无法忍受“加一秒”了,微软谷歌Meta等公司提议废除闰秒
- Share a scheme of "redis" to realize "chat round system" that can't be found on the Internet
- Three table joint query 3
- 从零开始Blazor Server(1)--项目搭建
- How to modify the decoding clock [chapter]
- Gradient ring progress bar
- Purchase in Appstore
- 动作捕捉系统用于柔性机械臂的末端定位控制
- 每条你收藏的资讯背后,都离不开TA
猜你喜欢

day07 作业

webView基本使用

Niuke topic -- judge whether it is a complete binary tree or a balanced binary tree

选 择 结 构

Shardingsphere-proxy-5.0.0 distributed snowflake ID generation (III)

Complete steps of JDBC program implementation

全局String对象(函数类型)+Math对象

Reference of meta data placeholder

牛客题目——二叉搜索树与双向链表

牛客题目——链表的奇偶重排、输出二叉树的右视图、括号生成、字符流中第一个不重复的字符
随机推荐
基于STM32的智能鱼缸设计
Enumeration and union of C language
全局String对象(函数类型)+Math对象
SAP UI5 FileUploader 的本地文件上传技术实现分享
Cryptography series: certificate format representation of PKI X.509
Getting started with unity
Storage of data in C language
Character function, string function and memory function of C language
Functions in JS
C语言之字符函数和字符串函数及内存函数
渐变环形进度条
这种精度高,消耗资源少的大模型稀疏训练方法被阿里云科学家找到了!已被收录到IJCAI
CUE语言基础入门:CUE是一门为配置而生的语言
LNMP环境--部署wordpress
[SAML SSO solution] Shanghai daoning brings you SAML for asp NET/SAML for ASP. Net core download, trial, tutorial
LOJ 510 - "libreoj noi round 1" memories outside the north school gate [line segment tree]
How does vs2019 C language run multiple projects at the same time, how to add multiple source files containing main functions in a project and debug and run them respectively
两表联查1
Build a cloud native file system for media assets
三表联查1