Example usage for org.apache.wicket.protocol.http ClientProperties getNavigatorUserAgent

List of usage examples for org.apache.wicket.protocol.http ClientProperties getNavigatorUserAgent

Introduction

In this page you can find the example usage for org.apache.wicket.protocol.http ClientProperties getNavigatorUserAgent.

Prototype

public String getNavigatorUserAgent() 

Source Link

Usage

From source file:com.servoy.j2db.server.headlessclient.dataui.WebCellBasedView.java

License:Open Source License

/**
 * scroll mode is not supported in Internet Explorer 7 and will always set scroll mode to false in this case
 * @param scrollMode//from   ww  w .ja v a 2 s . c  o  m
 */
public void setScrollMode(boolean scrollMode) {
    this.isScrollMode = scrollMode;
    RequestCycle requestCycle = RequestCycle.get();
    if (requestCycle != null) {
        ClientProperties cp = ((WebClientInfo) WebClientSession.get().getClientInfo()).getProperties();
        if (cp.isBrowserInternetExplorer() && cp.getBrowserVersionMajor() != -1
                && cp.getBrowserVersionMajor() < 8) {
            Debug.warn("Cannot set tableview to scroll mode for IE version " + cp.getBrowserVersionMajor() //$NON-NLS-1$
                    + ", UA : " + cp.getNavigatorUserAgent()); //$NON-NLS-1$
            this.isScrollMode = false;
        }
    }
}

From source file:de.voolk.marbles.web.pages.base.ClientType.java

License:Open Source License

public static ClientType getInstace(ClientProperties clientProperties) {
    ClientType variant;/*from   w ww .j a v a2  s  .  com*/
    String navigatorUserAgent = clientProperties.getNavigatorUserAgent();
    if (navigatorUserAgent.contains("Android") || clientProperties.getBrowserWidth() < 760) {
        variant = MOBILE;
    } else {
        variant = WEB;
    }
    return variant;
}

From source file:eu.uqasar.model.monitoring.WebEnvironment.java

License:Apache License

private void populateFromClientProperties(ClientProperties props) {
    setBrowser(Browser.getFromClientProperties(props));
    setBrowserVersionMajor(props.getBrowserVersionMajor());
    setBrowserVersionMinor(props.getBrowserVersionMinor());
    setColorDepth(props.getScreenColorDepth());
    setCookiesEnabled(props.isCookiesEnabled());
    setHostname(props.getHostname());//from  ww  w  .  j  a v a  2  s.c o m
    setJavaEnabled(props.isJavaEnabled());
    setNavigatorLanguage(props.getNavigatorLanguage());
    setNavigatorPlatform(props.getNavigatorPlatform());
    setNavigatorUserAgent(props.getNavigatorUserAgent());
    setRemoteAddress(props.getRemoteAddress());
    setScreenHeight(props.getScreenHeight());
    setScreenWidth(props.getScreenWidth());
}

From source file:org.geoserver.web.wicket.CodeMirrorEditor.java

License:Open Source License

private boolean isCodeMirrorSupported() {
    boolean enableCodeMirror = true;
    WebClientInfo clientInfo = (WebClientInfo) WebRequestCycle.get().getClientInfo();
    ClientProperties clientProperties = clientInfo.getProperties();
    if (clientProperties.isBrowserInternetExplorer()) {
        ClientProperties props = extractIEVersion(clientProperties.getNavigatorUserAgent());
        enableCodeMirror = clientProperties.getBrowserVersionMajor() >= 8
                || props.getBrowserVersionMajor() >= 8;
    } else if (clientProperties.isBrowserMozillaFirefox()) {
        ClientProperties props = extractFirefoxVersion(clientProperties.getNavigatorUserAgent());
        enableCodeMirror = clientProperties.getBrowserVersionMajor() >= 3
                || props.getBrowserVersionMajor() >= 3;
    } else if (clientProperties.isBrowserSafari()) {
        ClientProperties props = extractSafariVersion(clientProperties.getNavigatorAppVersion());
        enableCodeMirror = clientProperties.getBrowserVersionMajor() > 5
                || (clientProperties.getBrowserVersionMajor() == 5
                        && clientProperties.getBrowserVersionMinor() >= 2)
                || props.getBrowserVersionMajor() > 5
                || (props.getBrowserVersionMajor() == 5 && props.getBrowserVersionMinor() >= 2);
    } else if (clientProperties.isBrowserOpera()) {
        ClientProperties props = extractOperaVersion(clientProperties.getNavigatorAppVersion());
        enableCodeMirror = clientProperties.getBrowserVersionMajor() >= 9
                || props.getBrowserVersionMajor() >= 9;
    }//w  ww .  java2 s  .  c  om
    return enableCodeMirror;
}