ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors
-
Upload
amis-friends-of-oracle-and-java -
Category
Technology
-
view
1.662 -
download
0
description
Transcript of ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors
![Page 1: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/1.jpg)
Luc Bors, june 2013, ODTUG KScope 2013 New Orleans
Best Practices for Developing Applications with Oracle ADF Mobile
Oracle ADF Mobile
![Page 2: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/2.jpg)
Who Am I
• Luc Bors
• Principal Consultant
• AMIS Nieuwegein Netherlands
• Friends of Oracle & Java
• 5 Oracle ACE(D)
• Oracle Partner
![Page 3: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/3.jpg)
ADF Mobile Overview
17 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Device Services
How It Works?
Phone Gap
Device Native Container Web View
Server HTML
ADF Mobile XML View
Java
Managed Beans
ADF Model
Third Party Web Sites
ADF Faces RC
ADF Mobile Browser
Mobile Device
Web Services (SOAP & REST)
Local HTML
HTML5 & JavaScript
Configuration Server
ADF Controller
Local'Data'
Credential M
anagement,
SSO &
Access C
ontrol
Application
Configuration
Server
![Page 4: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/4.jpg)
ADF mobile vs. Vanilla ADF
• The Obvious Differences
• The Annoying Differences
• The Not so Obvious Differences
• The Nice Differences
![Page 5: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/5.jpg)
The Obvious Differences
• Mobile
• Multiple Platforms
• Multiple Form Factors
• Touchscreens
![Page 6: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/6.jpg)
What Device are you on ?
• Device info
• Device Properties
![Page 7: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/7.jpg)
Work With Form Factors
• Respond to Form Factors • Conditionally Render Different content
![Page 8: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/8.jpg)
Demo
![Page 9: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/9.jpg)
Using the mouse for…..
• Clicking Menu Items • Clicking Links & Buttons • Expanding / Collapsing • Selecting / Deselecting
![Page 10: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/10.jpg)
Gesture Support
• You can configure Button, Link, and List Item components to react to the following gestures:
• Swipe to the right • Swipe to the left • Swipe up • Swipe down • Tap-and-hold
![Page 11: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/11.jpg)
Gesture examples
• The Swipe Gesture
• The Tap Gesture
<amx:actionListener binding="#{mybean.DoX}" type="swipeRight"/>
<amx:showPopupBehavior popupid="pop1" type="tapHold“ />
![Page 12: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/12.jpg)
![Page 13: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/13.jpg)
Annoying differences
![Page 14: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/14.jpg)
A simple calculator….
• In Vanilla ADF…… • InputText for Value • Autosubmit
• OutputText for Result • PartialTriggers
• Managed Bean • Holds the values
![Page 15: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/15.jpg)
This is annoying….
• ADF Mobile • Autosubmit and PartialTriggers does not exist !
• 2 Options
I. Use application Scoped Variables (no Coding) • Not meant for this purpose
II. Use the Property Change Listener Pattern
![Page 16: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/16.jpg)
PropertyChangeSupport
![Page 17: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/17.jpg)
![Page 18: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/18.jpg)
The not so obvious ones
• No menu structure….. • What about Application Start ? • What about Navigation ?
• No ADF Business Components • Now what ?
![Page 19: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/19.jpg)
Springboard & navigationbar
• Springboard configuration in adfmf-application.xml
![Page 20: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/20.jpg)
The Default Springboard
![Page 21: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/21.jpg)
The Custom SpringBoard
![Page 22: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/22.jpg)
Configuring the springboard
![Page 23: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/23.jpg)
![Page 24: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/24.jpg)
Using the Local Database
![Page 25: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/25.jpg)
Creating the Local Database
![Page 26: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/26.jpg)
Register Listener
![Page 27: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/27.jpg)
Using the POJO Datacontrol
![Page 28: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/28.jpg)
Talking to the DB (Select)
![Page 29: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/29.jpg)
Talking to the DB (DML…)
![Page 30: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/30.jpg)
![Page 31: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/31.jpg)
Using Webservices
• Create a Webserivce Datacontrol
![Page 32: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/32.jpg)
Using Webservices (1)
• Just drag & drop the method from the Data Control
![Page 33: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/33.jpg)
Using Webservices (1)
• The PageDefinition File
• The PageDefinition
![Page 34: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/34.jpg)
Using Webservices (2)
• Invoke directly from java. • Does not use the binding layer
• Uses Framework utilityMethod • AdfmfJavaUtilities.invokeDataControlMethod()
• Datacontrol must be in available in DataBindings.cpx
![Page 35: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/35.jpg)
Advice
• Do Not Hook Up Webservices Directly to Your Page
– Use Multiple Layers of Datacontrols For Abstraction
– You are in control
![Page 36: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/36.jpg)
Demo
![Page 37: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/37.jpg)
Use Caching
• By default the webservice will be called on every request
• Simply compare if what is in memory is the same as what needs to be shown.
if (!s_locationsList.isEmpty()){ MyLocation cur = (MyLocation)s_locationsList.get(0); Integer currentLoc = cur.getId(); if (currentLoc.compareTo(Integer.valueOf(<NEWVALUE>))!=0){ // clear cache callWebservice(); } }
![Page 38: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/38.jpg)
The return of the invokeAction
• The current row in ADF Mobile is not preserved across pages that bind to the same data collection
• Steps: – Inside the <amx:listItem> element of the list page, you need to add a
<amx:setPropertyListener> element to store the row key in a pageFlowScope variable.
– In the page definition of the detail page, you need to add a setCurrentRowWithKey action, which uses the pageFlowScope variable to set the current row.
– In the page definition of the detail page, you need to add an invokeAction executable for the setCurrentRowWithKey action to ensure the current row is automatically set when entering the detail page.
– http://www.ateam-oracle.com/adf-mobile-preserving-the-current-row-across-pages/
![Page 39: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/39.jpg)
The Nice Differences
• Device Interaction
• Thematic Maps
![Page 40: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/40.jpg)
Device Interaction
• The Device Datacontrol
• Drag n Drop support
• Attributes as fields
• Operations as buttons
![Page 41: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/41.jpg)
Camera interaction
• Take a picture ……………
• …… or get one from the Library
import oracle.adf.model.datacontrols.device; DeviceManagerFactory.getDeviceManager().getPicture(100, DeviceManager.CAMERA_DESTINATIONTYPE_FILE_URI, DeviceManager.CAMERA_SOURCETYPE_CAMERA, false, DeviceManager.CAMERA_ENCODINGTYPE_PNG, 0, 0);
DeviceManager.CAMERA_SOURCETYPE__PHOTOLIBRARY
![Page 42: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/42.jpg)
Be careful !!
• DESTINATIONTYPE_DATA_URL you will get the image as base64 encoded string
• Camera’s are very good. • Picture quality is amazing.
– Encoding such images as base64 causes memory issues
• Don’t blow up your app. – iOS you should set quality parameter to a value less then 50 to avoid – On Android out-of-memory can be caused with default image settings. Make
image smaller by setting targetWidth and targetHeight
![Page 43: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/43.jpg)
Demo
![Page 44: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/44.jpg)
I wish ADF could do this
![Page 45: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/45.jpg)
Custom Thematic Map
• Configuration File
• Custom Image
![Page 46: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/46.jpg)
Custom Thematic Map
![Page 47: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/47.jpg)
Custom Thematic Map
![Page 48: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/48.jpg)
Demo
![Page 49: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/49.jpg)
Summary
• Today was about differences • Know the differences • Know the ADF Mobile way to do it
• There are many parallels • Developing ‘feels’ like Vanilla ADF • Component Based Developement • ADF ‘like’ config files • DataControl / DataBinding
• My advise • Use ADF Mobile like ADF • Know The DataControl by heart • Know how to use Multiple (levels) of Datacontrols • Use Java; it is more flexible then declarative
![Page 50: ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile - Luc Bors](https://reader033.fdocuments.in/reader033/viewer/2022052820/54c0e7e94a79597d498b45de/html5/thumbnails/50.jpg)
Questions ?