Example usage for com.google.gwt.maps.client.overlays Animation BOUNCE

List of usage examples for com.google.gwt.maps.client.overlays Animation BOUNCE

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.overlays Animation BOUNCE.

Prototype

Animation BOUNCE

To view the source code for com.google.gwt.maps.client.overlays Animation BOUNCE.

Click Source Link

Usage

From source file:com.google.gwt.maps.testing.client.maps.BasicMapWidget.java

License:Apache License

private void draw() {
    Button addBounceMarkerButton = new Button("Add Marker with Bounce");
    addBounceMarkerButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (markerBouncing != null) {
                markerBouncing.clear();/* w w w. ja  v  a 2  s.c om*/
            }
            drawMarkerWithBounceAnimation();
        }
    });

    Button addDropMarkerButton = new Button("Add Marker with Drop");
    addDropMarkerButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (markerDrop != null) {
                markerDrop.clear();
            }
            drawMarkerWithDropAnimation();
        }
    });

    Button stopAnimationsButton = new Button("Stop Animations");
    stopAnimationsButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (markerBasic != null) {
                markerBasic.setAnimation(Animation.STOPANIMATION);
            }
            if (markerBouncing != null) {
                markerBouncing.setAnimation(Animation.STOPANIMATION);
            }
            if (markerDrop != null) {
                markerDrop.setAnimation(Animation.STOPANIMATION);
            }
        }
    });

    Button startAnimationsButton = new Button("Start Animations");
    startAnimationsButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (markerBasic != null) {
                markerBasic.setAnimation(Animation.BOUNCE);
            }
            if (markerBouncing != null) {
                markerBouncing.setAnimation(Animation.BOUNCE);
            }
            if (markerDrop != null) {
                markerDrop.setAnimation(Animation.DROP);
            }
        }
    });

    // basic controls to test markers
    HorizontalPanel hp = new HorizontalPanel();
    hp.add(new HTML("<br>Basic Map Example. With an AdUnit"));
    hp.add(addBounceMarkerButton);
    hp.add(new HTML("&nbsp;"));
    hp.add(addDropMarkerButton);
    hp.add(new HTML("&nbsp;"));
    hp.add(startAnimationsButton);
    hp.add(new HTML("&nbsp;"));
    hp.add(stopAnimationsButton);
    hp.setCellVerticalAlignment(addBounceMarkerButton, VerticalPanel.ALIGN_BOTTOM);
    hp.setCellVerticalAlignment(addDropMarkerButton, VerticalPanel.ALIGN_BOTTOM);
    hp.setCellVerticalAlignment(startAnimationsButton, VerticalPanel.ALIGN_BOTTOM);
    hp.setCellVerticalAlignment(stopAnimationsButton, VerticalPanel.ALIGN_BOTTOM);

    pWidget.clear();
    pWidget.add(hp);

    drawMap();
    drawMapAds();
    drawBasicMarker();
}

From source file:com.google.gwt.maps.testing.client.maps.BasicMapWidget.java

License:Apache License

private void drawMarkerWithBounceAnimation() {
    LatLng center = LatLng.newInstance(46.33, -113.81);
    MarkerOptions options = MarkerOptions.newInstance();
    options.setPosition(center);/*w ww .j ava 2  s .com*/
    options.setTitle("Hi I'm marker 2. Thanks for clicking on me.");
    options.setAnimation(Animation.BOUNCE);

    markerBouncing = Marker.newInstance(options);
    markerBouncing.setMap(mapWidget);
}