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.