Custom control in TreeNode
hansfl Sep 18, 2008 5:45 AMHi,
I am using a custom control as a child in a TreeNode.
The problem I get is that it looks to be using the same object instance of my custom control when it is present several times in the tree. So changing value in one control also changes the value in the others.
I have confirmed this by debugging and seing how many instances of my custom control are created.
Are there any specific things I need to do when creating a custom control that is being used in a treenode?
Here is the jsf markup for parts of the tree:
<rich:tree id="uitree" binding="#{todoPageBean.toDoTree}" style="width:100%" switchType="ajax" rowKeyVar="rowKey" nodeSelectListener="#{todoPageBean.nodeSelected}" onselected="rtnOnNodeSelection(event)" adviseNodeSelected="#{todoPageBean.adviseNodeSelected}" adviseNodeOpened="#{todoPageBean.adviseNodeOpened}" dropListener="#{todoPageBean.nodeDropped}" changeExpandListener="#{todoPageBean.nodeExpandCollapse}" > <rich:recursiveTreeNodesAdaptor id="itemNode" var="itemNode" nodes="#{itemNode.children}" roots="#{todoPageBean.treeModel.root.children}" > <rich:treeNode rendered="#{itemNode.nodeType.class.name == 'com.mycompany.model.tree.RtnDefaultNodeType'}" onkeyup="rtnDoTreeNodeAction(event, this)" id="deftreenode" dragType="default" acceptedTypes="default, resource" > <rich:inplaceInput value="#{itemNode.name}" id="deftreenodeinput" onviewactivated="rtnDefToDoEditComplete(event)" inputWidth="300px" selectOnEdit="true" styleClass="content" viewClass="content" viewHoverClass="content" changedClass="content" changedHoverClass="content" controlClass="content" controlHoverClass="content" controlPressedClass="content" editClass="content" editEvent="ondblclick" style="background-color: #{itemNode.nodeType.colour}"/> <rich:dndParam name="defdraglabel" type="drag" value="#{itemNode.name}" /> </rich:treeNode> <rich:treeNode id="listlookuptreenode" rendered ="#{itemNode.nodeType.class.name == 'com.mycompany.model.tree.RtnListLookupNodeType'}"> <h:outputLabel styleClass="content" value="#{itemNode.tableName}: " /> <rtn:inccombobox id="lookuptreecontrol" width="320" height="20" tableName="#{itemNode.tableName}" fieldName="name" dropDownParentName="getDocBody()" valueChangeListener="#{todoPageBean.subNodeNamesChanged}" query="#{itemNode.tableQuery}" > <a4j:support event="onchange" reRender="#{todoPageBean.defaultReRender}" /> </rtn:inccombobox> </rich:treeNode> </rich:recursiveTreeNodesAdaptor> </rich:tree>
all controls are working fine except for the rtn:inccombobox one which is my custom control
Thanks in advance for your help
Hans Fladsrud