How to implement drag and drop functionality between two components?

Hello,

I’m not sure about TreeTable, but for DataGrid and TreeDataGrid drag and drop can be implemented using Vaadin API

Documentation: Drag and Drop | Advanced Topics | Framework | Vaadin Docs

Example:

        var vaadinGrid = grid.unwrap(com.vaadin.ui.Grid.class);
        var dragSource = new GridDragSource<Specialty>(vaadinGrid);
        dragSource.setEffectAllowed(EffectAllowed.LINK);
        dragSource.setDragDataGenerator(DragSourceState.DATA_TYPE_TEXT_PLAIN, item -> item.getId().toString());
        var vaadinTreeGrid = treeGrid.unwrap(com.vaadin.ui.TreeGrid.class);
        var dropTarget = new TreeGridDropTarget<Specialty>(vaadinTreeGrid, DropMode.ON_TOP);
        dropTarget.addTreeGridDropListener(event -> {
            String dragItem = event.getDataTransferData(DragSourceState.DATA_TYPE_TEXT_PLAIN)
                    .map(UUID::fromString)
                    .map(id -> grid.getItems().getItem(id))
                    .map(Specialty::getName)
                    .orElse(null);
            String dropItem = event.getDropTargetRow()
                    .map(Specialty::getName)
                    .orElse(null);
            System.out.println("dragItem=" + dragItem + ", dropItem=" + dropItem);
        });