Vaadin 7拖放识别Target组件

时间:2014-11-11 13:18:15

标签: drag-and-drop vaadin vaadin7

我可以通过以下方式从DragAndDropEvent获取源组件:

final DataBoundTransferable t = (DataBoundTransferable) event.getTransferable();
Component from = t.getSourceComponent();

如何从DragAndDropEvent获取目标组件? (释放鼠标的组件。)遗憾的是没有t.getTargetComponent()......

感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

查看Drag & Drop secion of the book of vaadin

event.getTargetDetails()应该是您搜索的内容

public void drop(DragAndDropEvent event) {
        // Wrapper for the object that is dragged
        Transferable t = event.getTransferable();

        // Make sure the drag source is the same tree
        if (t.getSourceComponent() != tree)
            return;

        TreeTargetDetails target = (TreeTargetDetails)
            event.getTargetDetails();
        ....