myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe" <>
Subject [TRINIDAD and TOMAHAWK] Extending Trinidad Skinning support to Tomahawk components
Date Wed, 13 Jun 2007 02:49:37 GMT
Hi everybody.

I'm working on extends skinning capabilities found in Trinidad, for use with
non Trinidad components
(Tomahawk or base html components). This is the main objective of my Google
Summer of Code proposal,
and finally I finnish my first aproximation of the final source code.

The link to the project is here:
the source code is here:
I'm skinning some myfaces examples but for now only home.jsp,
sample1.jspand 2 works with it. In the next
days I planned to add skins to other examples.
Note that in this moment, it works well, but I want to work at best as I can

I have some questions about it, but first I have to explain what i have done
at this time.
The big trick is implement a decorator pattern. I have tabbed the questions
for an easy reading.

NOTE: Feel free to answer one of all questions. I will appreciate a lot your
efford in help with
this proyect. Note that this work is a donation sponsored for Google Inc.
for Apache Software Foundation.

I created a SkinRenderKit that decorate the HTML_BASIC_RENDER_KIT, but it
ExtendedRenderKitService (see trinidad) . The objective is that trinidad
recognize this and create a RenderingContext for the view (necesary for

Then, I set the default render kit as SkinRenderKit.

    <!-- Use the Skin RenderKit -->

<!-- Optional at now -->

In the faces-config.xml I register the component that I want to skin like

        <component-family>javax.faces.Command</component-family> <!-- THE
        <renderer-type>javax.faces.Button</renderer-type> <!-- THE SAME

    ....... Other components ........


The renderer should extends form SkinRenderer class. When the renderer is
added in
SkinRenderKit, it finds its HTML_BASIC renderer counterpart (based on his
component family and
renderer type), and set this as if SkinRenderKit was
a decorator of the counterpart.

    1. QUESTION: Here is the first question: What if I want to skin other
component that make use
    of some RenderKit different that HTML_BASIC? My first solution should be
something like this:



    But I'm not have found any information about how to make this work.
Looking, if I could override
    the FacesConfigurator class with my custom implementation I feel that
this should be possible.
    The sub-question is ¿is possible to override a FacesConfigurator? How?

A SkinRenderer override the styleClass parameters (Ex: styleClass,
headerClass, ....) of the component,
and delegate this info to the real HTML_BASIC renderer. I do this with code
like this:

    //....some stuff getting, checking and getting the class .....

    2. QUESTION: I have done this and this works. But is this clean?.
Apparently, yes, but....
    Any suggestions? Maybe casting the component class and setting directly

Then you have to configure your skins like in trinidad


<trinidad-config xmlns="">

and trinidad-skins.xml

<skins xmlns="">

Configure your application like say in the wiki of Trinidad.
Then stylize your component writing in exampleSkin.css something like this:



(easy to map if you are the programmer)

    font-family: verdana,arial,helvetica,sans-serif;

    font-family: verdana,arial,helvetica,sans-serif;
     text-decoration: underline overline;
     color: red;

    3. QUESTION: I don't now if it was better to do something like this

    (Its more simple to the designer to stylize if the component style looks
like this)

        font-family: verdana,arial,helvetica,sans-serif;
         text-decoration: underline overline;
         color: red;

    The big problem is if I want to do this, I have to burn the outputLink
    String inside the code of the renderer (Difficulting reuse of code).
    I would like to do something like this:



    But the same that in the first question. How i can personalize this?

    4. QUESTION: What happen if I change the af prefix with other? (I read
something about namespaces,
    but I'm not found info about this topic)

At last, if you want to use all this, in your page you should do something
like this:

<%@ taglib uri="" prefix="h"%>
<%@ taglib uri="" prefix="f"%>
<%@ taglib uri="" prefix="t"%>
<%@ taglib uri="" prefix="trh"%>

    <trh:styleSheet/> <!-- I only enabled this component and <tr:document>
tag -->


    5. QUESTION: I have seen the following message in the log file of Jboss

    19:32:42,765 ERROR [HtmlResponseStateManager] No component states to be
saved in
     client response!

    I think that this is because I'm not using trinidad components.
    ¿It is a real error?

    6. QUESTION: If I want to combine javascript + css, ¿Does trinidad have
a mechanism to
    do this?. or i have to mix tomahawk mechanism?

    7. FINAL QUESTION: My intention is to add skinning capabilities to non
    components. But I ignore if you can o want to use trinidad and
non-trinidad components mixed
    (example: tomahawk + trinidad). With the decorator pattern I think that
it's possible
    to do this operation: [[html_base + tomahawk + trinidad] * skins]. And
with some much more work
    do crazy things like (here I'm speculating and I'm dreaming a lot)
    [[html_base + tomahawk + trinidad + tobago] * skins] (combining tobago

    It is desirable to get this operation [[html_base + tomahawk + trinidad]
* skins]?

Well, that is all I want to ask to the community about this for now.

All suggestions are welcome.

Att: Leonardo Uribe

View raw message