Example usage for com.google.gwt.useragent.client UserAgent getRuntimeValue

List of usage examples for com.google.gwt.useragent.client UserAgent getRuntimeValue

Introduction

In this page you can find the example usage for com.google.gwt.useragent.client UserAgent getRuntimeValue.

Prototype

String getRuntimeValue();

Source Link

Document

Returns the calculated value of user agent on the runtime

Usage

From source file:mobi.openddr.example.gwtcanvasdemo.client.DmapGwtCanvas.java

License:Open Source License

public void onModuleLoad() {
    UserAgent impl = GWT.create(UserAgent.class);
    Window win = GWT.create(Window.class);

    String compileTimeValue = impl.getCompileTimeValue();
    String runtimeValue = impl.getRuntimeValue();
    System.out.println(compileTimeValue + "->" + runtimeValue);
    height = win.getClientHeight() - 100;
    width = win.getClientWidth() - 80;/*www  . ja v  a 2  s  . co m*/

    canvas = Canvas.createIfSupported();
    backBuffer = Canvas.createIfSupported();
    if (canvas == null) {
        RootPanel.get(HOLDER_ID).add(new Label(UPGRADE_MESSAGE));
        return;
    }

    // init the canvases
    canvas.setWidth(width + "px");
    canvas.setHeight(height + "px");
    canvas.setCoordinateSpaceWidth(width);
    canvas.setCoordinateSpaceHeight(height);
    backBuffer.setCoordinateSpaceWidth(width);
    backBuffer.setCoordinateSpaceHeight(height);
    RootPanel.get(HOLDER_ID).add(canvas);
    context = canvas.getContext2d();
    backBufferContext = backBuffer.getContext2d();

    // init the objects
    logoGroup = new LogoGroup(width, height, 18, 165);
    ballGroup = new BallGroup(width, height);
    lens = new Lens(35, 15, width, height, new Vector(320, 150), new Vector(1, 1));

    // init handlers
    initHandlers();

    // setup timer
    final Timer timer = new Timer() {
        @Override
        public void run() {
            doUpdate();
        }
    };
    timer.scheduleRepeating(REFRESH_RATE);
}