Search in sources :

Example 1 with WebBrowser

use of com.vaadin.server.WebBrowser in project cuba by cuba-platform.

the class ConnectionImpl method makeClientInfo.

protected String makeClientInfo() {
    // timezone info is passed only on VaadinSession creation
    WebBrowser webBrowser = getWebBrowserDetails();
    // noinspection UnnecessaryLocalVariable
    String serverInfo = String.format("Web (%s:%s/%s) %s", globalConfig.getWebHostName(), globalConfig.getWebPort(), globalConfig.getWebContextName(), webBrowser.getBrowserApplication());
    return serverInfo;
}
Also used : WebBrowser(com.vaadin.server.WebBrowser)

Example 2 with WebBrowser

use of com.vaadin.server.WebBrowser in project cuba by cuba-platform.

the class ConnectionImpl method getWebBrowserDetails.

protected WebBrowser getWebBrowserDetails() {
    // timezone info is passed only on VaadinSession creation
    WebBrowser webBrowser = VaadinSession.getCurrent().getBrowser();
    VaadinRequest currentRequest = VaadinService.getCurrentRequest();
    // it can be null in case of background/async processing of login request
    if (currentRequest != null) {
        webBrowser.updateRequestDetails(currentRequest);
    }
    return webBrowser;
}
Also used : WebBrowser(com.vaadin.server.WebBrowser) VaadinRequest(com.vaadin.server.VaadinRequest)

Example 3 with WebBrowser

use of com.vaadin.server.WebBrowser in project ANNIS by korpling.

the class SearchView method notifyCannotPlayMimeType.

@Override
public void notifyCannotPlayMimeType(String mimeType) {
    if (mimeType == null) {
        return;
    }
    if (mimeType.startsWith("audio/ogg") || mimeType.startsWith("video/web")) {
        String browserList = "<ul>" + "<li>Mozilla Firefox: <a href=\"http://www.mozilla.org/firefox\" target=\"_blank\">http://www.mozilla.org/firefox</a></li>" + "<li>Google Chrome: <a href=\"http://www.google.com/chrome\" target=\"_blank\">http://www.google.com/chrome</a></li>" + "</ul>";
        WebBrowser browser = Page.getCurrent().getWebBrowser();
        // IE9 users can install a plugin
        Set<String> supportedByIE9Plugin = new HashSet<>();
        supportedByIE9Plugin.add("video/webm");
        supportedByIE9Plugin.add("audio/ogg");
        supportedByIE9Plugin.add("video/ogg");
        if (browser.isIE() && browser.getBrowserMajorVersion() >= 9 && supportedByIE9Plugin.contains(mimeType)) {
            Notification n = new Notification("Media file type unsupported by your browser", "Please install the WebM plugin for Internet Explorer 9 from " + "<a target=\"_blank\" href=\"https://tools.google.com/dlpage/webmmf\">https://tools.google.com/dlpage/webmmf</a> " + " or use a browser from the following list " + "(these are known to work with WebM or OGG files)<br/>" + browserList + "<br/><br /><strong>Click on this message to hide it</strong>", Notification.Type.WARNING_MESSAGE, true);
            n.setDelayMsec(15000);
            n.show(Page.getCurrent());
        } else {
            Notification n = new Notification("Media file type unsupported by your browser", "Please use a browser from the following list " + "(these are known to work with WebM or OGG files)<br/>" + browserList + "<br/><br /><strong>Click on this message to hide it</strong>", Notification.Type.WARNING_MESSAGE, true);
            n.setDelayMsec(15000);
            n.show(Page.getCurrent());
        }
    } else {
        Notification.show("Media file type \"" + mimeType + "\" unsupported by your browser!", "Try to check your browsers documentation how to enable " + "support for the media type or inform the corpus creator about this problem.", Notification.Type.WARNING_MESSAGE);
    }
}
Also used : WebBrowser(com.vaadin.server.WebBrowser) Notification(com.vaadin.ui.Notification) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 4 with WebBrowser

use of com.vaadin.server.WebBrowser in project cuba by cuba-platform.

the class ConnectionImpl method detectTimeZone.

protected TimeZone detectTimeZone() {
    WebBrowser webBrowser = getWebBrowserDetails();
    int offset = webBrowser.getTimezoneOffset() / 1000 / 60;
    char sign = offset >= 0 ? '+' : '-';
    int absOffset = Math.abs(offset);
    String hours = StringUtils.leftPad(String.valueOf(absOffset / 60), 2, '0');
    String minutes = StringUtils.leftPad(String.valueOf(absOffset % 60), 2, '0');
    return TimeZone.getTimeZone("GMT" + sign + hours + minutes);
}
Also used : WebBrowser(com.vaadin.server.WebBrowser)

Example 5 with WebBrowser

use of com.vaadin.server.WebBrowser in project cuba by cuba-platform.

the class CubaImage method attach.

@Override
public void attach() {
    super.attach();
    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if (webBrowser.isIE() || webBrowser.isEdge()) {
        CubaImageObjectFitPolyfillExtension.get(getUI());
    }
}
Also used : WebBrowser(com.vaadin.server.WebBrowser)

Aggregations

WebBrowser (com.vaadin.server.WebBrowser)7 Page (com.vaadin.server.Page)2 UserConfiguration (com.hack23.cia.service.api.UserConfiguration)1 CreateApplicationSessionRequest (com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest)1 ServiceResponse (com.hack23.cia.service.api.action.common.ServiceResponse)1 DeviceInfo (com.haulmont.cuba.gui.config.DeviceInfo)1 VaadinRequest (com.vaadin.server.VaadinRequest)1 Notification (com.vaadin.ui.Notification)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Nullable (javax.annotation.Nullable)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1