1 Reply Latest reply on Dec 15, 2008 9:30 AM by nbelaevski

    Regression in trees drag and drop support in RF 3.3.0.BETA3

    nfeybesse

      Hi

      The following code works nice in Richfaces 3.3.0.BETA2 and don't work anymore in Richfaces 3.3.0.BETA3.

      Error message :

      05:27:16,473 INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=form:tree:j__id3:0:j__id3:1:[severity=(ERROR 2), summary=(Dropzone [form:tree:j__id3:0:j__id3:1:] with accepted types null cannot accept Draggable [form:tree:j__id3:0:j__id3:1::treeNode-] with dragType [node]), detail=(Dropzone [form:tree:j__id3:0:j__id3:1:]with accepted types null cannot accept Draggable [form:tree:j__id3:0:j__id3:1::treeNode-] with dragType [node])]



      <!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:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a="http://richfaces.org/a4j"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:rich="http://richfaces.org/rich">
      
      <body>
      <f:view>
      
       <rich:panel>
       <rich:dragIndicator id="treeindicator" />
       <a:form id="form">
       <rich:tree id="tree">
       <rich:recursiveTreeNodesAdaptor roots="#{test.root}" var="item"
       nodes="#{item.subNodes}">
       <rich:treeNode id="treeNode-#{item}"
       acceptedTypes="node"
       dragType="node"
       dragValue="#{item}"
       dropValue="#{item}"
       dragIndicator=":treeindicator"
       dropListener="#{test.processDrop}">
      
       <rich:dndParam name="label" type="drag" value="#{item}" />
      
       <h:outputText value="#{item.name}" />
       </rich:treeNode>
       </rich:recursiveTreeNodesAdaptor>
       </rich:tree>
       </a:form>
       </rich:panel>
      
      </f:view>
      
      </body>
      </html>
      


      Bean code :

      package com.genericsystem.application;
      
      import java.util.ArrayList;
      import java.util.Arrays;
      import java.util.List;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.log.Log;
      import org.jboss.seam.log.Logging;
      import org.richfaces.event.DropEvent;
      
      @Name("test")
      @Scope(ScopeType.SESSION)
      public class Test {
       private static final Log log=Logging.getLog(Test.class);
      
       private Node root=new Node("Node1","Node1.1","Node1.2","Node1.3","Node1.4");
      
       public Node getRoot() {
       return root;
       }
      
       public void processDrop(DropEvent dropEvent){
       log.info("processDrop on : "+this);
       log.info("Drag value : "+dropEvent.getDragValue());
       log.info("Drop value : "+dropEvent.getDropValue());
       }
      
       public class Node {
       private List<Node> subNodes=new ArrayList<Node>();
       private String name;
      
       public Node(String name, String... subNodeNames){
       this.name=name;
       for(String subNodeName:Arrays.asList(subNodeNames))
       subNodes.add(new Node(subNodeName));
       }
      
       public List<Node> getSubNodes() {
       return subNodes;
       }
      
       public String getName() {
       return name;
       }
      
       @Override
       public String toString(){
       return getName();
       }
       }
      }