Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

How I do self-study on a given Fiori control - part 4

$
0
0


In the second part of the self-study series, we figure out that the responsible Render name is stored in Button control's metadata:

clipboard1.png

In this part, we will concentrate on the Button metadata.


How can I get control data in the runtime

 

Since we already have the button control instance returned by new keyword, simply call its function getMetadata() and that's it.

You can find there are lots of useful information stored in the metadata. I will go through the most important fields one by one.

clipboard2.png

aAllPublicMethods

 

When you type "oButton1." in Console, you find lots of methods available in the list. Where do them come from? From the control metadata, stored in this array aAllPublicMethods.

clipboard3.png

From this array, we find there are totally 110 public methods. However if you check the source code Button.js, you can not find most of those methods defined there. The prototype chain works here again. Most of the methods are defined not in Button.js itself, but in the Button control's ancestor node in the prototype chain.

 

if you type the code below in console, you will get result: false.

 

oButton1.hasOwnProperty("getText");

clipboard4.png


The public methods of a given control is an union of its own public methods defined in its JS file and the public methods belonging to all its ancestors in the prototype chain:

clipboard5.png

aPublicMethods

 

A subset of aAllPublicMethods, defined in the metadata.publicMethods area. See one example below for EventProvider:

clipboard6.png

In the runtime, they are parsed as below:

clipboard7.png

mAllAggregations

 

List all available Aggregation. One example is tooltip. It gives hint that the button tooltip is stored as an aggregation, and its value could be queried out via the sGetter: getTooltip:

clipboard8.png

That's the reason we type the following code in console and we can get the tooltip as expected.

clipboard9.png

mProperties

 

List all the properties together with their Getter and Setter. Keep in mind this is the metadata, so you can not expert that the text we specified in the JS code "Button" could be found here. The "mProperties" here just stores the metadata of properties, not the instance data.

clipboard10.png

oParent

 

Points to its ancestor's metadata.

clipboard11.png

There are two ways to get the total number of all public methods of Button control: 110.

 

approach1: its direct parent's all public methods + its public method.

clipboard12.png

For button control, it is 75 + 35 = 110.

 

approach2: accumulate public methods number of each node in the prototype chain.

Keep in mind this prototype chain as always:

BaseObject -> EventProvider -> ManagedObject -> Element -> Control

clipboard13.png

In the next blog, I will study the instance data of Button control. I will use the setText and getText as example for research.


Viewing all articles
Browse latest Browse all 2548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>