[ https://issues.apache.org/jira/browse/WICKET-1366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571744#action_12571744 ]
Matej Knopp commented on WICKET-1366: ------------------------------------- Hi, the check in AjaxRequestTarget is intentional. Problem is that the tree update should be called only once during request before the actual render. I'll see if I can do that automatic somehow. > "ava.lang.IllegalStateException: No Page found for component" when collapsing > nodes in a LinkTree > ------------------------------------------------------------------------------------------------- > > Key: WICKET-1366 > URL: https://issues.apache.org/jira/browse/WICKET-1366 > Project: Wicket > Issue Type: Bug > Components: wicket > Affects Versions: 1.3.1 > Reporter: Sebastiaan van Erk > Assignee: Matej Knopp > > I'm trying to have a wicket LinkTree collapse and expand subtrees when I > click on the respective nodes. I have the following code: > tree = new LinkTree("tree", createTreeModel()) { > @Override > protected void onNodeLinkClicked(final TreeNode node, final > BaseTree tree, final AjaxRequestTarget target) { > if (!node.isLeaf()) { > if (tree.getTreeState().isNodeExpanded(node)) { > collapseAll(node); > } else { > expandAll(node); > } > tree.updateTree(target); > } else { > > System.out.println(Arrays.toString(((DefaultMutableTreeNode) > node).getUserObjectPath())); > } > } > }; > with the methods expandAll/collapseAll as follows: > protected void collapseAll(final TreeNode treeNode) { > tree.getTreeState().collapseNode(treeNode); > for (final Enumeration e = treeNode.children(); e.hasMoreElements();) > { > collapseAll((TreeNode) e.nextElement()); > } > } > protected void expandAll(final TreeNode treeNode) { > tree.getTreeState().expandNode(treeNode); > for (final Enumeration e = treeNode.children(); e.hasMoreElements();) > { > expandAll((TreeNode) e.nextElement()); > } > } > However, I keep getting the following errors (specifically, this happens when > I collapse a subtree first, and then collapse a subtree of which the other > subtree is a sibling): > java.lang.IllegalStateException: No Page found for component [MarkupContainer > [Component id = 200, page = <No Page>, path = 200.AbstractTree$TreeItem]] > at org.apache.wicket.Component.getPage(Component.java:1639) > at > org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:689) > at > org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:605) > at > org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:520) > at > org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103) > at > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172) > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1241) > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1316) > at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) > at > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354) > at > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) > at java.lang.Thread.run(Thread.java:595) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.