Trinidad in Action

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    Trinidad in Action - Presentation Transcript

    1. Apache MyFaces Trinidad in Action Matthias Wessendorf | matzew@apache.org http://matthiaswessendorf.wordpress.com http://twitter.com/mwessendorf
    2. Matthias Wessendorf
      • Oracle Corporation
      • Apache Software Foundation
        • ASF Member
        • Committer and PMC @Apache MyFaces
        • Committer and PMC @Apache Shale
      • Author
        • (German) Java- and Eclipse-Magazine
        • Books on Struts, J2ME & WebServices
      • Speaker
        • Oracle Open World
        • ApacheCon
        • JavaOne
        • JAX, WJAX
    3. Agenda
      • Background
      • Introduction
      • Ajax Integration
      • Components in Action
      • Skinning Framework
      • Mobile Web
      • Roadmap
    4. Agenda
      • Background
      • Introduction
      • Ajax Integration
      • Components in Action
      • Skinning Framework
      • Mobile Web
      • Roadmap
    5. Background I
      • Donated to Apache by Oracle in 2006
        • Something between 10g and 11g
        • Has already some „11g“ APIs...
      • Contains more than 100 JSF components
        • Ajax-enabled JSF components
          • Tree-Navigation
        • Helpers (e.g. Extra converters and validators)
      • Ajax is first class citizens
        • Mother of PPR (Partial Page Rendering) 
        • Ajax support since UIX days !
      • Ajax-API
        • Client (JavaScript)
        • Server (Java)
    6. Background II
      • Trinidad is a framework
        • Several framework bits
          • Skinning
          • Ajax API
          • Maven2 Plugins
      • Used as base for:
        • ADF Faces R ich C lient F ramework
        • ADF mobile
      • Stable library
        • JSF 1.2 support
        • JSF 1.1 support
    7. Agenda
      • Background
      • Introduction
      • Ajax Integration
      • Components in Action
      • Skinning Framework
      • Mobile Web
      • Roadmap
    8. Introduction
      • The component show...
      • Online Demo available on:
      • http://www.irian.at
    9. Agenda
      • Background
      • Introduction
      • Ajax Integration
      • Components in Action
      • Skinning Framework
      • Mobile Web
      • Roadmap
    10. Ajax I
      • PPR  Partial Page Rendering
      • Ajax/PPR for free *
        • autoSubmit
        • partialSubmit
        • partialTriggers
      • X ml H ttp R equest-based communication channel
        • <iframe> used for upload
          • no extra steps required...
      • Clean Ajax API
        • server-side
        • client
      * almost
    11. Ajax – Demo I
      • declarative view:
      • ...
      • <tr:selectOneRadio value=&quot;#{partialBean.selectOne}&quot; autoSubmit=&quot;true&quot; id=&quot; select1 &quot;>
      • <tr:selectItem label=&quot;East&quot; value=&quot;NYC&quot;/>
      • <tr:selectItem label=&quot;West&quot; value=&quot;San Jose&quot;/>
      • </tr:selectOneRadio>
      • <tr:outputText id=&quot;out&quot; value=&quot;#{partialBean.selectOne}&quot;
      • partialTriggers=&quot; select1 &quot;/>
      • ...
    12. Ajax – Demo I
    13. Ajax – Demo I
    14. Ajax II
      • Programmatic „update“ of Components
        • No partialTriggers attribute (non-Trinidad components)
        • Not always willing to update (based on conditions)
        • „ dynamic“ update of a component
      • Java-API
        • RequestContext.addPartialTarget(UIComponent target);
      • Other use-cases:
        • Custom Component (not extending UIXComponentBase class)
          • decode(): rc.addPartialTriggerListeners(...);
          • broadcast(): rc.partialUpdateNotify(...);
    15. Ajax – Demo II
      • declarative view:
      • <tr:commandButton text=&quot;refresh&quot; partialSubmit=&quot;true&quot; action=&quot;#{create.updatePage}&quot; />
      • < h:outputText id=&quot; status &quot; value=&quot; some value... &quot; />
      • From a JavaBean:
      • public String updatePage()
      • {
      • FacesContext ctx = FacesContext.getCurrentInstance();
      • UIComponent comp = ctx.getViewRoot(). findComponent(&quot; status &quot;) ;
      • ((ValueHolder) comp).setValue(&quot;updated by Java-API&quot;) ;
      • RequestContext rc = RequestContext.getCurrentInstance();
      • rc.addPartialTarget(comp) ;
      • ...
    16. Ajax III
      • Sending a PPR request
        • Useful when creating custom Trinidad components
        • TrPage.sendPartialFormPost(formElement, params, headers);
      • Sending an Ajax request
        • Useful when not interested in a postback / JSF lifecycle
        • TrRequestQueue.sendRequest(context, callback, url);
      • Monitoring Ajax and PPR requests
        • TrRequestQueue.addStateChangeListener(callback);
      • Monitoring DOM replacement (after Ajax response)
        • TrPage.getInstance().addDomReplaceListener(myCallback);
        • function myCallback(oldDom, newDom)
        • { ...}
    17. Ajax – Demo III
      • Sending an Ajax request:
        • var queue = TrPage.getInstance().getRequestQueue();
        • queue .sendRequest(null, this.myCallback, &quot;http://localhost:9090/ jsonDataServlet ?foo=bar&quot;);
      • The callback function:
        • function myCallback(event)
        • {
        • if(event.getStatus() == TrXMLRequestEvent .STATUS_COMPLETE )
        • {
        • ...
        • }
        • ...
    18. Ajax – Demo VI
      • Monitoring Ajax and PPR requests :
        • function addListener()
      • {
      • var requestQueue = TrPage.getInstance().getRequestQueue();
      • requestQueue.addStateChangeListener(myCallback);
      • }
      • The callback function:
        • function myCallback(state)
        • {
        • var busy = state == TrRequestQueue.STATE_BUSY;
        • var div = document.getElementById(&quot;load&quot;);
        • div.style.display = busy ? &quot;inline&quot; : &quot;none&quot;;
        • }
      • The DIV-Element:
        • <div id=&quot;load&quot; style=&quot;display: none; background-color: red;...&quot;> LOADING...
        • </div>
    19. Ajax IV
      • ExtendedRenderKitService
        • Calling JavaScript from the Server...
      • declarative view:
        • <tr:commandButton text=&quot;Create&quot; action=&quot;#{ create.method }&quot;/>
      • JavaBean:
        • public String method()
        • {
        • ...
        • FacesContext context = FacesContext.getCurrentInstance();
        • ExtendedRenderKitService erks =
        • Service.getRenderKitService(context,
        • ExtendedRenderKitService.class);
        • erks.addScript (context,
        • &quot;hello('&quot; +  JavaScript function
        • user.getName() +
        • &quot;');&quot;);
        • return (&quot;success&quot;);
        • }
    20. Ajax – Demo V
    21. Agenda
      • Background
      • Introduction
      • Ajax Integration
      • Components in Action
      • Skinning Framework
      • Mobile Web
      • Roadmap
    22. Components – structured data
      • JSF has no tree component
      • JSF has a simple table component / model
        • Class  javax.faces.component.UIData
        • Class  javax.faces.model.DataModel
        • No build-in scrolling, selection
        • matches HTML 4.0.1
      • Trinidad extends the DataModel class:
        • oam.trinidad.model. CollectionModel
        • |_ oam.trinidad.model. SortableModel
        • |_ oam.trinidad.model. TreeModel
        • |_ oam.trinidad.model. ChildPropertyTreeModel
      • Components for „structured data“:
        • <tr:table>
        • <tr:iterator>
        • <tr:tree> and <tr:treeTable>
    23. Components – <tr:table>
      • Pimp up my table
        • Paging  rows (default 25 rows)
        • Section  rowSelection ( none , single, multiple);
          • UIXTable.getSelectedRowKeys()
          • UIXCollection: setRowKey() and getRowData()
        • Sorting  sortable/sortProperty (on <tr:column> )
        • details  detailStamp facet
      • Ajax integrated
        • Sort
        • Paging
        • details
      • Look-and-feel changeable
        • via Skinning facility
    24. Components – <tr:table>
      • A table with scrolling and sorting:
      • <tr:table id=&quot;friends&quot; value=&quot;#{container.friends}„ var=&quot;friend&quot; rows=&quot;5&quot; >
      • <tr:column headerText =&quot;Firstname&quot; sortProperty =&quot;firstName&quot; sortable =&quot;true&quot;>
      • <tr:outputText value=&quot;#{friend.firstName}&quot; />
      • </tr:column>
      • ...
      • </tr:table>
    25. Components – <tr:table>
    26. Components – <tr:table>
    27. Components – <tr:table>
      • Show some details for a row:
      • <tr:table var=&quot;friend&quot; ...>
      • <tr:column ...>
      • ...
      • </tr:column>
      • <f:facet name=&quot;detailStamp&quot; >
      • <tr:panelGroupLayout layout=&quot;vertical&quot; >
      • <tr:outputText value=&quot;Street: #{friend.address.street}&quot;/>
      • <tr:outputText value=&quot;ZIP Code: #{friend.address.zip}&quot;/>
      • ...
      • </tr:panelGroupLayout>
      • </f:facet>
      • </tr:table>
    28. Components – <tr:table>
    29. Components – <tr:tree>
      • Uses TreeModel class
        • „ ChildPropertyTreeModel“ for convenience
      • declarative view:
      • <tr:tree var=&quot;node&quot; value=&quot;#{container.model}&quot;>
      • <f:facet name=&quot;nodeStamp&quot;>
      • <tr:outputText value=&quot;#{node.name}&quot;/>
      • </f:facet>
      • </tr:tree>
    30. Components – <tr:tree>
      • Person john = new Person(&quot;John Smith&quot;);
      • Person kim = new Person(&quot;Kim Smith&quot;);
      • Person tom = new Person(&quot;Tom Smith&quot;);
      • Person ira = new Person(&quot;Ira Wickrememsinghe&quot;);
      • Person mallika = new Person(&quot;Mallika Wickremesinghe&quot;);
      • john. getKids ().add(kim);
      • john.getKids().add(tom);
      • ira .getKids().add( mallika );
      • // create the list of root nodes:
      • List people = new ArrayList();
      • people.add( john );
      • people.add( ira );
      • TreeModel model = new ChildPropertyTreeModel (people, &quot; kids &quot;);
    31. Components – <tr:tree>
    32. Components – <tr:chart>
      • Multiple types: pie, horizontalBar, area, ...
      • Requires a ChartModel impl
      http://matthiaswessendorf.wordpress.com/2008/10/11/nice-charts-with-trinidad/
    33. Agenda
      • Background
      • Introduction
      • Ajax Integration
      • Components in Action
      • Skinning Framework
      • Mobile Web
      • Roadmap
    34. Skinning
      • Customizable look and feel
        • portable across applications
        • zero code
      • CSS 3.0 syntax
      • Component-centric, not DOM-centric
        • components have different “areas”
      launch-icon content label
    35. Skinning
      • Pseudo-elements
        • af|component::area { … }
      • Create a CSS File, and register it:
        • trinidad-skins.xml (define a skin, and link to the CSS file)
        • trinidad-config.xml (link to the particular Skin)
      • A Skinning-CSS-file:
      • .AFRequiredIconStyle
      • {
      • color: #CC0000;
      • -tr-rule-ref: selector(&quot;.AFDefaultFont:alias&quot;);
      • }
      • af|inputDate::launch-icon
      • {content: url(/images/calendar_icon.gif); }
      • af|inputDate::label
      • { ... }
    36. Agenda
      • Background
      • Introduction
      • Ajax Integration
      • Components in Action
      • Skinning Framework
      • Mobile Web
      • Roadmap
    37. Mobile Web 2.0
      • Mobile Web is old
        • Never really took off...
        • Modern devices (Android, iPhone, black-berry) bring back hype
      • Trinidad hides limitations or capabilities of different browsers
      • (some) supported Devices
        • Microsoft Windows Mobile 5 and 6, Microsoft Pocket Internet Explorer
        • Symbian S60 devices
        • Apple iPhone
        • RIM BlackBerry Browser 4.6
        • RIM BlackBerry Browser 4.7
        • Android Based Phones
        • WAP 2.0 phones (XHTML Basic or XHTML MP)
          • Nokia S40 Phone Browser
          • Opera Mini Browser
    38. Mobile Web 2.0
      • Working with native device services
        • Phone
          • tel:  <tr:goLink destination= &quot; tel: #{customer.phone}&quot; />
        • Email
          • mailto:  <tr:goLink destination= &quot; mailto :#{customer.mail}&quot; />
        • Google Maps
          • http://maps.google.com/maps?q=<Address_Field>
          • http://maps.google.com/maps? saddr =<Start_Address> & daddr =<Address_Field>
      • Create a Skin
        • Best is one skinning file for each device
          • Android or iPhone
    39. Mobile Web 2.0 – iPhone
      • Navigation Bar:
      • <tr:panelHeader text=&quot; Details &quot; styleClass=&quot;toolbar&quot; rendered=&quot;true&quot;>
      • <tr:commandLink text=&quot; Intro &quot; styleClass=&quot;backButton&quot; disabled=&quot;false&quot;
      • rendered=&quot;true&quot; action=&quot;backtoIntro&quot;/>
      • <tr:commandLink text=&quot; Agent &quot; styleClass=&quot;button&quot; disabled=&quot;false&quot; rendered=&quot;true&quot; action=&quot;toAgent&quot;/>
      • </tr:panelHeader>
    40. Mobile Web 2.0 – iPhone
      • Navigation Panel Lists:
    41. Mobile Web 2.0 – iPhone
      • Field Set Panel:
    42. Agenda
      • Background
      • Introduction
      • Ajax Integration
      • Components in Action
      • Skinning Framework
      • Mobile Web
      • Roadmap
    43. Roadmap
      • Trinidad 1.2.x  trunk
      • Trinidad 1.0.x  only maintenance releases
      • JSF 2.0
        • Integration of APIs for JSF 2.0
        • pimp up the components
        • Trinidad 2.0
      • Skinning
        • Trinidad does (currently) not look sexy
        • new, modern skin
      • Bayeux support ?
        • Perhaps, but will be generic and based on Servlet 3.0
    44. Questions
      • and (maybe) answers
    45. Links and Resources
      • Apache MyFaces Trinidad
        • http://myfaces.apache.org/trinidad
      • Trinidad in Action
        • http://jsfcentral.com
      • Oracle ADF mobile
        • http://www.oracle.com/technology/tech/wireless/adf_mobile.html
      • Oracle ADF Faces
        • http://www.oracle.com/technology/products/adf/adffaces/index.html
        • http://tinyurl.com/adf-faces-live
      • Slides:
        • http://www.slideshare.net/mwessendorf
    46. Thank you! [email_address] BLOG: matthiaswessendorf.wordpress.com

    + mwessendorfmwessendorf, 7 months ago

    custom

    1348 views, 1 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1348
      • 1348 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories