Problems with using shortcuts in Vaadin

江枫思渺然 提交于 2019-12-04 17:00:48

I'm not sure if this is the best or the most beautiful way to achieve this, but at least it works:

textField.addListener(new BlurListener() {
    @Override
    public void blur(BlurEvent event) {
        tablePanel.addActionHandler(deleteHandler);
    }
});

textField.addListener(new FocusListener() {
    @Override
    public void focus(FocusEvent event) {
        tablePanel.removeActionHandler(deleteHandler);
    }
});

These listeners will take care of the deleteHandler by disabling it every time the user enters the field and enabling it whenever the user leaves the field.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!