TreeTable and DragAndDropWrapper Question

Hi,

I’d like to enable drag and drop of files from the local machine into nodes of the Tree column in a TreeTable (Add On version 1.2.2). My sample code works fine, until I try and add the DragAndDropWrapper. I’m probably using the DragAndDropWrapper incorrectly, just not sure of the correct way.

The sample code is below, a com.vaadin.event.ListenerMethod$MethodException is thrown at addComponent() since adding the DragAndDropWrapper.

My corresponding drop() method is working fine for dragging and dropping rows btw.

           // listen for selections
	treeTable.addListener(this); 
	treeTable.setSelectable(true);
	treeTable.addActionHandler(this);
	treeTable.setImmediate(true);

            // enable drag and drop of rows - works fine
	treeTable.setDragMode(TableDragMode.MULTIROW);
	treeTable.setDropHandler(this);

            // populate tree table
	treeTable.addContainerProperty("Name", String.class, "Name");
	treeTable.addContainerProperty("Type", String.class, "Type");
	treeTable.addContainerProperty("Size", String.class, "Size");
    
	// need to enable drag drop of files from local drive
	// this is causing the following exception at addComponent(treeTable);
	//      com.vaadin.event.ListenerMethod$MethodException
	//      Cause: java.lang.UnsupportedOperationException
            DragAndDropWrapper wrapper = new DragAndDropWrapper(treeTable);
            wrapper.setSizeUndefined();
    
            Object addItem = treeTable.addItem();
            treeTable.getContainerProperty(addItem, "Name").setValue("First");
            Object addItem2 = treeTable.addItem();
            treeTable.getContainerProperty(addItem2, "Name").setValue("Second");
            Object addItem3 = treeTable.addItem();
             treeTable.getContainerProperty(addItem3, "Name").setValue("Third");

            treeTable.setParent(addItem3, addItem2);
            treeTable.setParent(addItem2, addItem);

             treeTable.setChildrenAllowed(addItem3, false);
    
             // reserve excess space for the tree column
             treeTable.setWidth("100%");
             treeTable.setColumnExpandRatio("Name", 1);
	
              // com.vaadin.event.ListenerMethod$MethodException exception thrown here
              addComponent(treeTable);

If anyone has any sample code you can point me at that would be great.

Instead of instead of calling
addComponent(
treeTable
)
, you need to call
addComponent(
wrapper
)
.

Thanks, but no luck.

Dragging
book-of-vaadin.pdf
from the desktop and hovering over the tree table before releasing the mouse button just results in the file being opened in my browser. I have tried it in both IE 9 and Chrome

Any suggestions?

Anyone? Any example code or suggestions would be great?

cheers