SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
Andreas Kunz & Thomas Gauguin Houghton-Larsen, SAP SE
June 22, 2018
News from
Control Development
Disclaimer
„News“ means: we will not talk about control development basics
 UI5con 2016:
 https://www.slideshare.net/andreaskunz/ui5-controls-ui5con-2016
 https://www.youtube.com/watch?v=W3Qkev2yk9w
 16:05 h in Room B:
„Create your own UI5 Control, wrap it in a library and consume it“
3
JavaScript file with API, renderer and
behavior
All-imperative
Can create HTML from scratch, but
can also re-use other controls
internally
UI5 Controls at Present
4
More and more “composite controls” are being developed:
▪ Controls that purely consist of other controls, with some additional logic, but no own HTML
Composite Controls
SearchField (composite control)
sap.m.Input sap.m.Button
„placeholder“ property
„placeholder“ property
„press“ event
„search“ event„buttonText“ property
„text“ property
Sync
Sync
handle in control code
Outer API:
5
Creating composite controls requires lots of error-prone glue code:
▪ Instantiating inner controls (at the right time, and not too often), rendering them, managing lifecycle
▪ Making sure they are properly connected in the control hierarchy (for data models, events, invalidation)
▪ Sync of outer API properties / aggregations with inner controls
▪ No visualization of the final control layout
How can we address these challenges ?
▪ XMLViews and Fragments are well-established and already used for combining controls
▪ XMLViews have proven to make their inner structure easily understandable
▪ Just use a Fragment to define the inner controls, add an API, and a way to bind inner controls to this API !
 voilà: the XMLComposite control is born!
Note: “FragmentControl” was a preliminary working title of the XMLComposite (preview at UI5con@SAP 2017)
Why is the standard approach not good enough?
6
Pair of files:
▪ HelloWorld.js
– regular control implementation, with API/metadata part, but without the renderer
– inherits from sap.ui.core.XMLComposite
▪ HelloWorld.control.xml
– just like a regular XMLView (or rather an XML Fragment) + $this ….
How does an XMLComposite control look?
Demo Code
7
In XMLComposites, you can bind inner controls to the outer control API.
$this: name of model which contains the outer API
Mechanism behind this feature is generic and can be used elsewhere (e.g. in regular composite
controls without XML): sap.ui.model.base.ManagedObjectModel
We‘ll get to it later…
Digression: what is $this?
8
SearchField
Demo
Code
9
Handling Aggregations: Using different controls internally
When you want to hide some properties of the internal controls or use different control type:
▪ Fully declare the inner control and bind some properties against the outer aggregation.
Example: application should be able to make your control display any number of buttons, but
should only control the button text and only get one consolidated event.
The binding context in the aggregation template (= the Button) refers to the respective item in the
outer aggregation, so the relative path „text“ points to a different outer control for each actual inner
Button.
DemoCode
10
Makes properties and aggregations of a UI5 control (or a ManagedObject) available as a model.
Just do
and set the model on a view or control, e.g. as „inputModel“, and you can:
Note: Usually, this additional level of indirection makes less sense if an application has the models
and the Controls at its disposal.
Coming back to the ManagedObjectModel
Demo Code
11
For each ListItem in oList, there will be a Button within the HorizontalLayout.
ManagedObjectModel also works for aggregations
Demo Code
12
Example: a new composite container control uses a Panel internally for expand/collapse.
All controls in „content“ aggregation should be displayed inside this Panel.
What if we just want to re-use the same control somewhere inside?
my.Container (composite control)
sap.m.Panel
„content“ aggregation
Outer API:
13
Composite controls can define an aggregation to be forwarded to an internal child control:
metadata : { // "my.Container" API
aggregations : {
content: {
type: "sap.ui.core.Control",
multiple: true,
forwarding: {
idSuffix: "-panel",
aggregation: "content"
}
},
...
init: function() {
var oPanel = new sap.m.Panel(this.getId() + "-panel", { ... });
Demo Playground Demo
Aggregation Forwarding
14
forwarding: {
getter: "getPanel",
aggregation: "content"
}
...
getPanel: function() {
// if not yet created:
var oPanel = new sap.m.Panel({ ... });
...
return oPanel;
}
Demo
Aggregation Forwarding – create inner control lazily
15
Aggregation Forwarding in XMLComposites
Demo Code
Even easier:
<!– somewhere in the XML Fragment: -->
<Panel id="panel" headerText="Inner Panel" expandable="true" />
<!-- controls given into the "content" aggregation will be forwarded in here -->
content: {
type: "sap.ui.core.Control",
multiple: true,
forwarding: {
idSuffix: "--panel",
aggregation: "content"
}
...
16
Have you ever written XMLView & Controller code like this?
<Button text="-10" press=".minus10" />
<Button text="-" press=".minus1" />
<Button text="+" press=".plus1" />
<Button text="+10" press=".plus10" />
And now for something completely different…
17
Then you‘ll love this:
<Button text="-10" press=".changeBy(-10)" />
<Button text="-" press=".changeBy(-1)" />
<Button text="+" press=".changeBy(1)" />
<Button text="+10" press=".changeBy(10)" />
Event Handler Parameters
18
…and probably also this:
<Button text="Calculate Tax" press=".calcTax(${unitPrice}, ${taxCategory})" />
▪ Accessing model data with binding statements, according to current data context
<ColorPalette colorSelect=".setColor(${$parameters>/value})" />
<Button text="Tell Me" press=".doSomething(${$source>/text})" />
▪ Keeping knowledge about controls away from controller code
<Button text="Greet Me!" press="sap.m.MessageBox.show('Hello!')" />
▪ Calling static functions directly, without a controller method
$event is the event object, $controller is the controller
Evaluated as a Binding Expression.
Event Handler Parameters
Playground Demo Table Demo
19
Event parameters can be used in XMLViews, but also in XMLComposites.
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:layout="sap.ui.layout">
<layout:HorizontalLayout>
<Button text="-10" press=".changeBy(-10)" />
<Button text="-" press=".changeBy(-1)" />
<Input value="{$this>/page}" editable="false" />
<Button text="+" press=".changeBy(1)" />
<Button text="+10" press=".changeBy(10)" />
</layout:HorizontalLayout>
</core:FragmentDefinition>
…something completely different? Maybe not.
Demo XML Code JS Code
20
...
<Input id="innerInput" />
<Button text="{$this>/buttonText}"
press=".fireEvent('search', {value: $controller.byId('innerInput').getValue()})"/>
...
Use with moderation…
Or in the SearchField XMLComposite shown earlier
21
XMLComposite controls are written like XMLView + Controller – but they have an API like
regular controls. They make creating composite controls much easier.
The ManagedObjectModel offers the properties & aggregations of a control (or other
ManagedObject) as a bindable Model. It is automatically provided in XMLComposites.
Aggregation Forwarding can be used to declare that every control put into an aggregation of
a composite shall be forwarded to an inner control.
Event Handler Parameters can now be specified in XMLViews and XMLComposites.
Summary
22
All features are in UI5 1.56
▪ XMLComposites & ManagedObjectModel earlier, but improved now
▪ ManagedObjectModel only publicly documented in 1.58
▪ Still sort of experimental
Code samples: https://github.com/akudev/UI5con2018-ControlDevNews
Documentation (openui5nightly, as 1.56 is not yet released):
▪ XML Composite Controls
▪ ManagedObjectModel
▪ Aggregation Forwarding
▪ Handling Events in XML Views
Resources
Thank you.
Contact information:
Andreas Kunz
@aku_dev
Thomas Gauguin Houghton-Larsen

Weitere ähnliche Inhalte

Ähnlich wie UI5con 2018: News from Control Development

UI5con 2017 - Create your own UI5 controls – what’s coming up
UI5con 2017 - Create your own UI5 controls – what’s coming upUI5con 2017 - Create your own UI5 controls – what’s coming up
UI5con 2017 - Create your own UI5 controls – what’s coming upAndreas Kunz
 
Controller in AngularJS
Controller in AngularJSController in AngularJS
Controller in AngularJSBrajesh Yadav
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKBrendan Lim
 
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios
 
Ctools presentation
Ctools presentationCtools presentation
Ctools presentationDigitaria
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXIMC Institute
 
SynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseindiappsdevelopment
 
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesUsing prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesDavid Voyles
 
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind
 
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Arun Gupta
 
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015Innomatic Platform
 
Introduction to the INTEGRAL FRAMEWORK
Introduction to the INTEGRAL FRAMEWORKIntroduction to the INTEGRAL FRAMEWORK
Introduction to the INTEGRAL FRAMEWORKKarthik Subramanian
 
Introduction to the integral framework
Introduction to the integral frameworkIntroduction to the integral framework
Introduction to the integral frameworkKarthik Subramanian
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivitiesmaamir farooq
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activitiesmaamir farooq
 
Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008Yudep Apoi
 
XPages Blast - ILUG 2010
XPages Blast - ILUG 2010XPages Blast - ILUG 2010
XPages Blast - ILUG 2010Tim Clark
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin GeneratorJohn Cleveley
 

Ähnlich wie UI5con 2018: News from Control Development (20)

UI5con 2017 - Create your own UI5 controls – what’s coming up
UI5con 2017 - Create your own UI5 controls – what’s coming upUI5con 2017 - Create your own UI5 controls – what’s coming up
UI5con 2017 - Create your own UI5 controls – what’s coming up
 
Eclipse Tricks
Eclipse TricksEclipse Tricks
Eclipse Tricks
 
Controller in AngularJS
Controller in AngularJSController in AngularJS
Controller in AngularJS
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDK
 
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
 
Ctools presentation
Ctools presentationCtools presentation
Ctools presentation
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 
SynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically development
 
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesUsing prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile services
 
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
 
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
 
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
 
Introduction to the INTEGRAL FRAMEWORK
Introduction to the INTEGRAL FRAMEWORKIntroduction to the INTEGRAL FRAMEWORK
Introduction to the INTEGRAL FRAMEWORK
 
Introduction to the integral framework
Introduction to the integral frameworkIntroduction to the integral framework
Introduction to the integral framework
 
Java script
Java scriptJava script
Java script
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivities
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activities
 
Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008
 
XPages Blast - ILUG 2010
XPages Blast - ILUG 2010XPages Blast - ILUG 2010
XPages Blast - ILUG 2010
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
 

Kürzlich hochgeladen

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 

Kürzlich hochgeladen (20)

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 

UI5con 2018: News from Control Development

  • 1. Andreas Kunz & Thomas Gauguin Houghton-Larsen, SAP SE June 22, 2018 News from Control Development
  • 2. Disclaimer „News“ means: we will not talk about control development basics  UI5con 2016:  https://www.slideshare.net/andreaskunz/ui5-controls-ui5con-2016  https://www.youtube.com/watch?v=W3Qkev2yk9w  16:05 h in Room B: „Create your own UI5 Control, wrap it in a library and consume it“
  • 3. 3 JavaScript file with API, renderer and behavior All-imperative Can create HTML from scratch, but can also re-use other controls internally UI5 Controls at Present
  • 4. 4 More and more “composite controls” are being developed: ▪ Controls that purely consist of other controls, with some additional logic, but no own HTML Composite Controls SearchField (composite control) sap.m.Input sap.m.Button „placeholder“ property „placeholder“ property „press“ event „search“ event„buttonText“ property „text“ property Sync Sync handle in control code Outer API:
  • 5. 5 Creating composite controls requires lots of error-prone glue code: ▪ Instantiating inner controls (at the right time, and not too often), rendering them, managing lifecycle ▪ Making sure they are properly connected in the control hierarchy (for data models, events, invalidation) ▪ Sync of outer API properties / aggregations with inner controls ▪ No visualization of the final control layout How can we address these challenges ? ▪ XMLViews and Fragments are well-established and already used for combining controls ▪ XMLViews have proven to make their inner structure easily understandable ▪ Just use a Fragment to define the inner controls, add an API, and a way to bind inner controls to this API !  voilà: the XMLComposite control is born! Note: “FragmentControl” was a preliminary working title of the XMLComposite (preview at UI5con@SAP 2017) Why is the standard approach not good enough?
  • 6. 6 Pair of files: ▪ HelloWorld.js – regular control implementation, with API/metadata part, but without the renderer – inherits from sap.ui.core.XMLComposite ▪ HelloWorld.control.xml – just like a regular XMLView (or rather an XML Fragment) + $this …. How does an XMLComposite control look? Demo Code
  • 7. 7 In XMLComposites, you can bind inner controls to the outer control API. $this: name of model which contains the outer API Mechanism behind this feature is generic and can be used elsewhere (e.g. in regular composite controls without XML): sap.ui.model.base.ManagedObjectModel We‘ll get to it later… Digression: what is $this?
  • 9. 9 Handling Aggregations: Using different controls internally When you want to hide some properties of the internal controls or use different control type: ▪ Fully declare the inner control and bind some properties against the outer aggregation. Example: application should be able to make your control display any number of buttons, but should only control the button text and only get one consolidated event. The binding context in the aggregation template (= the Button) refers to the respective item in the outer aggregation, so the relative path „text“ points to a different outer control for each actual inner Button. DemoCode
  • 10. 10 Makes properties and aggregations of a UI5 control (or a ManagedObject) available as a model. Just do and set the model on a view or control, e.g. as „inputModel“, and you can: Note: Usually, this additional level of indirection makes less sense if an application has the models and the Controls at its disposal. Coming back to the ManagedObjectModel Demo Code
  • 11. 11 For each ListItem in oList, there will be a Button within the HorizontalLayout. ManagedObjectModel also works for aggregations Demo Code
  • 12. 12 Example: a new composite container control uses a Panel internally for expand/collapse. All controls in „content“ aggregation should be displayed inside this Panel. What if we just want to re-use the same control somewhere inside? my.Container (composite control) sap.m.Panel „content“ aggregation Outer API:
  • 13. 13 Composite controls can define an aggregation to be forwarded to an internal child control: metadata : { // "my.Container" API aggregations : { content: { type: "sap.ui.core.Control", multiple: true, forwarding: { idSuffix: "-panel", aggregation: "content" } }, ... init: function() { var oPanel = new sap.m.Panel(this.getId() + "-panel", { ... }); Demo Playground Demo Aggregation Forwarding
  • 14. 14 forwarding: { getter: "getPanel", aggregation: "content" } ... getPanel: function() { // if not yet created: var oPanel = new sap.m.Panel({ ... }); ... return oPanel; } Demo Aggregation Forwarding – create inner control lazily
  • 15. 15 Aggregation Forwarding in XMLComposites Demo Code Even easier: <!– somewhere in the XML Fragment: --> <Panel id="panel" headerText="Inner Panel" expandable="true" /> <!-- controls given into the "content" aggregation will be forwarded in here --> content: { type: "sap.ui.core.Control", multiple: true, forwarding: { idSuffix: "--panel", aggregation: "content" } ...
  • 16. 16 Have you ever written XMLView & Controller code like this? <Button text="-10" press=".minus10" /> <Button text="-" press=".minus1" /> <Button text="+" press=".plus1" /> <Button text="+10" press=".plus10" /> And now for something completely different…
  • 17. 17 Then you‘ll love this: <Button text="-10" press=".changeBy(-10)" /> <Button text="-" press=".changeBy(-1)" /> <Button text="+" press=".changeBy(1)" /> <Button text="+10" press=".changeBy(10)" /> Event Handler Parameters
  • 18. 18 …and probably also this: <Button text="Calculate Tax" press=".calcTax(${unitPrice}, ${taxCategory})" /> ▪ Accessing model data with binding statements, according to current data context <ColorPalette colorSelect=".setColor(${$parameters>/value})" /> <Button text="Tell Me" press=".doSomething(${$source>/text})" /> ▪ Keeping knowledge about controls away from controller code <Button text="Greet Me!" press="sap.m.MessageBox.show('Hello!')" /> ▪ Calling static functions directly, without a controller method $event is the event object, $controller is the controller Evaluated as a Binding Expression. Event Handler Parameters Playground Demo Table Demo
  • 19. 19 Event parameters can be used in XMLViews, but also in XMLComposites. <core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:layout="sap.ui.layout"> <layout:HorizontalLayout> <Button text="-10" press=".changeBy(-10)" /> <Button text="-" press=".changeBy(-1)" /> <Input value="{$this>/page}" editable="false" /> <Button text="+" press=".changeBy(1)" /> <Button text="+10" press=".changeBy(10)" /> </layout:HorizontalLayout> </core:FragmentDefinition> …something completely different? Maybe not. Demo XML Code JS Code
  • 20. 20 ... <Input id="innerInput" /> <Button text="{$this>/buttonText}" press=".fireEvent('search', {value: $controller.byId('innerInput').getValue()})"/> ... Use with moderation… Or in the SearchField XMLComposite shown earlier
  • 21. 21 XMLComposite controls are written like XMLView + Controller – but they have an API like regular controls. They make creating composite controls much easier. The ManagedObjectModel offers the properties & aggregations of a control (or other ManagedObject) as a bindable Model. It is automatically provided in XMLComposites. Aggregation Forwarding can be used to declare that every control put into an aggregation of a composite shall be forwarded to an inner control. Event Handler Parameters can now be specified in XMLViews and XMLComposites. Summary
  • 22. 22 All features are in UI5 1.56 ▪ XMLComposites & ManagedObjectModel earlier, but improved now ▪ ManagedObjectModel only publicly documented in 1.58 ▪ Still sort of experimental Code samples: https://github.com/akudev/UI5con2018-ControlDevNews Documentation (openui5nightly, as 1.56 is not yet released): ▪ XML Composite Controls ▪ ManagedObjectModel ▪ Aggregation Forwarding ▪ Handling Events in XML Views Resources
  • 23. Thank you. Contact information: Andreas Kunz @aku_dev Thomas Gauguin Houghton-Larsen