Trifork Group Ag · OMXCOP:TRIFOR

Trifork — Technical Presentation (2010)

29 slides from Trifork's technical presentation, Sep 23, 2010

  1. Slide 1: Apache Wicket

    Apache Wicket Niels Sthen Hansen Trifork Projects Copenhagen A/S [email protected]

  2. Slide 2: Apache Wicket

    Apache Wicket ● The Wicket approach ● Brief tour of key Wicket concepts ● Lots of code examples! ● Hello World'ish snippets ● Samples from a real­life Wicket app ● Thoughts on modelling & design, productivity and maintainability

  3. Slide 3: About Us

    About Us ● Trifork A/S ● Finance ● Public ● Academy ● 110+ employees in Århus, Copenhagen & Zürich ● Niels Sthen Hansen ● Java technology since 2002 ● Trifork Projects Copenhagen A/S

  4. Slide 4: Todays Real-life Wicket App

    Todays Real­life Wicket App ● The Lessor Portal ● Allows employees to register payroll­related data on­line and to access personal information ● Integrates to 5 (and counting) payroll­systems ● Denmark, Norway and Germany ● Lessor A/S ● Payroll and HR systems ● Large and growing market share

  5. Slide 5: Example

    Example ● The Lessor Portal ● Absence registration approval

  6. Slide 6: Web Applications

    Web Applications ● More mission critical than ever ● Time­to­market is crucial ● ... and so is maintainability ● Users have come to expect more from wepapps ● More functionality ● More responsive (less page reloads) ● Why can't all webapps be like, say, gmail ?

  7. Slide 7: Web Application Frameworks

    Web Application Frameworks Echo Cocoon Millstone OXF Struts SOFIA Tapestry WebWork RIFE Spring MVCCanyamo Maverick JPublish JATO Folium Jucas Verge Niggle Bishop Barracuda Action Framework Shocks TeaServlet wingS Expresso Bento jStatemachine jZonic OpenEmcee Turbine Scope WarfareJWAA Jaffa Jacquard

  8. Slide 8: Wicket Design Goals

    Wicket Design Goals ● Easy (simple / consistent / obvious) ● Reusable ● Non­intrusive ● Safe ● Efficient / scalable ● Complete

  9. Slide 9: Goal: Simple/Consistent/Obvious

    Goal: Simple/Consistent/Obvious ● POJO­centric ● All code written in Java ala Swing ● Avoid overuse of XML configuration files ● Fully solve back button problem ● Easy to create bookmarkable pages ● Maximum type safety, compile­time diagnosis ● Maximum diagnosis of run­time problem

  10. Slide 10: Goal: Non-intrusive

    Goal: Non­intrusive ● HTML or other markup not polluted with programming semantics ● Only one simple tagging construct in markup ● Compatible with any ordinary HTML editor ● Easy for graphics designers to recognize and avoid framework tagging ● Easy to add tagging back to HTML if designers accidenta

  11. Slide 11: Goal: Safe, Efficient/Scalable

    Goal: Safe, Efficient/Scalable ● Only explicitly bookmarkable links can expose state in the page or URL ● All logic in Java with maximum type safety ● Easy to integrate with Java security ● Efficient & lightweight, but not at the expense of other goals ● Clustering through sticky sessions preferred

  12. Slide 12: Example: Hello Wicket World

    Example: Hello Wicket World mvn archetype:create ­DarchetypeGroupId=org.apache.wicket ­DarchetypeArtifactId=wicket­archetype­quickstart ­DarchetypeVersion=1.4.8 ­DgroupId=com.trifork ­DartifactId=hello import import org.apache.wicket.markup.html.WebPage; org.apache.wicket.markup.html.WebPage; import

  13. Slide 13: Wicket Application & Life-cycle

    Wicket Application & Life­cycle ● Application ● Defines (surprise) application­wide settings ● Wicket Session ● Are created on first request and exists for the duration of the HTTP session ● Can be subclassed (Example: PortalSession) ● RequestCycle ● Handles request, holds information on HTTP reques

  14. Slide 14: Wicket Components

    Wicket Components public public abstract abstract class class Component Component implements implements ... ... {{ ... ... protected protected final final void void renderComponentTag(ComponentTag renderComponentTag(ComponentTag tag) tag) {{ ... ... }} protected protected final final void void repla

  15. Slide 15: Wicket Components

    Wicket Components ● Are Java classes ● Extends other components and can be extended themselves ● Defines HTML mark­up ● In file ComponentClassName.html ● ... or inherit from superclass ● ... or both!

  16. Slide 16: Wicket MarkupContainers

    Wicket MarkupContainers ● A class hierachy of Components ● Can contain other components ● Also other containers ● When rendered, all child­components are also rendered ● Example: ● Panels

  17. Slide 17: EJB & Spring Integration

    EJB & Spring Integration ● @SpringBean ● @EJB ● Example: ● Spring

  18. Slide 18: Localization

    Localization ● StringResourceModel ● Looks up in resource files on­demand ● It is possible to override resource lookup ● Example: Lessor Portal Localization

  19. Slide 19: Some HTML Tags & Attributes

    Some HTML Tags & Attributes ● Attribute wicket:id ● Attribute wicket:message="attr:resource_id" ● <input type="submit" wicket:message="value:page.search"/> ● <wicket:link> ● <wicket:panel> ● <wicket:extend> and <wicket:child> ● <wicket:remove> ● <wicket:enclosure>

  20. Slide 20: RepeatingViews and ListViews

    RepeatingViews and ListViews ● Names are pretty self­explanatory ● For table rows, bullet lists etc. etc. ... ● ListView when a list is available ● RepeatingView just needs a loop ● Examples: Calendar

  21. Slide 21: Wicket Pages

    Wicket Pages ● Pages are Components ● Pages are also MarkupContainers ● Wicket keeps pages in a PageMap ● To handle that annoying back­button ● Watch your session size! ● Certain default pages can be specified ● Home page ● Error page ● Page to show when session is expired

  22. Slide 22: Behaviors

    Behaviors ● Implements IBehavior ● Are added to Components ● Modifies the Components .. well, behavior ● Add or modify attributes on Component tag ● Require elements in HTML header ● Ajax events ● Example: ● Tooltip header contributor

  23. Slide 23: Wicket models

    Wicket models ● Implements IModel<T> ● Encapsulates data ● The value (model object) can be ● A constant ● Calculated on request ● Fetched for rendering and then discarded to minimize session size (LoadableDetachableModel) ● Components have a default model ● And may define more

  24. Slide 24: Wicket Models

    Wicket Models ● Example ● LoadableDetachableModel

  25. Slide 25: Wicket and Ajax

    Wicket and Ajax ● Ajax Behaviors can be added to components ● The AjaxRequestTarget ● Produces an Ajax response envelope ● When Components are added to the AjaxRequestTarget with .addComponent() ● The Component will be rendered ● The resulting markup will be included in the ajax response ● .. and in

  26. Slide 26: Examples

    Examples ● A simple AjaxEventBehavior ● Portal ● CRUDForm.formSaved – refresh grid ● Absence approval revisited – advanced ajax

  27. Slide 27: Working with Wicket

    Working with Wicket ● Nice things ● Navigating and understanding model and behavior made easy by type safety ● Subclassing facilitates a consisten UI – maps well to the users perception of the application ● Simple things are easy, difficult things are possible ● However, all this also means ... ● ..

  28. Slide 28: Working with Wicket

    Working with Wicket ● The Lessor Portal ● Project started from scratch September 2008 ● Appr. 2 developers at any given time ● In production May 2009 (pilot­scale) ● One year after ● Entire HTML layout changed August 2009 ● Still a clear vision of design ● Lots of refactoring

  29. Slide 29: Thank you!

    Thank you! ● Questions & Discussion ● Niels Sthen Hansen, Trifork ● [email protected] ● Product placement ● Trifork Wicket courses! ● Remember JAOO (http://jaoo.dk)

Trifork Group — Technical Presentation (2010) on 6ix