Thank you again Andrew,
I was looking at Tomahawk example for the tree2 and it looks like for each
folder node and child folder node you need to create separate facet.
I guess thats where I am getting confused.
For example:
Root Folder
--->Folder 1
-->Sub Folder 1
-->SomeFile1.zip
-->SomeFile2.zip
--->Folder 2
-->Sub Folder 2
-->Sub-Sub Folder 2
-->SomeFileSub2.zip
-->SomeFileSub2.zip
--->Folder 3
-->Sub Folder 3
-->Sub-Sub Folder 3
-->SomeFilesSubSubFolder3.zip
For that case I would need to have 5 facets:
First one for Root folder
<f:facet name="folder">
.....
</f:facet>
Second one for Folder 1, Folder 2, Folder 3 (first level)
<f:facet name="folderFirstLevel">
.....
</f:facet>
Third one for Sub Folder 1,Sub Folder 2,Sub Folder 3 (second level)
<f:facet name="folderSecondLevel">
.....
</f:facet>
Forth for Sub-Sub Folder 1,Sub-Sub Folder 2,Sub-Sub Folder 3 (third level)
<f:facet name="folderThirdLevel">
.....
</f:facet>
And fifth one for files
<f:facet name="files">
.....
</f:facet>
Now if I don't know how many levels or sub-levels would be, how would I
implement that solution???
Roman.
On 11/5/07, Andrew Robinson <[EMAIL PROTECTED]> wrote:
>
> Sure,
>
> I would recommend that you have a look at the Tomahawk examples for
> tree2 and go from there. You will only need one or two facets,
> depending on if you decide to show the files in the tree or not.
> Example:
>
> <t:tree2 var="_folder" value=#{bean.folderModel}">
> <f:facet name="folder">
> <t:commandLink action="#{bean.loadContents">
> <t:updateActionListener
> property="#{bean.selectedFolder}"
> value="#{_folder}" />
> </t:commandLink>
> </f:facet>
> </t:tree2>
>
>
>
> On 11/5/07, Roman <[EMAIL PROTECTED]> wrote:
> > Thank you,
> >
> > I was just thinking of using tree2 for file browsing on the server. Can
> this
> > be accomplished with tree2??
> >
> >
> >
> > On 11/5/07, Andrew Robinson <[EMAIL PROTECTED]> wrote:
> > > No, this should not work to my knowledge
> > >
> > > The reason is that the facet is a key in a map to a component. Hash
> > > map keys are not dynamic. If they even stored an EL expression, they
> > > would not be evaluated at the right time for what you are trying to
> > > do.
> > >
> > > If you use JSP, you could use ${}, and for facelets, this would be
> > > evaluated at compile time. Either way, the var would not be populated.
> > >
> > > The very nature of what you are trying to do is wrong I am afraid. A
> > > facet is a component. Components are built during compile time. Data
> > > tables are evaluated at run time. As a result, you are trying to have
> > > the data table dynamically add and remove facets from a component
> > > while the loop is occurring.
> > >
> > > To do this, you will have to either (1) create a facet for every
> > > possible folder type or (2) use c:forEach to build the components
> > > during compile time.
> > >
> > > In addition, I don't even see why you would want to do this. You only
> > > have one facet, so all nodes would look the same, what would changing
> > > the name of the facet give you? Just use one node type in building
> > > your tree model for folders.
> > >
> > > On 11/5/07, Roman < [EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > >
> > > > Is it possible to use dynamic values in f:facet inside name
> property???
> > > > Something like that:
> > > >
> > > > <t:dataList value="#{treeBacker.folderList }" var="folder">
> > > >
> > > > <t:tree2 id="clientTree" value="#{ treeBacker.treeData}"
> > var="node"
> > > > varNodeToggler="t">
> > > > <f:facet name="#{ folder.name}">
> > > > <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>
> > > > <h:outputText value="#{node.description
> }"
> > > > styleClass="nodeFolder"/>
> > > > </h:panelGroup>
> > > > </f:facet>
> > > > </t:tree2>
> > > >
> > > >
> > > > </t:dataList>
> > > >
> > > > Thank you,
> > > > Roman.
> > > >
> > > >
> > >
> >
> >
>