Example usage for com.vaadin.server WebBrowser isIPad

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

Introduction

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

Prototype

public boolean isIPad() 

Source Link

Document

Tests if the browser is run on IPad.

Usage

From source file:com.hack23.cia.web.impl.ui.application.util.WebBrowserUtil.java

License:Apache License

/**
 * Gets the operating system.//  www  .j a v a2s .c o m
 *
 * @param webBrowser
 *            the web browser
 * @return the operating system
 */
public static String getOperatingSystem(final WebBrowser webBrowser) {
    String osName = UNKNOWN;
    if (webBrowser.isLinux()) {
        osName = LINUX;
    } else if (webBrowser.isWindows()) {
        osName = WINDOWS2;
    } else if (webBrowser.isWindowsPhone()) {
        osName = WINDOWS_PHONE;
    } else if (webBrowser.isMacOSX()) {
        osName = MAC_OSX;
    } else if (webBrowser.isAndroid()) {
        osName = ANDROID;
    } else if (webBrowser.isIOS()) {
        osName = IOS;
    } else if (webBrowser.isIPad()) {
        osName = IPAD;
    } else if (webBrowser.isIPhone()) {
        osName = I_PHONE;
    }
    return osName;
}

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

License:Apache License

@Nullable
@Override//from ww  w.  ja  v a  2  s .c  om
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.mycollab.vaadin.MyCollabUI.java

License:Open Source License

public static boolean isTablet() {
    try {//from   w  w w  . ja  v  a 2 s.  c  o  m
        WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
        return webBrowser.isIPad();
    } catch (Exception e) {
        return false;
    }
}

From source file:edu.nps.moves.mmowgli.MmowgliSessionGlobals.java

License:Open Source License

private String returnBrowserType(WebBrowser webBr) {
    if (webBr.isFirefox()) {
        return "Firefox";
    }//w w w .java 2s.  c o  m
    if (webBr.isSafari()) {
        return "Safari";
    }
    if (webBr.isIE()) {
        return "IE";
    }
    if (webBr.isChrome()) {
        return "Chrome";
    }
    if (webBr.isOpera()) {
        return "Opera";
    }
    if (webBr.isLinux()) {
        return "Linux";
    }
    if (webBr.isAndroid()) {
        return "Android";
    }
    if (webBr.isIPhone()) {
        return "IPhone";
    }
    if (webBr.isIPad()) {
        return "IPad";
    }
    if (webBr.isIOS()) {
        return "IOS";
    }
    return "";
}

From source file:edu.nps.moves.mmowgli.MmowgliSessionGlobals.java

License:Open Source License

private String returnBrowserOS(WebBrowser webBr) {
    if (webBr.isAndroid()) {
        return "Android";
    }//  w w  w. jav a  2  s  .  co m
    if (webBr.isIOS()) {
        return "IOS";
    }
    if (webBr.isIPad()) {
        return "IPad";
    }
    if (webBr.isIPhone()) {
        return "IPhone";
    }
    if (webBr.isLinux()) {
        return "Linux";
    }
    if (webBr.isMacOSX()) {
        return "MacOSX";
    }
    if (webBr.isWindows()) {
        return "Windows";
    }
    if (webBr.isWindowsPhone()) {
        return "Windows Phone";
    }
    return "Unknown OS/platform";
}