How to adapt code among view types? - sapui5

I am trying to use a sap.m.List Control in a application, however, I am struggling to find examples of how to implement this control in a JavaScript View. I am aware that the "Explored" app has code examples to implement the controls in XML views; However, I would like to know how to adapt those examples to HTML, JSON and JavaScript views. What an expert UI5 Developer does when he needs to adapt a control from a XML View to another type of view? Do we have any guidelines? Thanks in advance!

Regarding the guidelines you`ll find at least a quick introduction on js-views in the demokit documentation here.
I created a pretty simple example for the sap.m.List in javascript here although I am aware that it is not part of a view, but it should give you a first impression.
If you are looking for more js examples have a look here. For the older sap.ui.commons controls all samples are created with javascript.

Related

Implement inline help/guided tour for SAPUI5 apps

I'm searching for a way to create a sort of inline help / guided walkthrough tour to explain certain elements/sections displayed on an SAPUI5 apps. I was checking examples, e.g. intro.js and others (https://ourcodeworld.com/articles/read/328/top-10-best-tour-website-guide-javascript-and-jquery-plugins). How would this work with xml views? Anyone has an idea or can point me to a resource? thx
The UI5Lab community has a custom library for guided tours, see here.
This library uses UI5 controls, so you could either use this library for your project or check the source code for some ideas on how to implement a UI5 native tour yourself.

Perfect (Server-Side Swift) view engines

In NodeJS we have view engines (mustache, pug and etc.) and we can setup and use any of them. Does Perfect has any (default or installable) view engine with features like Layout Setting, Partial Views and other features?
I read about Perfect-Mustache in Perfect documentation, but I think it is not clarify how to use this, or how to separate views (.mustache or .html files) from other files, and how to render them.
There is an example to answer your question: Perfect-Blog-Mustache, a Perfect CMS demo:
https://github.com/PerfectExamples/Perfect-Blog-Mustache

Basics of XML view in SAPUI5

I've been studying sapui5 framework for some time now and I always used javascript views in my applications.
The question is - are there reasons why should I prefer xml views over javascript, if I should do it at all? If there are some, what are they?
If I want to start trying to write xml views, what is the best place to learn the basic syntax and where can I find API reference for controls created using xml? The SAPUI5 API is written for use with javascript.
Thanks.
Major reason, in my view, is strict separation of concerns. XML views, by their nature, preclude code. Your XML view is therefore strictly presentation logic - a great outcome for professional enterprise development. It also reduces the significant lines of code to code out the ui and thus improves readability and maintenance of code.
the reason I use XML views is because this is the standard approach of the Fiori apps by SAP. It creates a situation where developers only have 1 approach. Also to me they are easier readable.
Generally speaking I see that in the mobile library the xml views are used while in desktop usage js is still leading. On SCN you can find many similar questions.
The library of examples can be found in the same API page under tab EXPLORED.
Perhaps using the webIDE (which offers a local) install can provide a really good base for you to start development using xml based views.
Where you say the API is written for js views, this is true because the controls are written in JavaScript. Look at it this way if you have a namespace in your xml like xmlns:l="sap.ui.layout" any xml element prepended with l like <l:GridData ...
becomes a call to sap.ui.layout.GridData and if you look at the api for this control you can see what attributes you can add to this control / element.
Also if you have xmlns="sap.m" in your namespace block then anything like <Page /> <Table /> become sap.m.Page or sap.m.Table so the api is still a valuable resource and the explored section is great to see controls in action.

Tab UI in Android

I am an Android newbie and I really require your help.
I'd like to develop an app , which its UI is persisted of three Tabs, and the first one a WebView.
since I am not familiar with all the required building blocks, can anyone give me a sample? a guide how to do so?
thanks a lot!
The Android API Demos include several (Tabs1 to Tabs2 sample files) examples. Install, try and have a look at them.
Regarding specifying the content of Tabs you have the possibilities to use Views or Activities. If you check some "Tab" related discussion here you will find that established users prefer to use Views (e.g. here). I took the 'Activity' way so far and feel quite comfortable - but did not go to deep into pros and cons. My current point of view is that you have to decide on each special case and can't give a general recommendation.
there is some tutorials on this page : http://developer.android.com/resources/tutorials/views/index.html

iPhone Coverflow

I need to implement cover flow functionality to our iPhone application. I tried to find sample code online to get started with it, but I didn't have any luck. Can anyone tell me how to implement cover flow functionality or give me a sample?
Thanks In Advance!
Try FlowCover at
http://www.chaosinmotion.com/flowcover.m
the source code provides you with a FlowCoverView realizing the coverflow effect.
You simply need to customize a few delegate methods. Take a look at the example source code, customizing it to suit your needs should be straightforward.
You might also want to check out a library I released at iPhoneDevCamp -- OpenFlow. http://apparentlogic.com/openflow
It is all core animation-based, so it's easy to understand and customize to your needs. AFOpenFlowView is a subclass of UIView.
I included a demo application, and check out the blog entry on my personal website for a bit more information about its use. fajkowski.com
Drop me a line if you have any questions or comments!
-Alex
This one looks promising:
https://github.com/nicklockwood/iCarousel
Seems to be more actively maintained than the other two suggested above.