ADF Gold Nuggets (Oracle Open World 2011)


Published on

Gold Nuggets in ADF Faces

ADF Faces is a superior User Interface technology. Just look at Fusion Applications to confirm that statement. Or look at one of the hundreds of ADF applications deployed around the world. ACE Directors Chris Muir and Lucas Jellema draw from the experiences on many of these application to demonstrate a number of the most useful, productive, surprising, even amusing and sometimes quite obscure features in ADF Faces. To offer more insight in the richness of the ADF framework in general and also provide very concrete examples that will immediately help you add advanced functionality or benefit from increased productivity. Topics include task flows, push, desktop integration, event handling, reuse, change persistence, UI Shell and more.

value: - learn about tricks and useful features in ADF Faces that will enable attendees to enhance their ADF applications (in term of visual richness and functionality) and to increase their productivity and improve their development process - get inspired about ADF (Faces)

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Process
  • ADFBCGroovy, groovy, groovy.List validators die je definieert op view assessors. Bij een entityObjectAttribute Business rule kun je een Listvalidator baseren op een view accessor. Dit kan handig zijn.LibraryShared property voor EO's en VO's. In verband met ADF BC Libraries. Alleen de objecten met LibrarySharedproperty = true kunnen worden gebruikt in de projecten die deze library importeren. Default staat deze property op true, dus zullen alle objecten altijd zichtbaar zijn. Door selectiever gebruik te maken van deze property blijven je libraries schoner. ADFFACESIn ADF 11g-R2 heb je de activeRowKeyproperty. Deze stelt je in staat om in een tabel met de click to edit mode een rij programmatisch editable te maken (zonder te clicken). Als de rij niet zichtbaar is dan wordt hier automatisch naar toe gescrolled. Zie ook : ADF 11g-R2 heb je af:formatString en af:formatNamed. Daarmee kun je parameters (maximaal 4) gebruiken in EL expressies. formatString heeft 1 parameter, formatString2 heeft er 2, en zo verder tot formatString4. Hetzelfde geldt voor formatNamed; zie ook<af:outputText value="#{af:formatString('The current user is: {0}, someBean.currentUser)}" />
  • In ADF 11g-R2 heb je de activeRowKeyproperty. Deze stelt je in staat om in een tabel met de click to edit mode een rij programmatisch editable te maken (zonder te clicken). Als de rij niet zichtbaar is dan wordt hier automatisch naar toe gescrolled. Zie ook :
  • Some developers don't know the Completion Insight has 2 modes
  • Problem here is it hasn't filled in the left hand side of the assignment .... what types was it meant to return?In this examples it's easy to guess, but what if the function was declared in some other class? It's painful to have to navigate to that class and come back
  • Instead if the user presses Ctrl – Space twice
  • ....the Completion Insight changes modes
  • On selecting an entry, it will now do both sides of the expression+ bonus it completes the statement too with a semicolon
  • Push to the limit - rich and pro-active user interfaces with ADF Visual appeal and desktop-like reaction to user input were key elements in Web 2.0, powered by AJAX. The next generation user interface is active - presenting data and events in real time, driven by server push technology. This session demonstrates how ADF Active Data Service (ADS) and the BAM Data Control are leveraged to create an active UI. Messages arriving on JMS, through HTTP, from Complex Event Processing and from email servers are pushed to the browser, updating charts, tables and even causing popups to open. The session demonstrates a Chat implementation integrated in a Fusion Web application. It also shows how Database Query Result Change Notification and ADS allow events to be pushed from database all the way to user interface.Demo:
  • Even though we have a rich editor for business components, there are hidden properties only revealed in the Property InspectorThe highlighted option when used, with the ADF BC components are deployed as an ADF Library, if this is set to true, the component will not be available to the consuming application.
  • ViewObject for Candidate Managers (ViewCriteria with one bind parameter PartialName) Application Module Impl method (in Client Interface): findCandidateManagers(partialName) return row[]Action (Operation) Binding for that method in pageManaged bean that implements suggestions signature, executes operation binding and returns the results(pretty serious: database access after each key stroke!)
  • ADF Gold Nuggets (Oracle Open World 2011)

    1. 1. Gold Nuggets in Oracle ADF (Faces)<br />Lucas Jellema – AMIS (Nieuwegein, The Netherlands)<br />ADF EMG Community Day - Oracle Open World 2011<br />
    2. 2.
    3. 3. Overview<br />IDE favorites<br />Fool’s Gold<br />UI (tw)Highlights<br />The Whole Wide World<br />
    4. 4. What is a gold nugget?<br />Unexpected benefit<br />Underused, overlooked feature<br />Small – frequently useful<br />Huge – unexplored concept or area of infrastructure<br />Potentially useful to large community<br />Not too much a niche option<br />
    5. 5. Nugget cloud<br />Skin editor<br />VO Updateable Lookup<br />EL<br />Tree Select<br />Hot Reload<br />Change Persistence<br />Rich Table<br />Auto Suggest<br />Customization<br />setPropertyListener<br />Refresh after insert<br />PanelCollection<br />Decoupled Development & Reuse<br />TaskFlow, Region, UIShell, Declarative Components, ADF Library, …<br />Java/JEE<br />Bean Data Control<br />Popup<br />PPR<br />JHeadstart<br />Mobile<br />Fusion Applications<br />Groovy<br />EMG and wider community<br />server event & listener<br />Multi Browser Support<br />Selenium<br />so aDF<br />DVT<br />active rowkey<br />Programmatic VO<br />Active Data Service for Push<br />OraFormsFaces<br />PanelDashboard<br />List validator<br />prepareSession<br />ADFContext<br />Page Template<br />WebLogic Server<br />Save Points<br />FormatString<br />OPSS/ADF Security<br />
    6. 6. ADF in Larry’s Keynote on Oracle Open World 2009 and 2010<br />
    7. 7. Fusion Applications – biggest proof point in the world<br />
    8. 8. ADF powers the user interface of almost any Oracle product<br />
    9. 9. ADF powers the user interface of almost any Oracle product (2)<br />
    10. 10. the table<br />ADF Faces Rich Table (& Panel Collection)<br />Displays ADF Model data bound collection, bean array, List, ResultSet, RowSet and more <br />Dynamic Table Configuration & Change Persistence<br />Rearrange, resize, hide/show columns, freeze columns<br />Post-load or Lazy Data Fetch<br />Fetch data rows upon scroll<br />Filter & Sort<br />Read-Only and Click-to-edit<br />[single or multiple] Row and Column Selection<br />Header, Footer, Column Grouping, DetailStamp<br />Many, many predefined facets<br />Export data set, Email & Print mode<br />
    11. 11. Active row key<br />Property on table that is ‘click to edit’<br />EL expression that resolves to the primary key of the row that should be displayed as editable<br />Table will scroll that row into view<br />
    12. 12. "Smart" Completion Insight<br />Ctrl-Space (x 2)<br />
    13. 13. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />}<br />
    14. 14. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br /> }<br />}<br />
    15. 15. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br />this.<br /> }<br />}<br />Ctrl Space<br />
    16. 16. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br />this.<br /> }<br />}<br />
    17. 17. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br />this.getB<br /> }<br />}<br />
    18. 18. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br />this.getBookingView1Impl()<br /> }<br />}<br />
    19. 19. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br /> ? = this.getBookingView1Impl()<br /> }<br />}<br />Ctrl Space x 1<br />
    20. 20. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br />this.getB<br /> }<br />}<br />Ctrl Space x 1<br />Ctrl Space x 2<br />
    21. 21. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br />this.getB<br /> }<br />}<br />
    22. 22. publicclassAppModuleImplextendsApplicationModuleImpl {<br />publicBookingsViewImpl getBookingsView1() {<br />return (BookingsViewImpl)findViewObjects("BookingsView1");<br /> }<br />publicvoiddoSomething() {<br />BookingsViewImplbookingsView = this.getBookingsView1();<br /> }<br />}<br />
    23. 23. Jdeveloper Go to Shortcuts<br />Go to Class: CTRL -<br />Go to File: CTRL ALT -<br />Find usages: CTRL ALT u <br />For class, method, EO and VO Attribute, …<br />
    24. 24. More best short cuts…<br />CTRL Shift Space: parameter insight<br />CTRL = : list of recently opened files<br />CTRL Space: completion insight<br />CTRL Space (2x): declaration insert<br />CTRL /: selection commented<br />CTRL Shift C:copy file path toClipboard<br />Alt Home : selectfile in ‘tree’<br />
    25. 25. Data Visualization<br />
    26. 26. The Right Mouse Click<br />ContextMenu client listener and Popup (menu and window)<br />
    27. 27. Popup magic<br />
    28. 28. Example: Adding fancy balloon help<br />Create a popup with a noteWindow child to contain the fancy help content<br />Add a showPopupBehavior tag to the inputTextthat we want to add the help to<br />
    29. 29. Fusion Apps – ‘UI design pattern’<br />
    30. 30. Expression Language<br />IoC: Injection of Value and Listener into page<br />Dynamic, context sensitive behavior<br />Extension points<br />Custom Functions invoked from EL<br />Integration of Spring Beans<br />Custom EL Resolver<br />To resolve values from property files, ….<br />#{user.settings['NAME']}<br />
    31. 31. Extend EL to support custom functions with multiple parameters<br />Create the static methods that implement the custom EL functions<br />Configure <function> elements in a custom tag library descriptor<br />Associate the tag library to the JSF page<br />Use the function in expressions such as:<br />
    32. 32. Create the static methods<br />
    33. 33. Configure the function elements in a Tag Library Descriptor file<br />
    34. 34. Associate tag library with page and use tag library’s functions<br />
    35. 35. No coding quick start adf - leveraging best practices & uniform UI patterns<br />
    36. 36. Even more Declarative ADF development – with JHeadstart<br />
    37. 37. Programmatic cross tier interaction <br />Web Browser<br />JEE Application Server<br />
    38. 38. Client<br />JavaScript<br />Components<br />manipulate<br />component<br />user action<br />JavaScript Function<br />component<br />clientListener<br />component<br />userorprogrammaticaction<br />partialSubmitautoSubmit<br />Load JSON, CSS, Image, XML, JS<br />property change<br />Requestdata orPush message<br />poll<br />setPropertyListener<br />partial triggers, added targets<br />Queue Custom Event<br />serverListener<br />activeOutputText<br />ERKS ‘ppr script’<br />partial page refresh<br />Full pagereload<br />push<br />add JS toexecute (ERKS)<br />Server (middle tier)<br />component<br />activeOutputText<br />component<br />add componentsas partial target<br />actionListener, valueChangeListener, …Listener<br />Bean<br />serverListener<br />Active DataModel<br />Object<br />Components<br />Beans & Objects<br />push (DB QRCN)<br />Database<br />Client Server interactions vv.<br />
    39. 39. Use setPropertyListenerto push data to the server<br />The setPropertyListener will pass from value to the to target when type event occurs on parent<br />A very simple way to inform the server about an event and the data associated with the event<br />Supported types: action, focus, poll, query, rangeChange, selection, sort, rowDisclosure, valueChange and many more<br /><af:image id="removeFromSetImage“<br /> source="/images/removeFromSet.png“<br />shortDesc="Remove from Shopping Basket"/><br /><af:setPropertyListener from="#{item}“<br /> to="#{shoppingBasket.itemToRemove}"<br /> type="action"/><br /></af:commandLink><br />
    40. 40. ServerListener for custom AJAX (background client to server push)<br />A serverListener associates a server side method with a client side custom event<br />This allows JavaScript functionsto call a server side method by queuing an event<br />A custom event carries a payload<br />
    41. 41. ADF Active data service – server push to client<br />Push: server sends messages to client<br />ADF Active Data Service enables UI components to be ‘automaticallyrefreshed’ when server sideeventsoccur<br />Active UI ComponentsincludeTable, Image, OutputText, DVT Components<br />Basedon BAM Data Control<br />BasedonCustomBeansthatextendActiveAdapter<br />Nudge: push-to-refresh<br />Note: client-2-client pushcaneasilybeimplementedas client-to-server-followed-by-server-to-client push<br />Web Browser<br />JEE Application Server<br />
    42. 42. Auto-PPR for immediate refresh of Data Bound components<br />To have ADF automatically refresh data bound components when underlying value binding has changed its value<br />Set changeEventPolicy=ppr on iterator<br />Refresh as piggy back on any request cycle<br />No partialTriggers attribute required!<br />
    43. 43. Cross Tier Push<br />Web Browser<br />table<br />activeOT<br />Cache refresher<br />JEE Application Server<br />evtlsnr<br />servlet<br />RDBMS<br />job<br />trg<br />
    44. 44. Push to the limit – rich and pro-active user interfaces with ADF<br />Session Plug – Session Plug – Session Plug – Session Pl<br />Wednesday, 5-6 PM, Mariott Marquis, Golden Gate A <br />Oracle Open World 2011<br />
    45. 45. The “History” feature in JDeveloper<br />Quick comparison of file with previous states<br />Can leverage Source Code Control system (Subversion, CVS) but also maintains local file history<br />The compare feature is ‘XML aware’<br />Revert to a previous state of a file<br />
    46. 46. Marrying forms and ADF together – migrate with (i/o from) forms to adf<br />OraFormsFaces leveraging the JavaScript-Applet bridge for two-way event exchange<br />
    47. 47. ADF BC Properties<br />Property Inspector<br />
    48. 48. Library Private<br />
    49. 49. The World wide Advanced Developers Family<br />
    50. 50. The World wide Advanced Developers Family<br />ADF Enterprise Methodology Group<br />OTN Discussion Forum<br />OTN and ADF Resources<br />Documentation, samples, tutorials, testimonials, virtual developer days,<br />Blog-o-sphere<br />Conferences around the globe<br />OOW, ODTUG Kaleidoscope, UKOUG, OBUG, AUSOUG/OAUG/ODTUG 20:20, DOAG, …<br />Books and articles<br />Oracle Press, Packt Publishing, … <br />Oracle Magazine, ODTUG Technical Journal, …<br />Also: Leverage Java/JEE community and resources<br />
    51. 51. Java and JEE <br />ADF is a framework on top of Java, JEE and JVM<br />Anything that is/extends/runs on one of these is potentially usable with and relevant for ADF<br />Zillion frameworks and libraries<br />iText (PDF), Apache POI (Excel), Jasper Reports, BIRT<br />Spring (IoC, AOP, Acegi/Security, Social, ..)<br />Apache Commons, Google Collections, Joda Time<br />Software Engineering<br />Test (Junit, EasyMock), build (Ant, Maven), check/QA (FindBugs, CheckStyle, Sonar), <br />JEE facilities in WLS including JMS, WS* & RS, JMX… <br />Dynamic JVM languages: Groovy, Scala, JRuby, …<br />Java 7 SE and beyond<br />Java FX?<br />
    52. 52. Prepare session<br />Before any other database communication is performed during the processing of a request …<br />ADF BC will execute the prepareSession() method that you can override in ApplicationModuleImpl<br />This is the perfect place to<br />Reset package state<br />Set application and client info<br />Set application context<br />User details, current session context, view filter conditions(real or poor man VPD)<br />Fetch any events published inside the database<br />ADF BC<br />AppMod<br />Database<br />
    53. 53. Challenge<br />Create a Sliding Tile puzzle that tiles up an image in a configurable number of tiles<br />Using drag and drop, the user can reassemble the image<br />
    54. 54. The PanelDashboard component<br />Renders a ‘portal-like’ dashboard – as a grid of PanelBox-components<br />Configurable <br />number of columns<br />row height<br />Collapsible (boxes)<br />Supports drag & drop for reorganization<br />And change persistence to remember (per user)<br />Very easy to use<br />
    55. 55. Steps<br />Create Servlet that produces tiles from a JPEG image<br />Parameters: image name, tile factor, x and y<br />Create PanelDashboard with panelBoxes with richImage components<br />That request their source from the servlet corresponding to their position in the grid<br />Bind the PanelDashboard and dynamically create the panelBox components<br />Allow user to set the tile factor and choose the image<br />Use a Carousel for image selection<br />
    56. 56. demo<br />
    57. 57. EDN<br />SDO Entity<br />Task UI<br />EDN Events<br />SO ADF<br /><ul><li>EDN Events from ADF BC
    58. 58. BAM Data Control
    59. 59. Human Task UI
    60. 60. ADF BC SDO Service
    61. 61. WebService Proxy and Data Control</li></li></ul><li>ADF to SOA Interactions in FAPPS<br />Orchestration<br />Human interaction<br />Policy evaluation<br />Monitoring<br />Business Logic<br />View<br />Data<br />User Interface<br />ADF Faces components<br />Business Services<br />ADF Business Components<br />DatabaseSchema<br />Data<br />Binding<br />WebCenter<br />SDO Services<br />Events<br />Mediator /BPEL Process<br />Human WorkflowService<br />RulesEngine<br />Business<br />ActivityMonitoring<br />facts<br />Assign <br />Task<br />results<br />Task<br />Complete<br />
    62. 62. Programmatic View Object<br />It walks, talks and looks like a ‘regular’ View Object<br />(regular being based on Entity Objects or SQL Query)<br />But it is entirely fueled by custom written overridden Java methods – possibly without database connection<br />A bit like a View with Instead Of trigger – against a Collection based Table Function and PL/SQL API<br />Programmatic View Objects can be used as normal in a Data Control for binding ADF Faces components<br />Normal rich declarative ADF BC data binding can be provided to UI developers for data sources such as<br />WebService, JMS Queue, Memory Grid, Document Management System, Email, cross session data, …<br />Note: with the evolution of the Bean Data Control, some of the use cases will fade away<br />
    63. 63. the root of Ajax<br />Suggestions<br />
    64. 64. Auto Suggestions<br />User is entering a field<br />As she types characters, suggestions can be presented for what the full entry should read<br />Based on a list of allowable values, based on previous (popular) entries or anything really<br />User can pick a suggestion for ‘short-cut typing’<br />Auto suggestions can be model-driven (declarative) or custom<br />And can do things beyond plain list based suggestions<br />
    65. 65. Intro<br />Google Suggest set off the AJAX hype in anger<br />Many implementations for a ‘suggestions’ feature in ADF 10g and 11g have been created<br />Using custom JavaScript or libraries like Jquery<br />With PS1, ADF 11g introduced a native component for ‘auto suggestions’<br />The <af:autoSuggestBehavior> component, to be included in inputText or inputListOfValues orinputComboboxListOfValues<br />
    66. 66. Model Driven Suggestions<br />The suggestions can be derived declaratively from List of Values reference on a VO Attribute<br />Steps:<br />On ViewObject<br />Create ViewAccessor (for list values)<br />Create List of Values for Attribute<br />Link LoV to ViewAccessor<br />In Page<br />Add InputListOfValues component based on attribute<br />Add af:autoSuggestBehavior with suggestions based on List of Values Binding’s suggestedItems<br />
    67. 67.
    68. 68.
    69. 69. In Page:<br />
    70. 70. Custom Suggestions<br />Auto Suggestions can be provided by managed bean that implements signature: <br />List getSuggestions( String currentValue)<br />And the List returned is really List<SelectItem><br />Potential use cases<br />Based on some (application wide) cached collection (of previously entered ?) values<br />Retrieve values from WebService, file, …<br />Use common abbreviations, codes<br />Country code, airport<br />Show translations in other languages<br />
    71. 71. Static List of Countries<br />Suggestions<br />
    72. 72. Suggestions … or?<br />Suggested Values do not need to be suggestions in a very literal sense<br />What you see may not be what you get<br />The SelectItem as a label (WYS) and a value (ISWYG)<br />Examples:<br />Add words to field instead of replacing value<br />Perform selected operation on value<br />Show an updated indicator based on the value<br />
    73. 73. Mix Model Driven with Custom<br />Create a managed bean that accesses ViewObject to retrieve values<br />Use custom code to execute special queries using INSTR, LIKE or other conditions<br />Have managed bean return items to display in the list of suggestions<br />Based on special ordering or fuzzy logic, <br />Suggestions<br />
    74. 74. Candidate Managers filtered on First Name, Last Name & Job<br />Suggestions<br />
    75. 75. Underlying View Object<br />
    76. 76. Page template<br />Turns page layout inside out: <br />the page references the template<br />the page template determines the overall structure <br />the page provides the content for the designated areas in the template (through the facets)<br />Can be dynamically, context-sensitively selected using an EL expression<br />Can also be used for areas within a page<br />With multiple page templates used within the same page<br />More an area template than a page template to define UI Design Patterns<br />Tree-with-Detail-Form, Table-and-Chart, Master-Form-Detail-Table, Search block-Resultstable…<br />
    77. 77. Using multiple page templates<br />Two templates: mainpage and Table-Form template<br />
    78. 78. Other page consuming the template(s)<br />
    79. 79. Changing the micro-template<br />
    80. 80. Summary<br />Twinkle, twinkle little stars…<br />#1 nugget<br />#2 nugget<br />#3 nugget<br />Don’t give up [too soon]<br />There is more in ADF than meets the eye<br />There is a world of Java/JEE to leverage<br />There is a community to lean on<br />Scan release notes and monitor blog-o-sphere for valuable new (and re-discovered) nuggets<br />Share! Yes, you too! Your findings are just as valuable.<br />Participate in EMG and OTN Forum discussions, write blog articles, present in conferences, …<br />
    81. 81. Session Plugging<br />Tuesday – Reaching Out from PL/SQL (S08625 )10.15-11.15, Mariott Marquis, Salon 7<br />Tuesday – (JavaOne) Cross Tier Push Architecture (Don’t call us, we’ll push you) (S24722)4.30-5.15 PM, Hotel Nikko, Monterey I/II<br />Wednesday – Push to the Limit: Rich and Proactive User Interfaces with Oracle ADF (S08620)5-6 PM, Mariott Marquis, Golden Gate A<br />Thursday –Instant Agility in Oracle Fusion Middleware through Design Time @ Run Time (S08623)4-5 PM, Moscone West – 2020<br />