Icefaces 2.0 tree component doesn't work
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
Icefaces 2.0 tree component doesn't work  XML
Forum Index -> Development Build Feedback
Author Message
edruta

Joined: 18/04/2009 00:00:00
Messages: 8
Offline


I tried to run the tree component example from the tutorial and get the following NullPointerException:

SCHWERWIEGEND: Error Rendering View[/newxhtml.xhtml]
java.lang.NullPointerException
at com.icesoft.faces.component.tree.TreeRenderer.encodeNode(TreeRenderer.java:376)
at com.icesoft.faces.component.tree.TreeRenderer.encodeParentAndChildNodes(TreeRenderer.java:277)
at com.icesoft.faces.component.tree.TreeRenderer.encodeChildren(TreeRenderer.java:234)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
at
.................................

See the attachment for the XHTML-View and the managed bean.

The environment is:
Netbeans 6.8, JSF 2.0/Facelet, Glassfish V3 and the libraries:
icefaces-compat.jar
icefaces-comps-compat.jar
icefaces.jar
 Filename newxhtml.xhtml [Disk] Download
 Description The Facelets view.
 Filesize 1 Kbytes
 Downloaded:  96 time(s)

 Filename TreeBean.java [Disk] Download
 Description The managed bean
 Filesize 3 Kbytes
 Downloaded:  58 time(s)

steelyx

Joined: 22/01/2010 00:00:00
Messages: 9
Offline



Try ICEFaces2 component-showcase. It works.
However when creating a custom app with only tree.xhml and
reequired other artifacts the operations ins server ( request)
go OK, but in response phase comes "Unable to set up WindowScope"

This is discussed in

http://jira.icefaces.org/browse/ICE-5297
http://jira.icefaces.org/browse/ICE-5220

judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


The xhtml file you attached was empty, but the WindowScope server log messages have been found mostly to be related to hot deploying the application and haven't supplied any problems to sample app functionality.

You might want to review your xhtml, as it looks from the exception you have posted that there might be a problem with the encoding of whatever you have in the xhtml file.
edruta

Joined: 18/04/2009 00:00:00
Messages: 8
Offline


@judy,
thanks for the reply; the xhtml file i posted is not empty, i downloaded and opened it (wth an editor like Notepad); here is the content:

<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>TODO supply a title</title>
</h:head>
<h:body>
<p>
TODO write content hier

<!--
This is a very links tree comprising of only text nodes. The
expand and contract images are rendered because the "imageDir"
attribute on the tree component has been set to a known path.
-->
<ice:tree id="tree"
value="#{tree.model}"
var="item"
hideRootNode="false"
hideNavigation="false"
>
<ice:treeNode>
<f:facet name="content">
<ice:panelGroup style="display: inline">
<ice:outputLink value="#{item.userObject.url}" target="_blank">
<ice:outputText value="#{item.userObject.text}" />
</ice:outputLink>
</ice:panelGroup>
</f:facet>
</ice:treeNode>
</ice:tree>
</p>
</h:body>
</html>
krokkodillo

Joined: 15/04/2009 00:00:00
Messages: 6
Offline


edruta wrote:
@judy,
thanks for the reply; the xhtml file i posted is not empty, i downloaded and opened it (wth an editor like Notepad); here is the content:

<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>TODO supply a title</title>
</h:head>
<h:body>
<p>
TODO write content hier

<!--
This is a very links tree comprising of only text nodes. The
expand and contract images are rendered because the "imageDir"
attribute on the tree component has been set to a known path.
-->
<ice:tree id="tree"
value="#{tree.model}"
var="item"
hideRootNode="false"
hideNavigation="false"
>
<ice:treeNode>
<f:facet name="content">
<ice:panelGroup style="display: inline">
<ice:outputLink value="#{item.userObject.url}" target="_blank">
<ice:outputText value="#{item.userObject.text}" />
</ice:outputLink>
</ice:panelGroup>
</f:facet>
</ice:treeNode>
</ice:tree>
</p>
</h:body>
</html> 


Hi edruta,

I had the same problem, in my case I forgot to properly initalise back bean, try to find declaration of tree.model in your bean and go from there.
krokkodillo

Joined: 15/04/2009 00:00:00
Messages: 6
Offline


Maybe try at beginning simple code:

{
rootTreeNode = new DefaultMutableTreeNode();
PanelSelectUserObject rootObject = new PanelSelectUserObject(rootTreeNode);
rootObject.setText("Root");
rootObject.setExpanded(true);
rootTreeNode.setUserObject(rootObject);

// model is accessed by by the ice:tree component
model = new DefaultTreeModel(rootTreeNode);
loadLeaf("SampleNode", rootTreeNode);
}
public void loadLeaf(String name, DefaultMutableTreeNode root) {
DefaultMutableTreeNode freel = addNode(name, root);
PanelSelectUserObject iuoFreel = (PanelSelectUserObject) freel.getUserObject();
iuoFreel.setLeaf(true);
iuoFreel.setLeafIcon("./resources/icons/" + name + ".jpg");
}
steelyx

Joined: 22/01/2010 00:00:00
Messages: 9
Offline


Morning

Can you put a working tree app demo( ICEFaces 2.0 Alpha) with
minminum infra ( no templates, components etc.) to this site, because
I haven't managed to do it yet.

Thanks in advance.
steelyx

Joined: 22/01/2010 00:00:00
Messages: 9
Offline



Good evening

The tree examples started to work after the page
was instantiated thru binary (.jsf) call.
Not thru .xhtml :-)

For ex. thru jsp-page like
<%
response.sendRedirect("treeSimple.jsf");
%>
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


Make sure the tree is encased within a form.
 
Forum Index -> Development Build Feedback
Go to:   
Powered by JForum 2.1.7ice © JForum Team