3 Replies Latest reply on Feb 23, 2011 7:47 AM by Christian Peter

    rich:recursiveTreeNodesAdaptor drag and drop

    Ulas Cakir Newbie

      Hi,

       

           I wonder how we can make drag and drop capable rich:recursiveTreeNodesAdaptor ?

       

      Thanks for your time.

       

      ----------------------------------------------------------------------------------------------------------

       

      I found my answer:

       

       

                          <rich:dragIndicator id="indicator" />

       

                                  <rich:tree style="width:100%" switchType="client"

                                               id="tree" icon="/images/node.png"                                                   

                                               iconLeaf="/images/leaf.png"

                                               iconCollapsed="/images/node_collapse.png"

                                               iconExpanded="/image/node_expand.png"                                      
                                               ajaxSubmitSelection="true"
                                               nodeSelectListener="#{Bean.processSelection}"
                                               dragListener="#{Bean.dragListener}"
                                               dropListener="#{Bean.dropListener}"
                                               dragIndicator="indicator"                                        
                                               >
                                       <rich:recursiveTreeNodesAdaptor id="recNodeAdaptor"

                                              roots="#{Bean.root}" var="item"

                                              nodes="#"{item.node}" >                                                                     
                                           <rich:treeNode id="treeNodeId"

                                               icon="/images/node.png" iconLeaf="/images/leaf.png"                                                  
                                               ajaxSingle="true" dragType="all"

                                               acceptedTypes="all" >                                             
                                               <h:outputText value="#{item.value}" />
                                              <rich:dndParam name="label" type="drag"

                                                        value="#{item.value}" />                                                   
                                          </rich:treeNode>                                       
                                       </rich:recursiveTreeNodesAdaptor>
                                      
                                  </rich:tree>

       


      But I still have a problem..  drag/ drop operation is possible only on itself, i.e. listeners are triggered  only in case drag node1 and drop it on node1 (itself). (Orijinal message:  https://jira.jboss.org/jira/browse/RF-7693 )

       

      Waiting for your concern and replies..

        • 1. rich:recursiveTreeNodesAdaptor drag and drop
          Christian Peter Expert

          have you tried without the ajaxSingle="true" attribute? I experienced the same strange effect only yesterday.

          • 2. rich:recursiveTreeNodesAdaptor drag and drop
            Ulas Cakir Newbie

            Thank you for reply.

             

            I use code below instead of rich:recursiveTreeNodesAdaptor

             

             

            <rich:tree           id="tree"

                      switchType="client"

                      style="width:1000px; height:260px; overflow:auto; " 

                      icon="/images/node.png"

                      iconLeaf="/images/leaf.png"

                      iconCollapsed="/images/plus.png"

                      iconExpanded="/images/minus.png"

                      ajaxSubmitSelection="true"

                      nodeSelectListener="bean.processSelection"

                      reRender="somewhere"

                      value="bean.root"

                      var="item"

                      dragListener="bean.dragListener"

                      dropListener="bean.dropListener"

                      dragIndicator="dragIndicator"

                      adviseNodeOpened="bean.adviseNodeOpened"

                      adviseNodeSelected="bean.adviseNodeSelected"

                      oncomplete="dosomething"

                      >

             

                      <rich:treeNode dragType="all" acceptedTypes="all">

                                               <h:outputText value="#{item}" style="font-family:Lucida Console; font-size:8pt"/>

                                               <a4j:support event="ondropend" reRender="tree" oncomplete="dosomething" />

                      </rich:treeNode>                      

             

            </rich:tree>

            • 3. rich:recursiveTreeNodesAdaptor drag and drop
              Christian Peter Expert

              this one works with dragNdrop:

               

              <rich:tree id="myItemTree"

                                 treeNodeVar="node"

                                 rowKeyVar="rowKey"

                                 toggleOnClick="false"                  

                                 ajaxSubmitSelection="true"

                                 ajaxSingle="false"

                                 dragIndicator="indicator1"

                                 dropListener="#{myManager.treeDropListener}"             

                                 >

              <rich:recursiveTreeNodesAdaptor var="req"

                                                        roots="#{selectedProject.reqItems}"

                                                        nodes="#{req.children}"

                                                        includedRoot="#{req.parent == null}">

              <rich:treeNode acceptedTypes="taskNode"

                           dragType="taskNode"

                           >

                   ...

              <rich:dndParam name="label" type="drag">#{req.name}</rich:dndParam>

              </rich:treeNode>

               

              </rich:recursiveTreeNodesAdaptor>

              </rich:tree>