Example usage for com.vaadin.server WebBrowser isIE

List of usage examples for com.vaadin.server WebBrowser isIE

Introduction

In this page you can find the example usage for com.vaadin.server WebBrowser isIE.

Prototype

public boolean isIE() 

Source Link

Document

Tests whether the user is using Internet Explorer.

Usage

From source file:annis.gui.SearchUI.java

License:Apache License

@Override
public void notifyCannotPlayMimeType(String mimeType) {
    if (mimeType == null) {
        return;/*from w w w.  jav  a 2  s.co  m*/
    }

    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 = getPage().getWebBrowser();

        // IE9 users can install a plugin
        Set<String> supportedByIE9Plugin = new HashSet<String>();
        supportedByIE9Plugin.add("video/webm");
        supportedByIE9Plugin.add("audio/ogg");
        supportedByIE9Plugin.add("video/ogg");

        if (browser.isIE() && browser.getBrowserMajorVersion() >= 9
                && supportedByIE9Plugin.contains(mimeType)) {
            Notification.show("Media file type unsupported by your browser",
                    "Please install the WebM plugin for Internet Explorer 9 from "
                            + "<a 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,
                    Notification.Type.WARNING_MESSAGE);
        } else {
            Notification.show("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,
                    Notification.Type.WARNING_MESSAGE);
        }
    } 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);
    }

}

From source file:annis.gui.SearchView.java

License:Apache License

@Override
public void notifyCannotPlayMimeType(String mimeType) {
    if (mimeType == null) {
        return;//from   w w  w  .j a  v  a  2  s .  c  o m
    }

    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);
    }

}

From source file:com.esofthead.mycollab.community.ui.chart.JFreeChartWrapper.java

License:Open Source License

@Override
public void attach() {
    super.attach();
    if (mode == RenderingMode.AUTO) {
        WebBrowser browser = Page.getCurrent().getWebBrowser();
        if (browser.isIE() && browser.getBrowserMajorVersion() < 9) {
            setRenderingMode(RenderingMode.PNG);
        } else {//from   ww w  .  ja  v a 2  s.  c o m
            // all decent browsers support SVG
            setRenderingMode(RenderingMode.SVG);
        }
    }
    setResource("src", getSource());
}

From source file:com.foc.vaadin.gui.components.chart.JFreeChartWrapper.java

License:Apache License

@Override
public void attach() {
    super.attach();
    if (mode == RenderingMode.AUTO) {
        WebBrowser browser = getSession().getBrowser();
        if (browser.isIE() && browser.getBrowserMajorVersion() < 9) {
            setRenderingMode(RenderingMode.PNG);
        } else {/*  w  ww . jav a2  s. c o  m*/
            // all decent browsers support SVG
            setRenderingMode(RenderingMode.SVG);
        }
    }
    // Workaround for a regression that Vaadin core update caused
    // at some point
    setResource("src", getSource());
}

From source file:com.foc.vaadin.gui.components.chart.JFreeChartWrapper_Modified.java

License:Apache License

@Override
public void attach() {
    //      super.attach();
    //      AbstractWebApplicationContext context = (AbstractWebApplicationContext) getUI().getContext();
    ServletContext context = VaadinServlet.getCurrent().getServletContext();
    if (mode == RenderingMode.AUTO) {
        WebBrowser webBrowser = getWebBrowser();
        if (webBrowser.isIE() && webBrowser.getBrowserMajorVersion() < 9) {
            setRenderingMode(RenderingMode.PNG);
        } else {//from   ww  w .  j  ava 2 s  .c om
            // all decent browsers support SVG
            setRenderingMode(RenderingMode.SVG);
        }
    }
    ;
    Image image = new Image("", getSource());

    chartLayout.addComponent(image);
    //VAADIN 7
    //      getApplication().addResource((ConnectorResource) getSource());

    setResource("src", getSource());//Antoine See Workarround from https://vaadin.com/forum#!/thread/8366526
    markAsDirtyRecursive();
}

From source file:com.haulmont.cuba.web.config.WebDeviceInfoProvider.java

License:Apache License

@Nullable
@Override//w w  w .  jav  a 2 s.  co m
public DeviceInfo getDeviceInfo() {
    // per request cache
    HttpServletRequest currentServletRequest = VaadinServletService.getCurrentServletRequest();
    if (currentServletRequest == null) {
        return null;
    }

    DeviceInfo deviceInfo = (DeviceInfo) currentServletRequest.getAttribute(DeviceInfoProvider.NAME);
    if (deviceInfo != null) {
        return deviceInfo;
    }

    Page page = Page.getCurrent();

    if (page == null) {
        return null;
    }

    WebBrowser webBrowser = page.getWebBrowser();

    DeviceInfo di = new DeviceInfo();

    di.setAddress(webBrowser.getAddress());
    di.setBrowserApplication(webBrowser.getBrowserApplication());
    di.setBrowserMajorVersion(webBrowser.getBrowserMajorVersion());
    di.setBrowserMinorVersion(webBrowser.getBrowserMinorVersion());

    di.setChrome(webBrowser.isChrome());
    di.setChromeFrame(webBrowser.isChromeFrame());
    di.setChromeFrameCapable(webBrowser.isChromeFrameCapable());
    di.setEdge(webBrowser.isEdge());
    di.setFirefox(webBrowser.isFirefox());
    di.setOpera(webBrowser.isOpera());
    di.setIE(webBrowser.isIE());

    if (webBrowser.isWindows()) {
        di.setOperatingSystem(OperatingSystem.WINDOWS);
    } else if (webBrowser.isAndroid()) {
        di.setOperatingSystem(OperatingSystem.ANDROID);
    } else if (webBrowser.isIOS()) {
        di.setOperatingSystem(OperatingSystem.IOS);
    } else if (webBrowser.isMacOSX()) {
        di.setOperatingSystem(OperatingSystem.MACOSX);
    } else if (webBrowser.isLinux()) {
        di.setOperatingSystem(OperatingSystem.LINUX);
    }

    di.setIPad(webBrowser.isIPad());
    di.setIPhone(webBrowser.isIPhone());
    di.setWindowsPhone(webBrowser.isWindowsPhone());

    di.setSecureConnection(webBrowser.isSecureConnection());
    di.setLocale(webBrowser.getLocale());

    di.setScreenHeight(webBrowser.getScreenHeight());
    di.setScreenWidth(webBrowser.getScreenWidth());

    currentServletRequest.setAttribute(DeviceInfoProvider.NAME, di);

    return di;
}

From source file:com.haulmont.cuba.web.gui.components.CubaCurrencyField.java

License:Apache License

protected boolean useWrapper() {
    Page current = Page.getCurrent();//from  w  w w.  j a v  a2s .c  o m
    if (current != null) {
        WebBrowser browser = current.getWebBrowser();
        return browser != null
                && (browser.isIE() && browser.getBrowserMajorVersion() <= 10 || browser.isSafari());
    } else {
        return false;
    }
}

From source file:com.haulmont.cuba.web.gui.components.WebFileMultiUploadField.java

License:Apache License

public WebFileMultiUploadField() {
    fileUploading = AppBeans.get(FileUploadingAPI.NAME);

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if ((webBrowser.isIE() && !webBrowser.isEdge()) && webBrowser.getBrowserMajorVersion() < 10) {
        initOldComponent();/*from   w  ww. j a v  a2  s  .c  o  m*/
    } else {
        initComponent();
    }
}

From source file:com.haulmont.cuba.web.gui.components.WebFileUploadField.java

License:Apache License

public WebFileUploadField() {
    fileUploading = AppBeans.get(FileUploadingAPI.NAME);
    exportDisplay = AppBeans.get(ExportDisplay.NAME);
    messages = AppBeans.get(Messages.NAME);

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if ((webBrowser.isIE() && !webBrowser.isEdge()) && webBrowser.getBrowserMajorVersion() < 10) {
        initOldUploadButton();/*from   w w w. ja  v a 2 s . c om*/
    } else {
        initUploadButton();
    }

    initComponent();
    attachListener(component);
}

From source file:com.haulmont.cuba.web.toolkit.ui.CubaImage.java

License:Apache License

@Override
public void attach() {
    super.attach();

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if (webBrowser.isIE() || webBrowser.isEdge()) {
        CubaImageObjectFitPolyfillExtension.get(getUI());
    }//from ww  w.j  av  a 2s.  c  o  m
}