Button 如何识别vaadin表格中的行是否失去焦点

Button 如何识别vaadin表格中的行是否失去焦点,button,listener,vaadin,Button,Listener,Vaadin,是否有办法识别所选行是否失去焦点(用户选择另一行或单击其他位置)?我想addItemClickListener在这里不起作用 示例: 我有一个按钮表,只有选中该行时才能启用。您可以在表上使用一个按钮。 在单选模式下,您将收到所选项目;在多选模式下,您将收到包含所有所选项目的集合 // Allow selecting items from the table. table.setSelectable(true); // Send changes in selection immediately

是否有办法识别所选行是否失去焦点(用户选择另一行或单击其他位置)?我想addItemClickListener在这里不起作用

示例:
我有一个按钮表,只有选中该行时才能启用。

您可以在表上使用一个按钮。 在单选模式下,您将收到所选项目;在多选模式下,您将收到包含所有所选项目的集合

// Allow selecting items from the table.
table.setSelectable(true);

// Send changes in selection immediately to server.
table.setImmediate(true);

// Shows feedback from selection.
final Label current = new Label("Selected: -");

// Handle selection change.
table.addValueChangeListener(new Property.ValueChangeListener() {
    public void valueChange(ValueChangeEvent event) {
        current.setValue("Selected: " + table.getValue());
    }
});

你能详细解释一下“失去注意力”是什么意思吗?您有一个表,单击可在其中选择一行。通过该选择(例如值更改侦听器),您将激活某些内容。稍后,您将选择其他行(或无行),并可以做出相应的反应。是的,这就是我启用该行的按钮。但是如果用户选择anstehe行,我想再次禁用该按钮。我可以这样做,也许男孩记得行Id,但如果有一个听众,世界会更容易。像鼠标按钮释放事件一样,我宁愿使用select处理程序并记住上一个。这对客户机-服务器往返等的影响最小。