Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

How to disable verification dialog when connection error

Sami Viitanen edited this page Feb 27, 2014 · 1 revision

To disable verification dialog, you must override default ApplicationConnection class, and call temporary disabling before presenting connection error.

package org.vaadin.alump.beforeunload.example.gwt.client;

import org.vaadin.alump.beforeunload.gwt.client.connect.BeforeUnloadConnector;

import com.vaadin.client.ApplicationConnection;

/**
 * Disable verification dialog when connection error
 */
public class MyApplicationConnection extends ApplicationConnection {

    @Override
    protected void showCommunicationError(String details, int statusCode) {
        // 5s should be safe value
        BeforeUnloadConnector.disableTemporary(5000);
        super.showCommunicationError(details, statusCode);
    }
}

and then replace default ApplicationConnection with it (your widgetset gwt.xml file)...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.vaadin.DefaultWidgetSet" />
    ...
    <inherits name="org.vaadin.alump.beforeunload.gwt.BeforeUnloadWidgetSet" />
    <inherits name="com.ejt.vaadin.loginform.WidgetSet" />
    
    <replace-with class="org.vaadin.alump.beforeunload.example.gwt.client.MyApplicationConnection">
        <when-type-is class="com.vaadin.client.ApplicationConnection"/>
    </replace-with>
</module>
Clone this wiki locally