Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
HPSeitz
Active Participant

In this blog I will describe the structure and concepts behind the UI5 SplitApp Boilerplate. It is a template/skeleton for Mobile UI5 Apps and follows the "Mobile First" approach, but also works on desktop (Thanks to the great sap.m controls).


The UI5 Boilerplate can be understood as starting point for your own UI5 Development, both for OpenUI5 and SAPUI5 Apps.

The Boilerplate provides a basic application and file structure, implements some core features (navigation, i18n) and contains example views/controllers for different purposes. The UI5 SplitApp Boilerplate code is hosted on Github: 6of5/UI5SplitApp-Boilerplate · GitHub

The UI5 Boilerplate also supports SAP and also Non-SAP Development approach, this is reflected in two different git branches:

non-SAP centric Development ScenarioSAP-centric Development Scenario
Development ToolAny IDE with Git Support (Sublime Text, Eclipse, IntelliJ,…)Eclipse 4.3 with SAP UI Development Toolkit for HTML5 (SAP UI5 Toolkit)
Git BranchmastereclipseKepler
Git Clone Commandgit clone https://github.com/6of5/UI5SplitApp-Boilerplate.gitgit clone -b eclipseKepler https://github.com/6of5/UI5SplitApp-Boilerplate.git
More Informationhttp://scn.sap.com/community/developer-center/front-end/blog/2014/01/13/ui5-mobile-splitapp-boilerpl...UI5 Boilerplate with Eclipse + SAPUI5 Toolkit
local Dev Runtime Optionsnode.js, Apache HTTP, Apache TomcatWeb App Preview, Apache Tomcat, HANA Cloud Local Runtime

Application Structure and File Structure

UI5 Boilerplate is structured via the following folders:

Foldercontains
appUI5 Application Component, which is responsible for general tasks, like initialize core models like i18n
cssCSS files go here
i18nresource bundles for internationalization (i18n) are stored in this folder
imgassets like images, logos,….
jsgeneral javascript files, e.g. app.js
modelUI5 model information (like json, xml files)
viewUI5 view files (XMLViews, JSViews) and the corresponding controllers

Let's have a look at the index.html file first:

It is a normal HTML5 document file. After the meta declaration for IE the UI5 bootstrap script is declared. The boilerplate offers here in comments some alternative  sources for the UI5 bootstrap (OpenUI5 external, SAPUI5 external, local SAPUI5 from SAP UI5 Toolkit or providing it via local web server). With local options you can define yourself which dedicated UI5 version you want to use. The index.html links to the JavaScript file app.js:

app.js (declare UI5 resources / 'start' Application Component)

in the app.js we define where UI5 resources are located. These are in the folders app, model and view. So UI5 will be able to use resources within these folders. And we specify that we require app.Component. This Component represents our Application. We create an ComponentContainer with name "app" and attach it to the DOM element with the id "root", which in our case is the body tag <body class="sapUiBody" id="root">. This will create and run our Component (Application):

Component.js (Application Component)

In the Component (Application) we create the App.view (which represents the UI of our Application) and create the i18n model and attach this to the App.View. Within the component further general tasks could be executed, like loading master data, which can then be used throughout the application. Now lets have a look at the App View:

App.view.js (Application UI)

In the App View we create a SplitApp which will enable the "iPad" like UI Style. We can then define the Master Page(s) which will be on the smaller left side of the screen (here the Menu View)  and also the Detail Pages (CoffeeList View and Info View). Both JSViews or XMLViews are possible as you can see. And of course you could also use the other view types here. The App View is now returning the SplitApp as member of the mobile Shell. The result can be seen in the browser (with UI5 Boilerplate Version 0.6.0):

Next

In the next blog article I want to explain, how you can easily extend the UI5 Boilerplate with further Pages.

You can find an article which describes How to easily add further pages in this external blog post.

Updates/Changes in version 0.7.0

With the updated version of the UI5 boilerplate there are some fundamental changes which I shortly will describe.

Shell and Component were removed

As the Shell and also the Component are not really necessary for a 'normal' App (here in the sense of a single, independent App), they have been removed.

This makes the DOM more lean and removes unnecessary complexity.

The homeIcon definition is done by the SpliApp itself now. Initialisation of the global models (i18n and the new device model) is taken over form the Component by the App View (RootView). This makes also the ComponentContainer obsolete. Therefore simply the App View is placed in the DOM in the app.'s file:

Device Model introduced

To implement different behaviour on different devices (smartphone, tablet, desktop) the device model was added. More Infos in dedicated post:

http://scn.sap.com/community/developer-center/front-end/blog/2014/04/15/responsive-design-of-ui5-spl...

Fiori Edition of UI5 Boilerplate

There is now a Fiori Edition of the UI5 Boilerplate available, which can be integrated into the SAP Fiori Launchpad. More information under the following links:

sitFRA 2015 – Birthday of UI5BP Fiori Edition

27 Comments
Labels in this area