Version 15

    JSF 2.0 – RichFaces integration plan.

    Test environment

    It is important to use test-driven development for a new features. Because current Shale-test framework does not have JSF-2.0 versions of the mock objects, and due to often JSF API changes during development phase, we need to have a powerful test environment for the framework and components. New jsf-test project works like existing Shale tests, but uses “stub” webserver and  a real JSF implementation.Tasks:

    1. Create Mock webserver with JSF support. DONE: Test Driven JSF Development

    2. Integrate test framework with HtmlUnit, jWebUnit or an other      framework for components rendering and Javascript tests. DONE

    3. Rewrite existing abstract test classes for a new framework.

    4. Setup Real World automated test project using Selenium test framework...


    Component Development Kit is base for entire RichFaces components library, therefore rewriting  it should be first stage of migration process.

    RichFaces 4.0 Components Development Kit

    AJAX framework

    RichFaces 4.0 AJAX

    Probably, it is hardest part of the transition.




    1. Properly divide api, implementation and component library. The library itself should depends from the 'api' only. Common components classes should be moved into the library.(
    2. Use standard JSF 2.0 ExceptionHandler.
    3. DataModel classes - support new JSF 2.0 iterator() method.
    4. Use JSF 2.0 system events instead of custom listener/tree walkers.


    1. Move initialization code into JSF 2.0 system listener. Move all "lazy" loading into application startup. If necessary, use javax.nio locking instead of "syncronized" (
    2. Add support for hot redeployment, as JSF 2.0 does.
    3. Move all configuration parameter names into the ContextInitParameters utility class constants. Use that class instead of direct init parameters references. (
    4. Use Faces-config extentions instead of the init parameters for a complex cases ( two or more related parameters ). (
    5. Use single 'Configuration' class to access for all parameters by single point.(



    1. Reduce the number of the style classes. Merge internal names with public ones.
    2. Make skin style class names portal-compatible by passing them with ExternalContext.encodeNamespace() method. (


    1. Transform RichFaces resources to use JSF 2.0 Resource Handling instead of Richfaces filter. The extended ResourceHandler should serve dynamic RichFaces resources and delegate other requests for default one.(
    2. Transform RichFaces InternetResource interface into JSF 2.0 Resource abstract class. (
    3. Move the Renderer dependend resources definitions from propietary interface to the JSF 2.0 annotations. ( Implemented in JSF itself
    4. Inject resources by the JSF 2.0 UIViewRoot#addComponentResource instead of filter. It seems as JSF 2.0 bug what that API does not preserve scripts and styles order. ( Implemented in JSF itself
    5. Dynamic Resources. Current JSF implementation supports a static files only. (
    6. Proprietary "xcss" stylesheet-description language should be replaced by the native CSS with EL-expressions and conditional elements. Possible way - define custom PDL handler for CSS format, as it exists in the JSF 2.0 Facelets-based one for a XML. (
    7. Process EL-expressions in JavaScript files. Implemented in JSF itself
    8. Replace runtime images rendering by pre-generated static images ( nice idea to use SVG and maven batic plugin to prepare them ), but only apply color transformation directly to PNG file content. For example, each skin color could be rendered into separate channel ( Red, Green or Blue, RichFaces skins do not use more than 3 colors for images ) and use channel value as intencity of actual color. That would eliminate AWT dependencies from runtime and solve compatibility problems.


    Client-side library

    Rewrite components JavaScript and HTML code to reduce a number of JavaScript libraries dependencies ( after a long development we have  dependencies from the Sarissa, Prototype, Scriptaculos, JQuery and a lot of duplicated functionality ):

    1. Use only one base library (JQuery is most preferable at this moment). (
    2. Move duplicated code into the global library. (
    3. Make code compatible with Portlet environment: use anonimous functions to hide internal code, pass all public methods names with ExternalContext.encodeNamespace(). (
    4. Public JavaScript components API
    5. If possible, insert all RichFaces libraries at the page end as Yahoo recommends (
    6. Pluggable/Configurable effects for components.
      1. We should consider that during design. Current 3.3.x (and older) components designe does not allow to plug effects on changing state.
    7. Advanced keyboard and accessibility support
      1. The same as for 6). Default keyboards shortcuts should present on components (all menus, trees, selection on tables, rich inputs and so on), need to design points and api to be able to attach shortcuts usign hotkey.


    Utility classes

    Review a number of utility classes used. Remove obsolette packages :

    1. XML serializer. (
    2. JTidy (
    3. Gif image format SPI ( included in the JDK 5 and late ). (
    4. Remove Apache common-collections dependencies. Use google-collections instead or create own project-specific classes. (
    5. Remove Jakarta Digitester dependencies. (
    6. Review BaseRenderer/RendererUtils etc. Remove obsolette code from them. (
    7. Remove commons-logging. Create logger supporting various logging contexts. (
    8. Remove obsolette JSF extensions ( listeners, StateManager etc ). Replace Components Tree walk, used by the RichFaces paginator and some other components by the JSF 2.0 events.



    1. Code rewiew and optimization.
    2. ??? separate iteration components ( tables, repeater, tree ... ) from UIData. (
    3. Performance improvment.
    4. Redesign components with semantic markup. Avoid <table> tags where it is reasonable
    5. Rewrite client-side markup and JavaScript.
    6. Use new JSF 2.0 features ( new System Events, methods etc )  to optimize components code. Use UIComponent#vistTree method to support virtual components inside iterables (e.g. support tabs inside ui:repeat etc.).
    7. Add built-in mouse hover effect where it is applicable
    8. Add built-in effects where it is applicable


    1. Add support for current component context inside rich:* functions.