myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nebinger, David" <dnebin...@tbbgl.com>
Subject RE: Confusion about Tomahawk with Facelets
Date Wed, 27 Jun 2007 17:41:22 GMT
> I just opened HtmlDataTable.class from tomahawk.jar in the 
> decompiler, and this is what I see:
> package org.apache.myfaces.component.html.ext;
> - not "org.apache.myfaces".
> Also on the other thought, if two jars (tomahawk and myfaces) 
> would have the same class (I mean -in the same package) they 
> would conflict.
> So, I'm still wondering, if and how this component class in 
> tomahawk package is called, and why xyzTag class (in 
> tomahawk) is pointing it's
> getComponent() to "org.apache.myfaces".
> 
> Also, I've noticed that DataTable has some more classes 
> (DataTableHack), so I just double-checked with DataScroller 
> and found the same confusion)
> 
> vlad

Okay, that's a different confusion entirely.

First the faces-config.xml file defines the component and renderer types
as, say, org.apache.myfaces.HtmlDataTable.  See the <component-type> and
<renderer-type> elements.  These basically define aliases to the true
class implementations defined via the <component-class> and
<renderer-class> elements.

The tomahawk TLD file defines how the tag (i.e. <t:dataTable /> maps to
the alias values defined in the faces-config.xml.

So, the <t:dataTable> tag is defined as:

    <tag>
        <tag-name>dataTable</tag-name>
        <component>
 
<component-type>org.apache.myfaces.HtmlDataTable</component-type>
            <renderer-type>org.apache.myfaces.Table</renderer-type>
        </component>
    </tag>

When you go to the faces-config.xml file, you see that the component
type is actually defined as:

    <component>
 
<component-type>org.apache.myfaces.HtmlDataTable</component-type>
 
<component-class>org.apache.myfaces.component.html.ext.HtmlDataTable</co
mponent-class>
    </component>

Which shows that the full class name for the implementation is
org.apache.myfaces.component.html.ext.HtmlDataTable.

Also the renderer is defined as:

    <renderer>
        <component-family>javax.faces.Data</component-family>
        <renderer-type>org.apache.myfaces.Table</renderer-type>
 
<renderer-class>org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer<
/renderer-class>
    </renderer>

Again, it identifies the class that implements the renderer.

In the source files, you'll also see that they return the alias values
defined in the <component-type> and <renderer-type> tags.

It's not meant to be confusing, it is meant to simplify things by
removing actual classpaths in the various files.  The component type and
renderer types are prefixed with "org.apache.myfaces" so the possibility
of naming conflicts; HtmlDataTable as a name could possibly conflict if
the standard JSF elements were so named; by prefixing with
"org.apache.myfaces" you can have your own HtmlDataTable component and
still use the tomahawk components.

Those *Hack classes are internal classes for the implementation; instead
of decompiling the class files themselves, check out the source to see
the embedded comments.  These seem to be classes to provide some
additional visibility over the data model, although I really haven't dug
into it to say anything factual about them.


Mime
View raw message