Example usage for com.vaadin.server WebBrowser getBrowserMinorVersion

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

Introduction

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

Prototype

public int getBrowserMinorVersion() 

Source Link

Document

Gets the minor version of the browser the user is using.

Usage

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

License:Apache License

@Nullable
@Override//from  www .  j  av  a 2s . c o 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:edu.nps.moves.mmowgli.MmowgliSessionGlobals.java

License:Open Source License

private void deriveBrowserBooleans(WebBrowser webBr) {
    browserApp = webBr.getBrowserApplication();
    browserMiniType = returnBrowserType(webBr);
    browserOS = returnBrowserOS(webBr);//from  w  w w  .j a  v  a  2 s .c  o m
    browserMajVersion = webBr.getBrowserMajorVersion();
    browserMajVersionString = "" + browserMajVersion;
    browserMinVersion = webBr.getBrowserMinorVersion();
    browserAddress = webBr.getAddress();

    if (browserApp.contains("MSIE 7.0")) {
        internetExplorer = true;
        if (browserMajVersion <= 7)
            internetExplorer7 = true;
    }
}