Myfacesplanet

1,520 views
1,445 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,520
On SlideShare
0
From Embeds
0
Number of Embeds
34
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Myfacesplanet

  1. 1. Apache MyFaces Planet Çağatay Çivici
  2. 2. About Me • Apache MyFaces PMC(Project Management Committee) member • Co-Author of “The Definitive Guide to Apache MyFaces and Facelets” from APRESS • Reference in “Core JavaServer Faces 2nd Edition” • Recognized speaker in international and local conferences • Oracle RCF(Rich Client Framework) member • Krank (CRUD Framework for JSF-Spring-JPA) member • Sourceforge jsf-comp member • Spring Security(Acegi) JSF Integration author • JSF Chart Creator project lead • FacesTrace project lead • YUI4JSF project lead • FC Barcelona Fan • Blog: http://www.prime.com.tr/cagataycivici • Prime Technology - 2008
  3. 3. RoadMap • History • Core – API – IMPL • Tomahawk • Tomahawk Sandbox • Trinidad • Tobago • Portlet Bridge • Orchestra • Future
  4. 4. History • Founders: Thomas Spiegl and Manfred Geiler • 2002 – sourceforge.net • 2003 – first stable release • 2004 – Moved to Apache Software Foundation • 40+ committers
  5. 5. Core Implementation • JSF1.1 (JSR-127) – API&Implementation • JSF1.2 (JSR-252) – API&Implementation • JSF 2.0 – Coming soon… • Certified against the Sun TCK to ensure compliance
  6. 6. Tomahawk • Extended versions of standard Components – <t:inputText />, <t:dataTable />, <t:selectItems /> etc… • Rich set of custom components – <t:schedule />, <t:inputDate />, <t:picklist /> etc… • Tiles support via JSPTilesViewHandler • Coolest sandbox project ever • Famous Extensions Filter
  7. 7. Tomahawk Demo
  8. 8. Tomahawk Sandbox • Test ground for promotion • Many custom components – AccordionPanel – Captcha – passwordStrength – clientSideValidation – Exporter(ActionListener) – PPR – Much more…
  9. 9. Tomahawk Sandbox Demo
  10. 10. Trinidad • ADF Faces Donation by Oracle • Suite with various components • PageFlowScope • Dialog Framework • Partial Page Rendering • Skinning • Client Side Validation & Conversion • Optimized State Management
  11. 11. Trinidad Component Demo
  12. 12. Trinidad - PageFlowScope • Pass data between pages • Multiple windows support • EL support: #{pageFlowScope.something} • Not a valid managed-bean scope • Clear manually RequestContext requestContext = RequestContext.getCurrentInstance(); requestContext.getPageFlowScope().put(quot;someKeyquot;, someValue);
  13. 13. Trinidad - PPR • Built-in Ajax Support
  14. 14. Trinidad – PPR • partialSubmit and partialTriggers <tr:commandButton id=“btn” text=“Incrementquot; partialSubmit=quot;truequot; actionListener=quot;#{backingBean.increment}quot;/> <tr:outputText value=quot;#{backingBean.number}quot; partialTriggers=“btnquot;/> public void increment(ActionEvent event) { number++; }
  15. 15. Trinidad - PPR • tr:poll <tr:poll pollListener=quot;#{backingBean.onPoll}quot; interval=quot;2000quot; id=“pollquot; /> <tr:outputText value=quot;#{backingBean.number}quot; partialTriggers=“pollquot;/> public void onPoll(PollEvent pollEvent) { number ++; }
  16. 16. Trinidad - PPR • <tr:statusIndicator /> • PPR Javascript API • PPR API for custom component development
  17. 17. Trinidad – Dialog Framework • Get data from a popup window(dialog) pageThatLaunchesDialog.xhtml <tr:commandButton text=“Select Employeequot; action=quot;dialog:selectEmployee“ useWindow=“true” partialSubmit=“true” returnListener=quot;#{backingBean.handleReturn}” /> Navigate to Dialog PageThatLaunchesDialog.java <navigation-rule> public void handleReturn(ReturnEvent event) { <from-view-id>/*</from-view-id> Object returnedValue = event.getReturnValue(); <navigation-case> } <from-outcome>dialog:showDetail</from-outcome> <to-view-id>/showDetail.jspx</to-view-id> </navigation-case> </navigation-rule>
  18. 18. Trinidad – Dialog Framework • Dialog itself SelectEmployee.xhtml … … … <tr:commandButton action=“#{selectEmployeeBean.handleSelect}” /> … … … SelectEmployee.java public void handleSelect() { Employee employee = getSelectEmployee(); RequestContext.getCurrentInstance().returnFromDialog(employee, null); }
  19. 19. Trinidad – Dialog Framework • Passing data <tr:commandButton text=“Select Employeequot; action=quot;dialog:selectEmployee“ useWindow=“true” partialSubmit=“true” returnListener=quot;#{backingBean.handleReturn}” launchListener=“#{backingBean.handleLaunch}”/> public void handleLaunch(LaunchEvent event) { event.getDialogParameters().put(“departmentquot;, getDepartment()); } • Use pageFlowScope to get the passed data
  20. 20. Trinidad – Dialog Framework • <tr:inputListOfValues /> <tr:inputListOfValues label=“…quot; value=“#{backingBean.employee}quot; action=quot;dialog:selectEmployeequot; windowWidth=“400quot; windowHeight=“300quot;/>
  21. 21. Trinidad - Skinning • Each component is skinnable (selectors) • Switch skins dynamically • Not just CSS
  22. 22. Trinidad – Create a Skin • Create trinidad-skins.xml • Create the CSS itself • Configure in trinidad-config.xml
  23. 23. Trinidad – Create a skin • trinidad-skins.xml <?xml version=quot;1.0quot; encoding=quot;ISO-8859-1quot;?> <skins xmlns=quot;http://myfaces.apache.org/trinidad/skinquot;> <skin> <id>aqua.desktop</id> <family>aqua</family> <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id> <style-sheet-name>skins/aqua/aqua.css</style-sheet-name> <extends>xyz</extends> <bundle-name> org.apache.myfaces.trinidaddemo.resource.SkinBundle </bundle-name> </skin> </skins>
  24. 24. Trinidad – Create a skin • aqua.css body { background-color: aqua } .AFDefaultFontFamily:alias { font-family: cursive; } .AFDefaultFont:alias { font-size: 14px } af|inputDate::launch-icon { content: url(/images/calendar/calendar_icon.gif); } af|inputNumberSpinbox::content { -tr-inhibit: all; }
  25. 25. Trinidad – Create a skin • trinidad-config.xml <?xml version=quot;1.0quot;?> <trinidad-config xmlns=quot;http://myfaces.apache.org/trinidad/configquot;> <skin-family>aqua</skin-family> </trinidad-config>
  26. 26. Trinidad - Skinning • Switch skin at runtime <?xml version=quot;1.0quot;?> <trinidad-config xmlns=quot;http://myfaces.apache.org/trinidad/configquot;> <skin-family>#{userPreferences.skinName}</skin-family> </trinidad-config>
  27. 27. Trinidad - Skinning • Not just CSS @platform windows, linux { @agent ie, gecko { af|inputDate::title { background-color: purple; } } @agent mozilla { af|inputDate::title { background-color: yellow; } } }
  28. 28. Trinidad – Client Side Validation&Conversion • Client side API for validation&conversion – function TrConverter() { } – TrConverter.prototype.getAsString = function(value, label){} – TrConverter.prototype.getAsObject = function(value, label){} – function TrValidator() – TrValidator.prototype.validate=function(value, label, converter){} – function TrFacesMessage( summary, detail, severity )
  29. 29. Trinidad – Create your own • ClientValidator and ClientConverter interfaces – getClientConversion(FacesContext facesContext, UIComponent component) – getClientImportNames – getClientLibraryResource – getClientScript(FacesContext facesContext, UIComponent component)
  30. 30. Trinidad – CreditCardValidator.js CreditCardValidator = function() {} CreditCardValidator.prototype = new TrValidator(); CreditCardValidator.prototype.validate = function(value, label, converter) { … if(valueIsInvalid) { var facesMessage = new TrFacesMessage (TrFacesMessage.SEVERITY_ERROR,quot;Validation Errorquot;,“CC is not validquot;); throw new TrValidatorException(facesMessage); } }
  31. 31. Tobago • Various components • Layout Manager • Skinning
  32. 32. Tobago Demo
  33. 33. Portlet Bridge • Develop portlets with JSF • RI of JSR-301(Portlet Bridge for JSF) • Adresses Portlet-1.0 and Portlet-2.0 specs
  34. 34. Portlet Bridge Demo • Apache MyFaces 1.2.3 • Pluto 1.1.6 • Tomcat 6 • MyFaces Portlet Bridge 1.0.0-alpha 2
  35. 35. Orchestra • Spring based • Long unit of work • Conversation Scopes Access – Manual • Conversation scoped persistence-contexts – No more Lazy exceptions • DynaForm • ViewController • Multiple window support • Persistence Context per Conversation
  36. 36. Orchestra Scopes Manual Conversation Access Conversation
  37. 37. Orchestra Scopes • @Component(“customerController”) @Scope(“conversation.access” or “conversation.manual”) public class CustomerController { … } • Reference as; • <h:inputText value=“#{customerController.customer.name}” />
  38. 38. Persistence Support
  39. 39. Orchestra - ViewController • @ViewController(viewIds={“createCustomer.jsp”}) public class MultiViewController { } • @initView – after RESTORE_VIEW • @preProcess – after INVOKE_APPLICATION • @preRenderView – before RENDER_RESPONSE
  40. 40. Orchestra Demo
  41. 41. IDE Support • Eclipse Ganymede – Trinidad • JDeveloper – Trinidad • JBoss Tools (limited) – Trinidad, Tomahawk, Tobago
  42. 42. Help and Support • Mailing List: – users@myfaces.apache.org – Archieved at nabble, mail-archieve • Issue Tracking: JIRA • Wiki – http://wiki.apache.org/myfaces/
  43. 43. Future of MyFaces • MyFaces 2.0 (JSF 2.0 Implementation) • Oracle RCF Donation • Richer…
  44. 44. The Definitive Guide
  45. 45. The End • cagatay@apache.org • http://www.prime.com.tr/cagataycivici • PlayStation3 online id: facescontext

×