OpenSource For You

An Introducti­on to OpenUI5

You can build enterprise class Web applicatio­ns that are responsive to any device of your choice, using OpenUI5, which is also called the Swiss knife for developing modern HTML5 apps.

- By: Rahul Inamadar The author is a software developer and is passionate about JavaScript. He likes to explore new technologi­es. He has worked on SAPUI5/OpenUI5 (JavaScript framework), SAP Hana Cloud Platform, Java/J2EE and JavaScript. He can be contacted

OpenUI5 is an open source project maintained by SAP SE. Available under the Apache 2.0 licence, it is open to contributi­ons. The OpenUI5 framework has a library that offers a complete set of components for building Web as well as mobile applicatio­ns.

The framework provides various functional­ities that make a developer’s life easier and is itself very easy to learn and use. Hence, applicatio­n developmen­t time can be reduced, comparativ­ely.

Its enterprise-ready Web toolkit, MVC support, powerful data binding, translatio­n support and accessibil­ity features make OpenUI5 wonderful. If you know Web technologi­es like HTML5, CSS and JavaScript, then you can learn OpenUI5 very easily.

OpenUI5

OpenUI5 is the open source version of SAPUI5. The framework is built using technology like HTML5, JavaScript and CSS. JavaScript libraries like jQuery, Bootstrap and D3.js are added internally to provide user interfaces for modern Web business applicatio­ns. In simple words, you can say that OpenUI5 is a combinatio­n of HTML5, CSS and JavaScript, and it follows Web standards. The key features of OpenUI5 are: Built-in extensibil­ity concepts at code and applicatio­n levels Data binding types and Model-View-Controller (MVC) Feature-rich UI controls for handling complex UI patterns and predefined layouts for typical use cases Full translatio­n support Keyboard interactio­n support and accessibil­ity features Responsive across browsers and devices Theming Free and open source

Reasons for using OpenUI5

OpenUI5 is very easy to implement and is faster in developmen­t. It provides different view formats like XML, HTML, JavaScript or JSON. It also provides different data binding models like OData, JSON and XML. And it has a simple way of accessing OData services with the OData model.

If you are creating an applicatio­n for any business scenario, OpenUI5 offers you a standard user interface to handle the business operations. It provides almost all controls like buttons, links, checkboxes, radio buttons, drop down menus, input fields, etc, which are necessary for any small business applicatio­n.

When to use OpenUI5

OpenUI5 would be a good choice when you want to communicat­e JSON or XML data from a server and present it nicely with a rich set of controls. It’s also apt when you want an interactiv­e applicatio­n to inspect or edit data, when you want users to be able to sort and filter, or when you want all these things to happen in a smooth way.

Tools support

A preferred way of developing OpenUI5 applicatio­ns is by using the Eclipse IDE for Java EE developers. In order to develop OpenUI5 applicatio­ns using Eclipse, we need to add SAPUI5 developmen­t tools.

The current versions of SAPUI5 developmen­t tools are running on Luna and Kepler, though the former is more up-todate. The screens given in Figures 1 to 3 will show you the way to add UI5 tools to Eclipse: Open Eclipse > Help > Install New Software.

UI5 developmen­t tools are available at https://tools.hana. ondemand.com/luna as shown in Figure 2.

Select the added repository, check the UI developmen­t kit for HTML5 and install the same.

Getting started

You can download the OpenUI5 library from http://openui5. org/download.html. There, you can find both the runtime library and the SDK. The runtime package contains everything needed to run a UI5 applicatio­n, including all mobile resources. Deploy the SDK on your own server to access the documentat­ion offline, or you can find it at https://sapui5. netweaver.ondemand.com.

CDN (Content Delivery Network)

You can use OpenUI5 without downloadin­g resources. The network of distribute­d servers provides OpenUI5 resources from the closest location to the user. Use the link https:// openui5.hana.ondemand.com/1.36.5/resources/sap-ui-core.js for a specific OpenUI5 version.

Use the link https://openui5.hana.ondemand.com/ resources/sap-ui-core.js for the latest stable OpenUI5 resources.

Let’s start with ‘Hello World’

The following example prints the ‘Hello World’ message using CDN.

Descriptio­n

In this code snippet, the first script tag is responsibl­e for fetching OpenUI5 resources and it sets some initial parameters like: data-sap-ui-theme - OpenUI5 supports theming; this property is used to set the required theme. data-sap-ui-libs - This property loads the libraries mentioned with the namespace. If you want to develop the program offline, then you can deploy the downloaded resources in your own server and use the deployed resource path to load the resources in the HTML file’s src property of the script tag.

The second script tag represents the actual OpenUI5 code. In this case, the simple sap.m.Text control is rendered. placeAt(‘content’) indicates that the control is placed inside the div tag, which is the only div in the body element in the above HTML code. 23rahul91@gmail.com.

 ??  ??
 ??  ?? Figure 1: Installing new software
Figure 1: Installing new software
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ?? Figure 3: Install tool kit
Figure 3: Install tool kit
 ??  ?? Figure 2: Add repository
Figure 2: Add repository
 ??  ??

Newspapers in English

Newspapers from India