2 Replies Latest reply on Apr 14, 2009 8:31 AM by Sébastien Doncker

    rich:tree DnD problem 3.3.0.CR1: dropListener not triggered

    Daniel Zeiter Newbie

      I have richfaces 3.3.0.CR1 and faclets 1.1.14.

      When dragging and dropping an item of the tree visually (not hierarchically) upwards in the tree dropListener is not triggered. Downwards works.

      In the following example below I can drag Item 1 in Node 2, but not Item 2 in Node 1.

      <rich:tree style="width:300px" value="#{mitarbeiterZuteilenBean.root}"
       switchType="client" dragIndicator="indicator2" var="item"
       treeNodeVar="treeNode"
       nodeFace="#{treeNode.data.type}"
       dropListener="#{mitarbeiterZuteilenBean.dropListener}">
       <rich:treeNode type="node" acceptedTypes="mitarbeiter">
       <h:outputText value="#{item}" />
       </rich:treeNode>
       <rich:treeNode type="item" dragType="mitarbeiter">
       <rich:dndParam name="label" type="drag">#{item}</rich:dndParam>
       <h:outputText value="#{item}" style="color:blue"/>
       </rich:treeNode>
       </rich:tree>
      



      public class MitarbeiterZuteilenBean {
       public class TestElement {
       private String _name;
      
       public TestElement(String name) {
       _name= name;
       }
      
       @Override
       public String toString() {
       return _name;
       }
      
       public String getType() {
       return "other";
       }
       }
      
       public class TestNode extends TestElement {
      
       public TestNode(String name) {
       super(name);
       }
      
       @Override
       public String getType() {
       return "node";
       }
       }
      
       public class TestItem extends TestElement {
      
       public TestItem(String name) {
       super(name);
       }
      
       @Override
       public String getType() {
       return "item";
       }
       }
      
       public class TestTreeNode extends TreeNodeImpl<TestElement> {
      
       private static final long serialVersionUID = 1L;
      
       public String getType() {
       if (getData()!= null) {
       return getData().getType();
       }
       return "other";
       }
      
       }
      
       private TestTreeNode _root;
      
       public MitarbeiterZuteilenBean() throws ZebraException {
       setRoot(new TestTreeNode());
       getRoot().setData(new TestNode("root"));
       TestTreeNode child = new TestTreeNode();
       child.setData(new TestNode("Node 1"));
       getRoot().addChild(1, child);
       TestTreeNode child2 = new TestTreeNode();
       child2.setData(new TestNode("Node 2"));
       getRoot().addChild(2, child2);
       TestTreeNode child3 = new TestTreeNode();
       child3.setData( new TestItem("Item 1"));
       child.addChild(1, child3);
       TestTreeNode child4 = new TestTreeNode();
       child4.setData( new TestItem("Item 2"));
       child2.addChild(1, child4);
       }
      
       public void dropListener(DropEvent dropEvent) {
       System.out.println("was here");
       }
      
       public void setRoot(TestTreeNode testTreeNode) {
       _root = testTreeNode;
       }
      
      
       public TestTreeNode getRoot() {
       return _root;
       }
      }
      


      Is my code wrong or is it a problem in richfaces?