voyent
Implementing Tree Component  XML
Forum Index -> Components
Author Message
maarten

Joined: 03/May/2006 00:00:00
Messages: 39
Offline


Sry about all the tree component questions, but I realy need to get it to work!

I adjusted the tree component to my needs in the showcase app. Now I'm trying to add it to my app. I have following problems:

1. All the icons are gone! This is because my .iface files is called like this: http://localhost:8080/myapp/module/mymodule/tree.iface
So the component searches its icons like this:
http://localhost:8080/myapp/module/mymodule/xmlhttp/css/xp/css-images/tree_folder_close.gif
Instead of:
http://localhost:8080/myapp/xmlhttp/css/xp/css-images/tree_folder_close.gif

2. I've added the tree component like this:
<ice:tree id="tree" value="#{TreeBean.model}" style="border: #000000 solid 1px;"
binding="#{TreeBean.treeComponent}"
actionListener="#{TreeBean.navigate}" hideRootNode="false"
hideNavigation="false" var="item">
<ice:treeNode>
<f:facet name="icon">
<ice:panelGroup style="display: inline">
<h:graphicImage value="#{item.userObject.icon}" />
</ice:panelGroup>
</f:facet>
<f:facet name="content">
<ice:panelGroup style="display: inline">
<ice:outputText value="#{item.userObject.text}" />
</ice:panelGroup>
</f:facet>
</ice:treeNode>
</ice:tree>

I get the root node, but I can't expand it.

Any help will be greatly appreciated!
mark.collette


Joined: 07/Feb/2005 00:00:00
Messages: 1692
Offline


Try adding an imageDir attribute to the ice : tree component tag. Eg: imageDir="/xmlhttp/css/xp/css-images/"

Edit: Sorry, in the Beta release, the attribute is called cssImageDirectory, but in the upcoming ICEfaces Community Edition 1.0 release, the attribute is called imageDir.

Edit: Thanks Greg and pabreau :)

- Mark Collette
[Email]
gregory_m

Joined: 17/Jan/2005 00:00:00
Messages: 130
Offline


Maarten,

I have a couple things for you to try.

1. All icons are gone !
Try setting the cssImageDirectory attribute in the tree node.

< ice:tree id="tree" value="#{TreeBean.model}" style="border: #000000 solid 1px;"
binding="#{TreeBean.treeComponent}"
hideRootNode="false"
hideNavigation="false" var="item"
cssImagedirectory="#{TreeBean.imageDirectory}" >


2.I get the root node, but I can't expand it.
I am not sure about having the actionListener on the tree.
Try removing the actionListener from the tree.

The expanding and collapsing of treeNode is handled in the
TreeRenderer.

Thanks.
--Greg McCleary
pabreau

Joined: 11/May/2006 00:00:00
Messages: 23
Offline


Hi Maarten,
Please note, the attribute is 'cssImageDirectory', not 'cssImagedirectory'.
[Email]
maarten

Joined: 03/May/2006 00:00:00
Messages: 39
Offline


First of all: thank you for taking the time to answer my questions! I will surely praise your product and support to other developers.

Back on topic:
The first issue is solved. I get all the pictures.

The second issue however isn't solved. I removed the actionListener as suggested, but it didn't work. I thought there was maybe something wrong with my bean (so only a root node exists and no children), so I've set expanded to true.

This showed my all the correct nodes. So my bean is ok.

This is my jspx file complete:
<f:view locale="#{LocationBean.currentLocale}"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:c="http://java.sun.com/jstl/core">
<ice:outputDeclaration doctypeRoot="HTML"
doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN"
doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" />
<ice:form id="filesform">
<h:panelGrid columns="2" style="width: 100%;vertical-align:top;">
<ice:tree id="tree" value="#{TreeBean.model}" style="border: #000000 solid 1px;"
binding="#{TreeBean.treeComponent}"
hideRootNode="false"
hideNavigation="false" var="item"
cssImageDirectory="../../xmlhttp/css/xp/css-images/">
<ice:treeNode>
<f:facet name="icon">
<ice:panelGroup style="display: inline">
<h:graphicImage value="#{item.userObject.icon}" />
</ice:panelGroup>
</f:facet>
<f:facet name="content">
<ice:panelGroup style="display: inline">
<ice:outputText value="#{item.userObject.text}" />
</ice:panelGroup>
</f:facet>
</ice:treeNode>
</ice:tree>
<h:outputText value="Files" />
</h:panelGrid>
</ice:form>
</f:view>

Tnx for helping me out!
pabreau

Joined: 11/May/2006 00:00:00
Messages: 23
Offline


Hi Maarten,
Try setting 'readonly="false"' on the ice:tree.
[Email]
pabreau

Joined: 11/May/2006 00:00:00
Messages: 23
Offline


Maarten,
If you'd like us to take a look, just zip up your app and email to product.support@icesoft.com.
[Email]
maarten

Joined: 03/May/2006 00:00:00
Messages: 39
Offline


No luck with the readonly
maarten

Joined: 03/May/2006 00:00:00
Messages: 39
Offline


I tried everything I could think of. I've narrowed it down to being a folder issue (I think). In attachement I've places a stripped version of the showcase. It's an Eclips/Exadel project.

I have 2 identical pages:
showcase.iface
module/assets/files.iface

showcase works, files doesn't.

(for some reason, you cant open the first page, hit back, and navigate to the other page, but that prolly an whole other issue).

Gz
 Filename tree.zip [Disk] Download
 Description No description given
 Filesize 3688 Kbytes
 Downloaded:  161 time(s)

pabreau

Joined: 11/May/2006 00:00:00
Messages: 23
Offline


Maarten,
I got your test to work after removing the binding attribute from the tree tag. Your original code:

<ice:tree id="tree" value="#{TreeBean.model}"
binding="#{TreeBean.treeComponent}"
actionListener="#{TreeBean.navigate}" hideRootNode="false"
hideNavigation="false" var="item"
cssImageDirectory="../../xmlhttp/css/xp/css-images/">
<ice:treeNode>
<f:facet name="icon">
<ice:panelGroup style="display: inline">
<h:graphicImage value="#{item.userObject.icon}" />
</ice:panelGroup>
</f:facet>
<f:facet name="content">
<ice:panelGroup style="display: inline">
<ice:outputText value="#{item.userObject.text}" />
</ice:panelGroup>
</f:facet>
</ice:treeNode>
</ice:tree>

was producing the following error:
javax.faces.FacesException: Can't parse stream for /module/assets/files.jspx The tree tag requires a single child treeNode tag. Found [2]

I guess having both a binding and a value on the tree was causing the component engine to produce a tree with two ndoes, which is not allowed.
After removing the binding, it worked. I've also included the war file.

Philip
ICEsoft Technologies Inc.
 Filename treeTest.war [Disk] Download
 Description No description given
 Filesize 3973 Kbytes
 Downloaded:  195 time(s)

[Email]
maarten

Joined: 03/May/2006 00:00:00
Messages: 39
Offline


Hello Phillip,

Your solution sounded too good to be true... and it was.

I tried removing the binding in my project ... failed.
I tried removing the binding in the test project ... failed.
I tried to run your .war in Tomcat 5.5.17 ... failed.

What am I doing wrong???

The screenshot in in this post is when I try clicking one of the '+'-signs in front of a node.
 Filename treetest.jpg [Disk] Download
 Description No description given
 Filesize 45 Kbytes
 Downloaded:  294 time(s)

pabreau

Joined: 11/May/2006 00:00:00
Messages: 23
Offline


Well, the previous suggestion fixed the two rootNodes problem, which allowed the tree be rendered. This is another problem that comes from an issue the Blocking Servlet has with connecting to pages nested in project subdirectories. If the Blocking Servlet cannot connect with the server, when the user first interacts with the view, and the client attempts to communicate that interaction with the server, which fails, the 'Connection Lost' message appears. The current work-around is to add servlet mapping for the subdirectory, like so:
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/module/assets/block/*</url-pattern>
</servlet-mapping

After adding this to the web.xml file, the tree correctly collapses and expands.

Philip
 Filename treeTest.war [Disk] Download
 Description No description given
 Filesize 3979 Kbytes
 Downloaded:  216 time(s)

[Email]
pabreau

Joined: 11/May/2006 00:00:00
Messages: 23
Offline


Sorry, that code snippet didn't come out clearly, try this:
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/module/assets/block/*</url-pattern>
</servlet-mapping
[Email]
maarten

Joined: 03/May/2006 00:00:00
Messages: 39
Offline


YES! It works! Now, that's what I call a painful experience! ;)

Thank you Philip for you patient support, I hope I won't need it as much with other components!

Kind regards,

Maarten
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team