2 Replies Latest reply on Nov 16, 2009 5:03 PM by agurisatti

    Tree dnd + context menu problem. Context menú

    agurisatti

      I have a tree with dnd enabled and a context menu attached to it using right mouse click.

      After a dnd operation, the context menu is lost.

      So, to be sure, I tried it using richfaces demo dnd support for trees with the same result.

      The simpleDnd.xhtml code (taken from demo) modified to attach the context menu is here.

      The project is working with:
      Seam 2.2.0
      Richfaces 3.3.2SR1

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      
      <ui:composition template="/templates/home-template.xhtml">
       <ui:define name="body">
       <style>
       .col1, .col2 {
       width:50%;
       vertical-align:top;
       }
       .rich-table-cell, .rich-table{
       border:none;
       }
       .indicatorPicture {
       width: 80px;
       }
       </style>
      
       <rich:dragIndicator id="indicator1" >
       <f:facet name="single">
       <h:graphicImage styleClass="indicatorPicture" value="/richfaces/jQuery/images/{draggedImage}" />
       </f:facet>
       </rich:dragIndicator>
       <rich:dragIndicator id="indicator2" />
      
       <h:form>
       <h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
      
       <rich:tree ajaxKeys="#{null}" style="width:300px" nodeSelectListener="#{simpleTreeDndBean.processSelection}"
       reRender="selectedNode" ajaxSubmitSelection="true" switchType="client" dragIndicator="indicator2"
       value="#{simpleTreeDndBean.treeNode}" var="item" id="tree" treeNodeVar="treeNode"
       dropListener="#{simpleTreeDndBean.dropListener}" nodeFace="#{treeNode.parent.parent == null ? 'node' : 'leaf'}"
       rightClickSelection="true">
       <rich:treeNode type="node" acceptedTypes="pic" icon="#{simpleTreeDndBean.treeNode.icon}" iconLeaf="#{simpleTreeDndBean.treeNode.leafIcon}">
       <h:outputText value="#{item}"/>
       </rich:treeNode>
       <rich:treeNode type="leaf" dragType="pic">
       <rich:dndParam name="label" type="drag">#{item}</rich:dndParam>
      
       <h:outputText value="#{item}"/>
       </rich:treeNode>
       </rich:tree>
       <rich:contextMenu event="oncontextmenu" attachTo="tree" submitMode="ajax">
       <rich:menuItem value="#{msg['function.btnAddFunction']}" icon="/images/create_doc.gif"
       actionListener="#{simpleTreeDndBean.addFunction}"/>
       </rich:contextMenu>
       </h:panelGrid>
       </h:form>
      
       </ui:define>
      </ui:composition>
      
      </html>



      The managed bean was treated as a Seam component by:

      @Name("simpleTreeDndBean")
      @Scope(ScopeType.PAGE)
      public class SimpleTreeDndBean implements Serializable {
      
      .....
      
      

      I would appreciate any help to solve the problem.

      Thanks in advance,
      Antonio Gurisatti