new treenode on nodeExpand [solved]

UI Components for JSF
Post Reply
User avatar
michiel
Posts: 240
Joined: 07 Jun 2010, 09:12
Location: Belgium

09 Jul 2010, 10:07

I have a dynamic tree, almost working like it should.

When a node is expanded, its grandChildren (if any) are inserted in the tree,
on collapse, they are removed again. This is working, but the node below (not child) still has
the same rowNumber as before
, meaning the first child of the node and the node below have
the same rowNumber, on selecting they react as the same node.
When refreshing the page (or the tree), everything is right
(I tried to adding addPartialUpdateTarget("navigationMenu");, this is not invoked).

collapseNode works OK

xhtml:

Code: Select all

<p:tree value="#{navigationBean.tree}" var="treeNode"
    update="growl contentPanel" cache="false"
    selectionMode="single" selection="#{navigationBean.selectedNode}"
    nodeSelectListener="#{navigationBean.selectNode}"
    nodeExpandListener="#{navigationBean.expandNode}"
    nodeCollapseListener="#{navigationBean.collapseNode}"
    dynamic="true" id="navigationMenu" style="overflow: auto;"
    >
...
navigationBean:

Code: Select all

public void expandNode(NodeExpandEvent event){
	BaseTreeNode node = (BaseTreeNode)event.getTreeNode();
	if(node.getChildCount() > 0){
		for (TreeNode tnode : node.getChildren()){
			DossierTreeNode dnode = (DossierTreeNode)tnode;
			Dossier dos = (Dossier)dnode.getData();
			if (!dos.getProblemen().isEmpty()){
				for (Probleem pro : probleemDAOBeanImpl.getProblemen(dos)){
					new ProbleemTreeNode(pro, dnode);
				}
			}
		}
	}
//        RequestContext rc = RequestContext.getCurrentInstance();
//        rc.addPartialUpdateTarget("navigationMenu");
}

public void collapseNode(NodeCollapseEvent event){
	if(event.getTreeNode().getChildren().size() > 0){
		for(TreeNode node : event.getTreeNode().getChildren()){
			BaseTreeNode bnode = (BaseTreeNode)node;
			bnode.setChildren(new ArrayList<TreeNode>());
		}
	}
	RequestContext rc = RequestContext.getCurrentInstance();
	rc.addPartialUpdateTarget("navigationMenu");
}
Last edited by michiel on 16 Jul 2010, 12:28, edited 1 time in total.
JSF-2.0, mojarra-2.0.2-FCS and PrimeFaces-2.1 on GlassFish v3.0.1 (build 22)

User avatar
michiel
Posts: 240
Joined: 07 Jun 2010, 09:12
Location: Belgium

13 Jul 2010, 10:24

do I have to create a issue ticket for this?
JSF-2.0, mojarra-2.0.2-FCS and PrimeFaces-2.1 on GlassFish v3.0.1 (build 22)

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

13 Jul 2010, 11:41

Yes, please create an issue ticket for this so we can look in detail.

User avatar
michiel
Posts: 240
Joined: 07 Jun 2010, 09:12
Location: Belgium

13 Jul 2010, 12:06

new ticket issue 992
JSF-2.0, mojarra-2.0.2-FCS and PrimeFaces-2.1 on GlassFish v3.0.1 (build 22)

callahan
Posts: 768
Joined: 27 May 2010, 22:52

14 Jul 2010, 07:17

This issue appears to be new with PrimeFaces 2.1. Similar code works correctly with PrimeFaces 2.0.2.

User avatar
michiel
Posts: 240
Joined: 07 Jun 2010, 09:12
Location: Belgium

16 Jul 2010, 09:59

it is fixed in the nightly release

many thanks to optimus.prime.

P.S. when building PF-2.1-snapshot from sources, I get following error:
Tests in error:
shouldFineTreeNodeByRowIndex(org.primefaces.model.TreeModelTest)
Test report:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite failures="0" time="0.015" errors="1" skipped="0" tests="1" name="org.primefaces.model.TreeModelTest">
  <properties>
    <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
    <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk1.6.0_18\jre\bin"/>
    <property name="java.vm.version" value="16.0-b13"/>
    <property name="java.vm.vendor" value="Sun Microsystems Inc."/>
    <property name="java.vendor.url" value="http://java.sun.com/"/>
    <property name="path.separator" value=";"/>
    <property name="java.vm.name" value="Java HotSpot(TM) Client VM"/>
    <property name="file.encoding.pkg" value="sun.io"/>
    <property name="user.country" value="BE"/>
    <property name="sun.java.launcher" value="SUN_STANDARD"/>
    <property name="sun.os.patch.level" value="Service Pack 3"/>
    <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
    <property name="user.dir" value="E:\test\java_projects\libs\primefaces-2.1-RC1-build"/>
    <property name="java.runtime.version" value="1.6.0_18-b07"/>
    <property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
    <property name="basedir" value="E:\test\java_projects\libs\primefaces-2.1-RC1-build"/>
    <property name="java.endorsed.dirs" value="C:\Program Files\Java\jdk1.6.0_18\jre\lib\endorsed"/>
    <property name="os.arch" value="x86"/>
    <property name="surefire.real.class.path" value="C:\DOCUME~1\cvanhove.OAC\LOCALS~1\Temp\surefirebooter7039054464776385843.jar"/>
    <property name="java.io.tmpdir" value="C:\DOCUME~1\cvanhove.OAC\LOCALS~1\Temp\"/>
    <property name="line.separator" value="
"/>
    <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
    <property name="user.variant" value=""/>
    <property name="os.name" value="Windows XP"/>
    <property name="sun.jnu.encoding" value="Cp1252"/>
    <property name="java.library.path" value="C:\Program Files\Java\jdk1.6.0_18\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Ruby191\bin;C:\Program Files\Java\jdk1.6.0_18\bin;C:\java\apache-ant-1.8.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\Program Files\Belgium Identity Card;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\Glassfishv2\bin;C:\apache-maven-2.2.1\bin"/>
    <property name="surefire.test.class.path" value="E:\test\java_projects\libs\primefaces-2.1-RC1-build\target\test-classes;E:\test\java_projects\libs\primefaces-2.1-RC1-build\target\classes;C:\Documents and Settings\cvanhove.OAC\.m2\repository\javax\faces\jsf-api\2.0.2-FCS\jsf-api-2.0.2-FCS.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\javax\faces\jsf-impl\2.0.2-FCS\jsf-impl-2.0.2-FCS.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\javax\servlet\jsp\jsp-api\2.1\jsp-api-2.1.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\portlet-api\portlet-api\1.0\portlet-api-1.0.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\apache\poi\poi\3.2-FINAL\poi-3.2-FINAL.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\commons-logging\commons-logging\1.1\commons-logging-1.1.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\log4j\log4j\1.2.13\log4j-1.2.13.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\com\lowagie\itext\1.4.8\itext-1.4.8.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\commons-fileupload\commons-fileupload\1.2.1\commons-fileupload-1.2.1.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\commons-io\commons-io\1.4\commons-io-1.4.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\atmosphere\atmosphere-runtime\0.5\atmosphere-runtime-0.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\atmosphere\atmosphere-compat-jbossweb\0.5\atmosphere-compat-jbossweb-0.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\atmosphere\atmosphere-compat-tomcat\0.5\atmosphere-compat-tomcat-0.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\atmosphere\atmosphere-compat-weblogic\0.5\atmosphere-compat-weblogic-0.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\junit\junit\4.4\junit-4.4.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\easymock\easymock\2.4\easymock-2.4.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\apache\shale\shale-test\1.0.5\shale-test-1.0.5.jar;"/>
    <property name="java.specification.name" value="Java Platform API Specification"/>
    <property name="java.class.version" value="50.0"/>
    <property name="sun.management.compiler" value="HotSpot Client Compiler"/>
    <property name="os.version" value="5.1"/>
    <property name="user.home" value="C:\Documents and Settings\cvanhove.OAC"/>
    <property name="user.timezone" value=""/>
    <property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
    <property name="java.specification.version" value="1.6"/>
    <property name="file.encoding" value="Cp1252"/>
    <property name="user.name" value="cvanhove"/>
    <property name="java.class.path" value="E:\test\java_projects\libs\primefaces-2.1-RC1-build\target\test-classes;E:\test\java_projects\libs\primefaces-2.1-RC1-build\target\classes;C:\Documents and Settings\cvanhove.OAC\.m2\repository\javax\faces\jsf-api\2.0.2-FCS\jsf-api-2.0.2-FCS.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\javax\faces\jsf-impl\2.0.2-FCS\jsf-impl-2.0.2-FCS.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\javax\servlet\jsp\jsp-api\2.1\jsp-api-2.1.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\portlet-api\portlet-api\1.0\portlet-api-1.0.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\apache\poi\poi\3.2-FINAL\poi-3.2-FINAL.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\commons-logging\commons-logging\1.1\commons-logging-1.1.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\log4j\log4j\1.2.13\log4j-1.2.13.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\com\lowagie\itext\1.4.8\itext-1.4.8.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\commons-fileupload\commons-fileupload\1.2.1\commons-fileupload-1.2.1.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\commons-io\commons-io\1.4\commons-io-1.4.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\atmosphere\atmosphere-runtime\0.5\atmosphere-runtime-0.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\atmosphere\atmosphere-compat-jbossweb\0.5\atmosphere-compat-jbossweb-0.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\atmosphere\atmosphere-compat-tomcat\0.5\atmosphere-compat-tomcat-0.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\atmosphere\atmosphere-compat-weblogic\0.5\atmosphere-compat-weblogic-0.5.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\junit\junit\4.4\junit-4.4.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\easymock\easymock\2.4\easymock-2.4.jar;C:\Documents and Settings\cvanhove.OAC\.m2\repository\org\apache\shale\shale-test\1.0.5\shale-test-1.0.5.jar;"/>
    <property name="java.vm.specification.version" value="1.0"/>
    <property name="sun.arch.data.model" value="32"/>
    <property name="java.home" value="C:\Program Files\Java\jdk1.6.0_18\jre"/>
    <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
    <property name="user.language" value="nl"/>
    <property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
    <property name="java.vm.info" value="mixed mode, sharing"/>
    <property name="java.version" value="1.6.0_18"/>
    <property name="java.ext.dirs" value="C:\Program Files\Java\jdk1.6.0_18\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext"/>
    <property name="sun.boot.class.path" value="C:\Program Files\Java\jdk1.6.0_18\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_18\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_18\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0_18\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_18\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_18\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_18\jre\classes"/>
    <property name="java.vendor" value="Sun Microsystems Inc."/>
    <property name="localRepository" value="C:\Documents and Settings\cvanhove.OAC\.m2\repository"/>
    <property name="file.separator" value="\"/>
    <property name="java.vendor.url.bug" value="http://java.sun.com/cgi-bin/bugreport.cgi"/>
    <property name="sun.cpu.endian" value="little"/>
    <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
    <property name="sun.desktop" value="windows"/>
    <property name="sun.cpu.isalist" value=""/>
  </properties>
  <testcase time="0.015" classname="org.primefaces.model.TreeModelTest" name="shouldFineTreeNodeByRowIndex">
    <error message="Index: 10, Size: 2" type="java.lang.IndexOutOfBoundsException">java.lang.IndexOutOfBoundsException: Index: 10, Size: 2
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at org.primefaces.model.TreeModel.setRowIndex(TreeModel.java:64)
    at org.primefaces.model.TreeModelTest.shouldFineTreeNodeByRowIndex(TreeModelTest.java:86)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
    at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
    at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
    at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
    at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
    at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
    at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
    at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
    at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
    at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
</error>
  </testcase>
</testsuite>
JSF-2.0, mojarra-2.0.2-FCS and PrimeFaces-2.1 on GlassFish v3.0.1 (build 22)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 45 guests