File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes f:facet funtionality Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "f:facet funtionality" Watch "f:facet funtionality" New topic
Author

f:facet funtionality

Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
What is the funtionality of <f:facet> ? I am not able to understand it.

I have seen some code as <blockquote>code:
<pre name="code" class="core"><f:facet name="header"/> <f:facet name="expand"/></pre>
</blockquote>

Does the "header" and "expand" have any special meaning?


SCJP,SCWCD, Into ATG now!
Bhaskar GR
Greenhorn

Joined: Jun 13, 2008
Posts: 28
<h:dataTable>
<h:column>
<f:facet name="header">
<hutpuText value="bhaskar"/>
</f:facet>

Here value bhaskar will dispaly in header of the table.
Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
Thanks Bhaskar,

So I guess name="header" has a significance.

Is there any link which provides all possible combinations that can be entered as name attribute of facet ?
Bhaskar GR
Greenhorn

Joined: Jun 13, 2008
Posts: 28
sorry man
Darryl Nortje
Ranch Hand

Joined: Jun 11, 2002
Posts: 140
Hi Joshua,

the name part of facet can be anything. For example if you are writing a tree component, when you instantiate each Node, you pass in a string. For a node name, like if you were writing a tree component to represent a file system, you would have 2 different kinds of nodes, namely, directory, and file. So to show each Node differently you use the facet tag. <h:facet name="dir"... and <h:facet name="file"...

Have a look at some tree examples if this doesn't make sense, hopefully the examples do.
Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
Hi Darryl,

I tried changing the name attribute of f:facet in the datatable and it did not work.

After some googling I found the below link:

http://www.jsftoolbox.com/documentation/help/12-TagReference/core/f_facet.html

So, perhaps it depends where f:facet are declared, as you rightly pointed out if it is used by tree nodes then the name does not matter but when used inside column may be it matters.


I also found the below code from a site

<blockquote>code:
<pre name="code" class="core">
<t:tree2 id="clientTree" value="#{treeBacker.treeData}" var="node" varNodeToggler="t">
<f:facet name="foo-folder">
<h:panelGroup>
<f:facet name="expand">
<t:graphicImage value="images/yellow-folder-open.png" rendered="#{t.nodeExpanded}" border="0"/>
</f:facet>
<f:facet name="collapse">
<t:graphicImage value="images/yellow-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>
</f:facet>
<hutputText value="#{node.description}" styleClass="nodeFolder"/>
<hutputText value=" (#{node.childCount})" styleClass="childCount" rendered="#{!empty node.children}"/>
</h:panelGroup>
</f:facet>
</t:tree2>
</pre>
</blockquote>


In the above case appropriate images are loaded depending on whether tree is expanded or collapsed, hence my guess is that "expand" and "collapse" are some reserve words while using facet inside tree.

Please let me know if I have misunderstood anything.

Regards,
Joshua
Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
From the link posted in previous post:

The name attribute sets the name of the facet to be created. Some components have facets with predefined names, such as the "header" and "footer" facets of the component associated with the h:dataTable tag.

Regards,
Joshua
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: f:facet funtionality