Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 89897 invoked from network); 13 Jun 2007 02:50:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jun 2007 02:50:02 -0000 Received: (qmail 9243 invoked by uid 500); 13 Jun 2007 02:50:04 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 9198 invoked by uid 500); 13 Jun 2007 02:50:03 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 9187 invoked by uid 99); 13 Jun 2007 02:50:03 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jun 2007 19:50:03 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of lu4242@gmail.com designates 209.85.132.247 as permitted sender) Received: from [209.85.132.247] (HELO an-out-0708.google.com) (209.85.132.247) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jun 2007 19:49:58 -0700 Received: by an-out-0708.google.com with SMTP id c3so13987ana for ; Tue, 12 Jun 2007 19:49:38 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=WNsyjD8y0W0vc/OEUJIy/nzXYuhATebJd/zcA7O2rjMSnvhRPCUDv2malNa1cSr2JtbDKbaO8+rAYTWd3cEPixVVjT8nLC1Ry7QnuzqDtVzp+r8VNpEH6blaeQk+aFlQkSlfoRprNn9DMjesaSuYGiWDkXhDYC+WXJLNjXKGSMU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=ry0EqBoC5bVCIbnGn0CVmzmxhJKcBGXH02LM75mGtcQRyRVM4hyibdEpBQneiK4fpntwItt8DBghlbQYBICPncgbAL+/PcSHxh2iUhwnUo1ESq7RpBwzvKp4iTq39WM3DZG9EfYt/UeF+i8VKdA8Sxw17NVwXOEkzdPAqXwWe0s= Received: by 10.100.78.19 with SMTP id a19mr67875anb.1181702977406; Tue, 12 Jun 2007 19:49:37 -0700 (PDT) Received: by 10.100.14.20 with HTTP; Tue, 12 Jun 2007 19:49:37 -0700 (PDT) Message-ID: Date: Tue, 12 Jun 2007 21:49:37 -0500 From: "Leonardo Uribe" To: "MyFaces Development" Subject: [TRINIDAD and TOMAHAWK] Extending Trinidad Skinning support to Tomahawk components MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_13395_8006666.1181702977373" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_13395_8006666.1181702977373 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi everybody. I'm working on extends skinning capabilities found in Trinidad, for use wit= h 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: http://code.google.com/p/myfaces-csi/ the source code is here: http://myfaces-csi.googlecode.com/svn/trunk/myfaces-csi/myfaces-skins/ 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 ca= n do. I have some questions about it, but first I have to explain what i have don= e 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 you= r 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 implements ExtendedRenderKitService (see trinidad) . The objective is that trinidad ViewHandler recognize this and create a RenderingContext for the view (necesary for skins). Then, I set the default render kit as SkinRenderKit. SkinRenderKit org.apache.myfaces.custom.skin.SkinRenderKitFactory In the faces-config.xml I register the component that I want to skin like this: SkinRenderKit org.apache.myfaces.trinidadinternal.renderkit.core.SkinRenderKit javax.faces.Command javax.faces.Button org.apache.myfaces.custom.skin.GenericSkinRenderer ....... 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 b= e something like this: other.component.Command other.renderer.Button org.apache.myfaces.custom.skin.GenericSkinRenderer renderKit java.lang.String other.renderkit.OtherRenderKit 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 =BFis 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 ..... component.getAttributes().put("styleClass",styleClass); 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.xml true INLINE example and trinidad-skins.xml example.desktop example org.apache.myfaces.trinidad.desktop skins/example/exampleSkin.css Configure your application like say in the wiki of Trinidad. Then stylize your component writing in exampleSkin.css something like this: af|:: { ..... } Example (easy to map if you are the programmer) af|javax_faces_component_html_HtmlOutputLabel::class { font-family: verdana,arial,helvetica,sans-serif; } af|javax_faces_component_html_HtmlOutputLink::class:hover { 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 look= s like this) h|outputLink::class:hover { 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: other.component.Command other.renderer.Button org.apache.myfaces.custom.skin.GenericSkinRenderer componentBaseName java.util.List javax.faces.component.html.HtmlOutputLink ,h|outputLink 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=3D"http://java.sun.com/jsf/html" prefix=3D"h"%> <%@ taglib uri=3D"http://java.sun.com/jsf/core" prefix=3D"f"%> <%@ taglib uri=3D"http://myfaces.apache.org/tomahawk" prefix=3D"t"%> <%@ taglib uri=3D"http://myfaces.apache.org/trinidad/html" prefix=3D"trh"%> ...... 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. =BFIt is a real error? 6. QUESTION: If I want to combine javascript + css, =BFDoes trinidad ha= ve a mechanism to do this?. or i have to mix tomahawk mechanism? 7. FINAL QUESTION: My intention is to add skinning capabilities to non trinidad 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 skins). 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 ------=_Part_13395_8006666.1181702977373 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi everybody.

I'm working on extends skinning capabilities found= in Trinidad, for use with non Trinidad components
(Tomahawk or base htm= l components). This is the main objective of my Google Summer of Code propo= sal,=20
and finally I finnish my first aproximation of the final source code.
The link to the project is here: http://code.google.com/p/myfaces-csi/
the source code = is here:=20 http://myfaces-csi.googlecode.com/svn/trunk/myfaces-csi/myfaces-ski= ns/
I'm skinning some myfaces examples but for now only home.jsp , sample1.jsp and 2 works with it. In the next
days I planned to add sk= ins to other examples.
Note that in this moment, it works well, but I wa= nt to work at best as I can do.

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 quest= ions for an easy reading.

NOTE: Feel free to answer one of all quest= ions. I will appreciate a lot your efford in help with
this proyect. No= te that this work is a donation sponsored for Google Inc. for Apache Softwa= re Foundation.

I created a SkinRenderKit that decorate the HTML_BASIC_RENDER_KIT, = but it implements
ExtendedRenderKitService (see trinidad) . The objecti= ve is that trinidad ViewHandler
recognize this and create a RenderingCon= text for the view (necesary for skins).=20

Then, I set the default render kit as SkinRenderKit.  

= <application>
    <!-- Use the Skin RenderKit --= >        
    <defaul= t-render-kit-id>SkinRenderKit</default-render-kit-id>=20
</application>

<!-- Optional at now -->   =  
<factory>
    <render-kit-factory>o= rg.apache.myfaces.custom.skin.SkinRenderKitFactory</render-kit-factory&g= t;
</factory>


In the faces-config.xml I register the component that I want to ski= n like this:

<render-kit>
    <render-kit= -id>SkinRenderKit</render-kit-id>
    <render= -kit-class>
         org.apache.myfaces.trinidadinternal.renderkit.core.SkinRenderKit
 &= nbsp;  </render-kit-class>
    <renderer>= ;
        <component-family>javax.fa= ces.Command</component-family> <!-- THE SAME FAMILY THAN THE ORIGI= NAL -->
        <renderer-type>javax.faces.= Button</renderer-type> <!-- THE SAME RENDERER TYPE THAN THE ORIGIN= AL -->
        <renderer-class>            org.apache.myfac= es.custom.skin.GenericSkinRenderer
        </renderer-class>
 =    </renderer>

    ....... Other comp= onents ........

</render-kit>

The renderer should exten= ds form SkinRenderer class. When the renderer is added in
SkinRenderKit, it finds its HTML_BASIC renderer counterpart (based on h= is 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 c= omponent that make use
    of some RenderKit different th= at HTML_BASIC? My first solution should be something like this:

&nbs= p;   <renderer>
        <component-family>other.com= ponent.Command</component-family>
       =  <renderer-type>other.renderer.Button</renderer-type>
&= nbsp;       <renderer-class>
  =          org.apache.myfaces.custom.skin= .GenericSkinRenderer
        </renderer-class>

&n= bsp;       <renderer-extension>
 &nb= sp;          <property>
 &= nbsp;              <pr= operty-name>renderKit</property-name>
     =            <property-class> java.lang.String</property-class>
       =          <default-value>other.rend= erkit.OtherRenderKit</default-value>
     &nbs= p;      </property>
     &= nbsp;  </renderer-extension>
    </renderer= >

    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=20 =BFis possible to over= ride a FacesConfigurator? How?

A SkinRenderer override the st= yleClass 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 an= d getting the class .....
    component.getAttributes().p= ut("styleClass",styleClass);

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

Then you have to configure your skins like in trinidad

trini= dad-config.xml

<trinidad-config xmlns=3D"http://myfaces.apache.org/trinidad/confi= g ">
  <debug-output>true</debug-output>
&= nbsp; <client-validation>INLINE</client-validation>
  &= lt;skin-family>example</skin-family>  
</trinidad-confi= g>

and=20 trinidad-skins.xml

<skins xmlns=3D"http://myfaces.apache.org/trinidad/skin"= ;>
    <skin>
     &= nbsp;  <id>
        &= nbsp;   example.desktop
        </id>
  &= nbsp;     <family>
    &nb= sp;       example
    =     </family>
      &= nbsp; <render-kit-id>
       &n= bsp;    org.apache.myfaces.trinidad.desktop
  &= nbsp;     </render-kit-id>
        <style-sheet-name>
&nbs= p;           skins/exampl= e/exampleSkin.css
        </style-= sheet-name>
    </skin>
</skins>
Configure your application like say in the wiki of Trinidad.
Then stylize your component writing in exampleSkin.css something like t= his:

af|<component_package_name_replace_point_with_underscore>= ::<property_or_string>
{
.....
}

Example

(easy= to map if you are the programmer)

af|javax_faces_component_html_HtmlOutputLabel::class
{
 =    font-family: verdana,arial,helvetica,sans-serif;
}

= af|javax_faces_component_html_HtmlOutputLink::class:hover
{
 &nb= sp;  font-family: verdana,arial,helvetica,sans-serif;=20
     text-decoration: underline overline;
 = ;    color: red;
}

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

    (Its= more simple to the designer to stylize if the component style looks like t= his)

    h|outputLink::class:hover
    = {
        font-family: verdana,arial,helve= tica,sans-serif;
         text-decoration= : underline overline;
         color= : red;
    }

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

    <renderer>
     = ;   <component-family>other.component.Command</component= -family>
        <renderer-type>other.render= er.Button</renderer-type>
        &l= t;renderer-class>
           =  org.apache.myfaces.custom.skin.GenericSkinRenderer
   &n= bsp;    </renderer-class>

    &n= bsp;   <renderer-extension>
            <property&g= t;
              =  <property-name>componentBaseName</property-name>
&nbs= p;               <= ;property-class>java.util.List</property-class>
   &n= bsp;             &nb= sp;  <list-entries>
               &= nbsp;<value>javax.faces.component.html.HtmlOutputLink,h|outputLink<= ;/value>
            &nb= sp;   </list-entries>
       &n= bsp;    </property>
      =  </renderer-extension>
    </renderer>

    But the same that in the first question. How i c= an 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:


<%@ tag= lib uri=3D" http://java.sun.com/jsf/html&q= uot; prefix=3D"h"%>
<%@ taglib uri=3D"http://java.sun.com/jsf/core" prefix= =3D"f"%>
<%@ taglib uri=3D"http://myfaces.apache.org/tomahawk" prefix=3D"t"%><= br><%@ taglib uri=3D" http://myfaces.apache.org/trinidad/html" prefix=3D"trh"%= >

<html>
    <f:view>
 &nbs= p;  <head>
    <trh:styleSheet/> <!--= I only enabled this component and <tr:document> tag -->
    </head>
    <body>
=
    ......
    </body>
</h= tml>


    5. QUESTION: I have seen the following message in th= e 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 trin= idad components.
    =BFIt is a real error?

    6. QUESTION: If I want to combine javascript + css, =BFDoes trinidad h= ave a mechanism to
    do this?. or i have to mix tomahawk mechanism?
    7. FINAL QUESTION: My intention is to add skinning = capabilities to non trinidad
    components. But I ignore= if you can o want to use trinidad and non-trinidad components mixed
    (example: tomahawk + trinidad). With the decorator p= attern I think that it's possible
    to do this oper= ation: [[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)=20
    [[html_base + tomahawk + trinidad + tobago] * skins]= (combining tobago skins).

    It is desirable to get this operation [[html= _base + tomahawk + trinidad] * skins]?
    
Well, that is all I want to ask to the co= mmunity about this for now.

All suggestions are welcome.

At= t: Leonardo Uribe

------=_Part_13395_8006666.1181702977373--