UI5 User Guide
eBook - ePub

UI5 User Guide

How to develop responsive data-centric client web applications

Carsten Heinrigs, John T. H. Dobson, John T. H. Dobson

Buch teilen
  1. English
  2. ePUB (handyfreundlich)
  3. Über iOS und Android verfügbar
eBook - ePub

UI5 User Guide

How to develop responsive data-centric client web applications

Carsten Heinrigs, John T. H. Dobson, John T. H. Dobson

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

The UI5 User Guide gets the reader started quickly with OpenUI5/SAPUI5 development. Step by step, it shows how to develop a basic client web application, introducing concepts and flow of developing with UI5 along the way. You can reuse the resulting code as a template for any serious UI5 application.
After getting started, the main content of the book is divided into three parts:

  • The first part of the book explains the basics of UI5 development. It is written to allow the reader to easily find practical solutions for common development tasks.
  • The second part of the book goes into depth showing how to separate critical issues, like request handling and business logic from UI5. You will learn how to significantly speed up form generation and how to consistently implement data validation.
  • The third part of the book integrates the previously covered aspects into an example application.

If you are interested in finding out how UI5 works, or if you have to work with UI5 in your projects, this book is for you.

For more information, visit the book's website.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist UI5 User Guide als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu UI5 User Guide von Carsten Heinrigs, John T. H. Dobson, John T. H. Dobson im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatik & Programmierung in JavaScript. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Part I. Basics of UI5 development

In this part of the book, step by step, we will go through the basics of developing with UI5. We will begin with the various page implementations to help the reader to select the most fitting layout for a task or project (Chapter 3, Views and Pages). Next, we will cover the issues of navigation in general and routing in particular (Chapter 4, Navigation and Routing). This is being followed by a chapter exploring a client-side implementation of user access permissions (Chapter 5, User Permissions).
Having covered how to construct pages, how to navigate and limit access, we will move on to events and messages which are the core of user interaction (Chapter 6, Events and Messages). The following three chapters are concerned with page content. Beginning with models, which bind the data to the user interface controls (Chapter 7, Models), we will finally get to the main purpose of the whole effort, namely, the presentation and modification of the domain data as lists, tables (Chapter 8, Lists and Tables) and forms (Chapter 9, Forms and Input Validation).

Chapter 3. Views and Pages

We have already seen some views and a controller in Chapter 2, Building a basic responsive Web Application. Without content, the view has nothing to show. The first level of content is a basic layout of visible areas and their relative positions. In this chapter, we will look at various page layouts offered by UI5.
A view instance of type JavaScript is defined using the function sap.ui.jsview. The function takes two parameters, a view name and a view object of type sap.ui.core.mvc.JSView. The only required function to be implemented is the createContent function, which must return an object extending sap.ui.core.Control, mostly some kind of page layout control.
Additionally, the view can be connected with a controller using the getControllerName function. The view will try to load and instantiate the controller by the returned name.
Listing 3.1. JSView example with controller
sap.ui.jsview("oum.view.mPageExample", { createContent: function(oController) { const page = new sap.m.Page(); return page; }, getControllerName: function() { return "oum.controller.pageExamples"; } });
The sap.ui.core.mvc.JSView extends sap.ui.core.mvc.View, which provides functions to access and change the content aggregation returned by the createContent. We can getContent, addContent, insertContent, indexOfContent, removeContent, removeAllContent or destroyContent. These functions allow us to programatically modify any view content.
To limit the visible space occupied by the View, the width and height properties of the View object can be set using the related setWidth and setHeight functions. Any valid sap.ui.core.CSSSize value is allowed. It appears as CSS style attributes of the generated HTML container.
A view is initialized, rendered and re-rendered, exited, and finally destroyed. In practice, the related events of the View are rarely used, because the corresponding functions for the controller are generally preferable.

Page layouts

UI5 has several implementations of layout controls representing a web page. A page layout provides areas for content. The layouts generally have a header and footer, which may or may not be shown. All have a main content area. The adaptability to different devices depends on the controls being used in the content aggregations.
Here, we just want to give an overview of available page implementations without diving too deeply into the details.

Basic responsive Page

The sap.m.Page is the most commonly used responsive layout control. It has a header with an optional sub-header, a content and a footer area.
Screenshot of example sap.m.Page
Figure 3.1. Sketch of sap.m.Page
Sketch of sap.m.Page
The customHeader, subHeader and footer aggregations require a control implementing sap.m.IBar (Bar, OverflowToolbar, Toolbar). All generate a horizontal container, but within the container the content is positioned differently.
The sap.m.Page has a landmarkInfo aggregation, which is important, as it allows screen readers to provide an overview of the page structure and to quickly navigate to the relevant content areas. The available roles are defined as part of the WAI-ARIA specifications under Landmark roles. The corresponding UI5 enumeration is the sap.ui.core.AccessibleLandmarkRole with the following values: Banner, Complementary, Main, Navigation, None, Region, Search.
Defining landmark roles and labels can help all participants in the development process to communicate the structure of a page and clarify the functionality of page areas. Finding a short descriptive text for each page area gives the team a chance to find problems of confusing uses mixing different concerns. Here, we will use english text because they are more instructive than i18n properties we would normally use.
Listing 3.2. Define landmark roles and labels
const landmarkInfo = new sap.m.PageAccessibleLandmarkInfo({ rootLabel: "example page constructed with sap.m.Page", headerRole: "Navigation", headerLabel: "back and home buttons besides main page title", subHeaderRole: "Complementary", subHeaderLabel: "save and cancel buttons", contentRole: "Main", contentLabel: "this is only an example without meaningful content", footerRole: "None" });
The following listing constructs the related page with a header (lines 5 to 15), subHeader (lines 16 to 34), content (lines 35 to 41) and footer area (lines 42 to 44).
We will use the default header properties instead of the customHeader aggregation, which we only use in cases where the default header properties are insufficient. We already used the customHeader aggregation for Listing 2.15, “Add LanguageSwitcher fragment to Page”.
The default header consists of a title text placed in the middle, a navigation back button on the left side, and some additional headerContent on the right side of the header container. The title properties are title and titleLevel (Enumeration sap.ui.core.TitleLevel). The relevant button properties are showNavButton and navButtonTooltip, and the related event navButtonPress.
Listing 3.3. Construct a sap.m.Page
 1 sap.ui.jsview("oum.view.mPage", { 2 createContent: function(oController) { 3 const pageControl = new sap.m.Page({ 4 landmarkInfo: landmarkInfo, 5 showHe...

Inhaltsverzeichnis