java - Vaadin 网格 : How to disable mouse event handler which runs inline editor?

标签 java vaadin vaadin7 vaadin-grid

我正在使用带有打开编辑器 (setEditorEnabled(true)) 的网格,但我将通过调用 editItem() 方法以编程方式启动内联编辑器。如何禁用运行内联编辑器的鼠标事件处理程序?

最佳答案

感谢@Morfic,我解决问题如下:

Grid grid = new Grid(){
    @Override
    protected void doCancelEditor() {
        super.doCancelEditor();
        setEditorEnabled(false); // disable the editor every time when editing is completed
    }
};

grid.setEditorEnabled(false); // by default the editor is disabled

....
// grid initialization
....

// create any component (button for example) which will call the editor
Button button = new Button("Edit");
button.addClickListener((Button.ClickListener) event -> {
    grid.setEditorEnabled(true); // activate the editor when the desired event occurred
    grid.editItem(itemId); // call the editor with itemId (it may be selected itemId)
});

关于java - Vaadin 网格 : How to disable mouse event handler which runs inline editor?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38916506/

相关文章:

java - 将int转换为unsigned short java

gwt - 如何在vaadin组件中设置属性?

gwt - 服务器端 GWT 事件; Vaadin 的替代品

vaadin - BeanFieldGroup 与 FieldGroup 与 BeanItem 的比较?

java - 尝试将数组传递给 Java 中的不同类

java - Java 中的线程安全枚举集

gwt - Vaadin - 总是需要 GWT 依赖?

microsoft-edge - 不要使用 Vaadin 和 Edge 将数据存储在输入字段中

eclipse - 无法从新的 tomcat 安装运行 war 文件

java - 单元测试时支持H2数据库中的DB2功能