nodeSelectListener: WARN lifecycle NP Exception + JScript er
j-pro Sep 27, 2007 2:54 PMGood afternoon.
Today is a day of unresolvable errors as I see...
I use rich:recursiveTreeNodesAdaptor and want to do some action while user clicks on the node. So for that I have:
<h:form id="employeesDataTable_form"> <rich:tree style="width:250px" styleClass="tree" switchType="ajax" ajaxSubmitSelection="true" showConnectingLines="true" stateAdvisor="#{departmentTreeStateAdvisor}" nodeSelectListener="#{am.onDepartmentTreeSelect}"> <rich:recursiveTreeNodesAdaptor roots="#{amBean.departmentsTreeRoots}" var="item" nodes="#{item.nodes}" /> </rich:tree> </h:form>
onDepartmentTreeSelect method:
public void onDepartmentTreeSelect(NodeSelectedEvent event) { if(event == null) { System.out.println("############### >>>>> Event IS NULL !!!"); return; } UITree tree = (UITree) event.getComponent(); System.out.println("################# >>>>> Tree node selected"); if(tree == null) { System.out.println("############### >>>>> Tree IS NULL !!!"); return; } TreeNode selectedNode = tree.getTreeNode(); if(selectedNode.isLeaf()) System.out.println("#### > Is leaf"); else System.out.println("#### > Is NOT leaf"); Object data = selectedNode.getData(); if(data == null) System.out.println("#### > DATA Is null"); else System.out.println("#### > DATA Is NOT null"); Iterator children = selectedNode.getChildren(); System.out.println("#### > Children:"); while(children.hasNext()) { TreeNode tn = (TreeNode)children.next(); if(tn.isLeaf()) System.out.println("## > Is leaf"); else System.out.println("## > Is NOT leaf"); data = tn.getData(); if(data == null) System.out.println("###> DATA Is null"); else System.out.println("## > DATA Is NOT null"); } System.out.println("################# >>>>> Tree node selected FINISH"); }
Having all that, while opening the app in Firefox, I see(via Firebug) 7 errors:
$ is not defined http://localhost:8080/HRD/a4j_3_1_0org/richfaces/renderkit/html/scripts/tree-item.js.jsf Line 25 $ is not defined http://localhost:8080/HRD/a4j_3_1_0org/richfaces/renderkit/html/scripts/tree-item.js.jsf Line 23 $ is not defined http://localhost:8080/HRD/a4j_3_1_0org/richfaces/renderkit/html/scripts/tree-item.js.jsf Line 25 $ is not defined http://localhost:8080/HRD/a4j_3_1_0org/richfaces/renderkit/html/scripts/tree-item.js.jsf Line 23 $ is not defined http://localhost:8080/HRD/a4j_3_1_0org/richfaces/renderkit/html/scripts/tree-item.js.jsf Line 25 $ is not defined http://localhost:8080/HRD/a4j_3_1_0org/richfaces/renderkit/html/scripts/tree-item.js.jsf Line 23 $ is not defined http://localhost:8080/HRD/a4j_3_1_0org/richfaces/renderkit/html/scripts/tree-item.js.jsf Line 25
The JS code in these 23 and 25 lines is:
... 23 this.fireExpansionEvent();},isCollapsed:function(){var e=$(this.elementID.children);if(e){return e.style.display=="none";}else{return true;}},processMouseOut:function(e){if(this.isMouseIn){this.isMouseIn=false;var eText=$(this.elementID.text);var hClass=Richfaces.getNSAttribute("highlightedclass",eText);if(hClass){var classNames=hClass.split(' ') ... 25 if(window.drag){this.dragLeave(e);}}}},processMouseOver:function(e){if(!this.isMouseIn){this.isMouseIn=true;var eText=$(this.elementID.text);var hClass=Richfaces.getNSAttribute("highlightedclass",eText);if(hClass){var classNames=hClass.split(' ') ...
And when I click on the node, all I see in console is:
21:34:09,801 INFO [STDOUT] ################# >>>>> Tree node selected 21:34:09,801 WARN [lifecycle] /staff.xhtml @24,69 nodeSelectListener="#{am.onDepartmentTreeSelect}": java.lang.NullPointerException
That's all.... No stack trace or something... But in the logs is:
2007-09-27 21:34:09,801 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] Process after phase UPDATE_MODEL_VALUES 4 2007-09-27 21:34:09,801 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] Process before phase INVOKE_APPLICATION 5 2007-09-27 21:34:09,801 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] Process after phase INVOKE_APPLICATION 5 2007-09-27 21:34:09,801 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] Process before phase RENDER_RESPONSE 6 2007-09-27 21:34:09,801 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] PhaseListener enter Before RenderView Phase with ViewId /staff.xhtml and RenderKitId HTML_BASIC 2007-09-27 21:34:09,801 DEBUG [org.ajax4jsf.application.AjaxViewHandler] Process AJAX events to calculate areas. ...
If i press on the node again - console outputs the same. Why does it happen? I can't find my error here... Maybe a bug?