adffacesmobile-140523055550-phpapp01

Upload: sachin-nag

Post on 01-Jun-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    1/51

    Running ADF Faces on

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.1

    Steven Davelaar

    ADF/Webcenter A-Team

    Oracle Corporation

    @stevendavelaar

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    2/51

    The following is intended to outline our general product

    direction. It is intended for information purposes only, andmay not be incorporated into any contract.

    It is not a commitment to deliver any material, code, or

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.2

    functionality, and should not be relied upon in makingpurchasing decisions. The development, release, and timing

    of any features or functionality described for Oracles

    products remains at the sole discretion of Oracle.

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    3/51

    Agenda

    UI Design for Tablets / Mobile Phones Introduction into Responsive Web Design

    Implementing Client-Side Responsive Web Design

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.3

    Implementing Server-Side Adaptive Web Design

    Using HTML 5 Input Types

    Mobile Device Integration

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    4/51

    UI Design for Tablets / Mobile Phones

    Understand the Mobile User Interface

    Touch screen instead of mouse

    No external keyboard

    Smaller screen size, portrait vs landscape mode

    Easy to Deal with From Technical Perspective

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.4

    Support touch gestures

    Use responsive web design to keep app usable with smaller screens

    Ignores Fundamental Differences in Usage

    Natural User Interface vs Graphical User Interface

    Check Out Oracle UX Patterns and Guidelines (See tomorrows sessions)

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    5/51

    Overview of Tablet and Phone Viewport Sizes

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.5

    http://i-skool.co.uk/mobile-development/web-design-for-mobiles-and-tablets-viewport-sizes/

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    6/51

    Introduction to Response Web Design (RWD)

    Wikipedia: RWD is aimed at crafting sites to provide

    an optimal viewing experience easy reading and navigation with a minimum of resizing, panning, and

    scrolling

    across a wide range of devices (from mobile phones to desktop computer

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.6

    monitorsAspects of RWD

    Fluid grids: sizing relative(%) rather than absolute (pixels, points)

    Media Queries: Use different CSS styles based on screen dimensions

    Flexible Images: Images that resize based on screen dimensions

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    7/51

    RWD in ADF Faces

    Use panelGroupLayout elements

    Set layout=vertical: generates simple HTML element

    Set styleClass property with width in percentage and float:left

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.7

    Change styleClass properties using media queries Define media queries in separate CSS file

    Media queries cannot be defined in skinning CSS file

    Do NOT use stretching layouts or panelGridLayout

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    8/51

    ADF Faces RWD Example

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.8

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    9/51

    ADF Faces RWD Example Media Queries

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.9

    Media queries can be defined in CSS skinning file as of JDev 12.1.3

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    10/51

    ADF Faces RWD Example Media Queries

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.10

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    11/51

    ADF Faces RWD Example in ActionMedia Query Breakpoints

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.11

    950px730px320px

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    12/51

    RWD Example in Action Width > 950px

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.12

    PanelForm 1 width: 50%

    PanelForm 2 and 3 width: 25%

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    13/51

    RWD Example in Action Width 730-950px

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.13

    PanelForm 1 width: 66%

    PanelForm 2 and 3 width: 33%

    (bug causes panel form 3 header to disappear)

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    14/51

    RWD Example in Action Width 320-730px

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.14

    PanelForm 1 width: 100%

    PanelForm 2 and 3 width: 50%

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    15/51

    RWD Example in Action Width < 320px

    PanelForm 1 width: 100%

    PanelForm 2 and 3 width: 100%

    Would be nice to lay out

    panelForm1 with 1 column instead

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.15

    of 2 Can be done using

    Window.matchMedia Listener

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    16/51

    RWD Example Window.matchMedia Listener

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.16

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    17/51

    RWD Example Window.matchMedia Listener

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.17

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    18/51

    RWD Example Window.matchMedia Listener

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.18

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    19/51

    Notes on Window.matchMedia Listeners

    Only supported by newer (IE) browsers (IE10+)

    Check out http://caniuse.com/#feat=matchmedia

    Requires client-side lookup of ADF Faces components

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.19

    Client Id can be difficult to derive when using nested naming containers There can be many components on many pages that need client-side

    manipulation

    Can result in ugly, large if-then-else Javascript methods

    Solution as of JDeveloper 12.1.2: clientListener type mediaEvent

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    20/51

    JDev 12.1.2 clientListener Type mediaEvent

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.20

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    21/51

    JDev 12.1.2 clientListener Type mediaEvent

    Clean component-specific methods, easy component lookup

    Requires complex generic JavaScript (not shown on slides)

    JavaScript code to invoke the method specified in clientListener must be

    written by you!

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.21

    Traverse complete component tree client-side

    Register each component with clientListener type mediaEvent

    Within each matchMedia listener method, loop over components and

    invoke the associated JS method using AdfCustomEvent.queue

    Will become completely declarative in JDev 12.1.4 New component tag for adding a media event behavior

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    22/51

    RWD Example Test On Phone / Tablet

    Initial page has unreadable small font

    RWD doesnt seem to work

    Screen readable after first user interaction

    Fix: add viewport metadata tag

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.22

    Google: don't forget the viewport meta tag

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    23/51

    Server-side Adaptive Design

    Client-side responsive design techniques are usually not enough for

    ADF Faces applications

    For more dramatic changes in layout, we need to go to the server

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.23

    Use EL in layout properties that reference screen dimensions Dynamic switching between page templates

    Traversing UI components tree to programmatically change layout

    Go to server on page load to communicate screen dimensions

    Go to server when device orientation changes

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    24/51

    Server-side Adaptive DesignGo to server on page load to communicate screen dimensions

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.24

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    25/51

    Server-side Adaptive DesignGo to server on page load to communicate screen dimensions

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.25

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    26/51

    Server-side Adaptive DesignGo to server on page load to communicate screen dimensions

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.26

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    27/51

    Server-side Adaptive DesignGo to server when device orientation changes

    Add call to callSetScreenSize in matchMedia listener method

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.27

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    28/51

    Obtaining Browser Agent Info at Server

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.28

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    29/51

    Convenience Methods in AgentInfoBean

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.29

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    30/51

    Dynamic Page TemplatesUse EL Expression in viewId property

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.30

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    31/51

    Dynamic Page Templates

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.31

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    32/51

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    33/51

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    34/51

    Changing UI Component Tree at RuntimeCalling MobileRenderingVisitCallBack From JSF Phase Listener

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.34

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    35/51

    Changing UI Component Tree at RuntimeRegister Phase Listener as Bean and Invoke From Page

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.35

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    36/51

    Changing UI Component Tree at RuntimeSetting PanelFormLayout Max Columns Server-Side

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.36

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    37/51

    Changing UI Component Tree at Runtime

    ADF Faces table scrollbars are automatically replaced with pagination

    controls on touch devices Pagination size controlled by fetchSize property (JDev 11.1.1.x) or

    autoHeightRows property (JDev 12.1.x)

    Fixing Table Pagination

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.37

    Number of rows visible on screen should match value of these

    properties

    If not, confusing user experience: both swiping and pagination needed

    when number of rows visible is lower

    JDev 12.1.3 will support tablet-optimized table scrolling Consider using listView instead of table component!

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    38/51

    Changing UI Component Tree at RuntimeFixing Table Pagination

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.38

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    39/51

    Changing UI Component Tree at RuntimeFixing Table Pagination

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.39

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    40/51

    Changing UI Component Tree at RuntimeHiding Surrounding Panel Collection

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.40

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    41/51

    Changing UI Component Tree at RuntimeHandling Wide Tables Move Items to Overflow Area

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.41

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    42/51

    HTML 5 Input Types

    New HTML 5 input types: color, date(time), email, month, number,

    range, search, tel, time, url, week

    These input types allow better input control and validation

    Can easily be used in ADF Faces though usage property

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.42

    Does NOT work in JDev 11.1.2.x, only 11.1.1.x and 12.1.x Specify as EL expression to prevent design-time error underlining

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    43/51

    HTML 5 Input Types

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.43

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    44/51

    HTML 5 Input TypesEnable By Changing Component Tree at Runtime

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.44

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    45/51

    Mobile Device Integration

    Integration with phone, contacts: af:goLink with tel: prefix

    Integration with mail: af:goLink with mailto: prefix

    Integration with Google Maps: af:goLink with google maps URL

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.45

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    46/51

    Mobile Device Integration

    Use JavaScript method to get current GPS coordinates navigator.geolocation.getCurrentPosition

    Use clientListener to invoke this JS method

    Using Current Location Information Server-Side

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.46

    Use serverListener to invoke managed bean with coordinates Queue ADF custom event in JS method

    Use dvt:map component to visualize current location

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    47/51

    Mobile Device IntegrationUsing Current Location Information Server-Side

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.47

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    48/51

    Mobile Device IntegrationUsing Current Location Information Server-Side

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.48

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    49/51

    JDeveloper 12.1.3 RWD Goodies

    New Tablet-First Page Template Optimized for tablet-landscape and desktop

    Client-side CSS rules

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.49

    ADF skinning framework now supports client side rules such as @charset,

    @document, @font-face, @import, @keyframes, @media, @page,

    @supports.

    Optimized table scrolling on tablets

    A.k.a. high water mark scrolling

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    50/51

  • 8/9/2019 adffacesmobile-140523055550-phpapp01

    51/51

    Copyright 2013, Oracle and/or its affiliates. All rights reserved.51