Example usage for com.google.gwt.maps.client.event PolygonRemoveHandler PolygonRemoveHandler

List of usage examples for com.google.gwt.maps.client.event PolygonRemoveHandler PolygonRemoveHandler

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.event PolygonRemoveHandler PolygonRemoveHandler.

Prototype

PolygonRemoveHandler

Source Link

Usage

From source file:com.google.gwt.maps.sample.hellomaps.client.MapEventDemo.java

License:Apache License

private void addListenerToMarker(HandlerActions a) {
    // Create a unique ID for this new listener.
    final int nextListenerId = ++listenerId;

    // Create a new row to add to the UI.
    final int rowNumber = handlerTable.getRowCount();
    handlerTable.setWidget(rowNumber, 0, new Label("" + nextListenerId));
    handlerTable.setWidget(rowNumber, 1, new Label(a.valueOf()));

    final TextBox textBox = new TextBox();
    textBox.setReadOnly(true);/*from   w  ww.ja va 2  s . co m*/
    textBox.setSize("30em", "1em");
    handlerTable.setWidget(rowNumber, 2, textBox);

    Button clearButton = new Button("Clear Text");
    clearButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            textBox.setText("");
        }

    });
    handlerTable.setWidget(rowNumber, 3, clearButton);

    Button removeHandlerButton = new Button("Remove Handler");
    handlerTable.setWidget(rowNumber, 4, removeHandlerButton);

    // Add event specific handlers
    switch (a) {
    case INFO_WINDOW_CLOSE_CLICK_HANDLER: {
        final InfoWindowCloseClickHandler h = new InfoWindowCloseClickHandler() {

            public void onCloseClick(InfoWindowCloseClickEvent event) {
                textBox.setText(textBox.getText() + "onCloseClick()");
            }

        };
        map.getInfoWindow().addInfoWindowCloseClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.getInfoWindow().removeInfoWindowCloseClickHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case INFO_WINDOW_MAXIMIZE_CLICK_HANDLER: {
        final InfoWindowMaximizeClickHandler h = new InfoWindowMaximizeClickHandler() {

            public void onMaximizeClick(InfoWindowMaximizeClickEvent event) {
                textBox.setText(textBox.getText() + "onMaximizeClick()");
            }

        };
        map.getInfoWindow().addInfoWindowMaximizeClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.getInfoWindow().removeInfoWindowMaximizeClickHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case INFO_WINDOW_MAXIMIZE_END_HANDLER: {
        final InfoWindowMaximizeEndHandler h = new InfoWindowMaximizeEndHandler() {

            public void onMaximizeEnd(InfoWindowMaximizeEndEvent event) {
                textBox.setText(textBox.getText() + "onMaximizeEnd()");
            }

        };
        map.getInfoWindow().addInfoWindowMaximizeEndHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.getInfoWindow().removeInfoWindowMaximizeEndHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case INFO_WINDOW_RESTORE_CLICK_HANDLER: {
        final InfoWindowRestoreClickHandler h = new InfoWindowRestoreClickHandler() {

            public void onRestoreClick(InfoWindowRestoreClickEvent event) {
                textBox.setText(textBox.getText() + "onRestoreClick()");
            }

        };
        map.getInfoWindow().addInfoWindowRestoreClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.getInfoWindow().removeInfoWindowRestoreClickHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case INFO_WINDOW_RESTORE_END_HANDLER: {
        final InfoWindowRestoreEndHandler h = new InfoWindowRestoreEndHandler() {

            public void onRestoreEnd(InfoWindowRestoreEndEvent event) {
                textBox.setText(textBox.getText() + "onRestoreEnd()");
            }

        };
        map.getInfoWindow().addInfoWindowRestoreEndHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.getInfoWindow().removeInfoWindowRestoreEndHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_INFO_WINDOW_BEFORE_CLOSE_HANDLER: {
        final MapInfoWindowBeforeCloseHandler h = new MapInfoWindowBeforeCloseHandler() {

            public void onInfoWindowBeforeClose(MapInfoWindowBeforeCloseEvent event) {
                textBox.setText(textBox.getText() + "onInfoWindowBeforeClose()");
            }

        };

        map.addInfoWindowBeforeCloseHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeInfoWindowBeforeCloseHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_INFO_WINDOW_CLOSE_HANDLER: {
        final MapInfoWindowCloseHandler h = new MapInfoWindowCloseHandler() {

            public void onInfoWindowClose(MapInfoWindowCloseEvent event) {
                textBox.setText(textBox.getText() + "onInfoWindowClose()");
            }

        };

        map.addInfoWindowCloseHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeInfoWindowCloseHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_INFO_WINDOW_OPEN_HANDLER: {
        final MapInfoWindowOpenHandler h = new MapInfoWindowOpenHandler() {

            public void onInfoWindowOpen(MapInfoWindowOpenEvent event) {
                textBox.setText(textBox.getText() + "onInfoWindowOpen()");
            }

        };

        map.addInfoWindowOpenHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeInfoWindowOpenHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_CLEAR_OVERLAYS_HANDLER: {
        final MapClearOverlaysHandler h = new MapClearOverlaysHandler() {

            public void onClearOverlays(MapClearOverlaysEvent event) {
                textBox.setText(textBox.getText() + "onClearOverlays()");
            }

        };

        map.addMapClearOverlaysHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapClearOverlaysHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_ADD_MAP_TYPE_HANDLER: {
        final MapAddMapTypeHandler h = new MapAddMapTypeHandler() {

            public void onAddMapType(MapAddMapTypeEvent event) {
                textBox.setText(textBox.getText() + "onAddMapType(" + event.getType().getName(true) + ")");
            }

        };

        map.addMapAddMapTypeHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapAddMapTypeHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_ADD_OVERLAY_HANDLER: {
        final MapAddOverlayHandler h = new MapAddOverlayHandler() {

            public void onAddOverlay(MapAddOverlayEvent event) {
                textBox.setText(textBox.getText() + "onAddOverlay(" + event.getOverlay() + ")");
            }

        };

        map.addMapAddOverlayHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapAddOverlayHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_CLICK_HANDLER: {
        final MapClickHandler h = new MapClickHandler() {

            public void onClick(MapClickEvent e) {
                textBox.setText(textBox.getText() + "onClick(" + e.getLatLng() + ")");
            }

        };
        map.addMapClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapClickHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_DOUBLE_CLICK_HANDLER: {
        final MapDoubleClickHandler h = new MapDoubleClickHandler() {

            public void onDoubleClick(MapDoubleClickEvent e) {
                textBox.setText(textBox.getText() + "onDoubleClick(" + e.getLatLng() + ")");
            }
        };
        map.addMapDoubleClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                map.removeMapDoubleClickHandler(h);
                // removeRowFromTable(nextListenerId);
            }
        });
    }
        break;

    case MAP_DRAG_END_HANDLER: {
        final MapDragEndHandler h = new MapDragEndHandler() {

            public void onDragEnd(MapDragEndEvent event) {
                textBox.setText(textBox.getText() + "onDragEnd()");
            }

        };

        map.addMapDragEndHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapDragEndHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;
    case MAP_DRAG_HANDLER: {
        final MapDragHandler h = new MapDragHandler() {

            public void onDrag(MapDragEvent event) {
                textBox.setText(textBox.getText() + "onDrag()");
            }

        };

        map.addMapDragHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapDragHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_DRAG_START_HANDLER: {
        final MapDragStartHandler h = new MapDragStartHandler() {

            public void onDragStart(MapDragStartEvent event) {
                textBox.setText(textBox.getText() + "onDragStart()");
            }

        };

        map.addMapDragStartHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapDragStartHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_MOUSE_OUT_HANDLER: {
        final MapMouseOutHandler h = new MapMouseOutHandler() {

            public void onMouseOut(MapMouseOutEvent event) {
                textBox.setText(textBox.getText() + "onMouseOut(" + event.getLatLng() + ")");
            }

        };

        map.addMapMouseOutHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapMouseOutHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_MOUSE_OVER_HANDLER: {
        final MapMouseOverHandler h = new MapMouseOverHandler() {

            public void onMouseOver(MapMouseOverEvent event) {
                textBox.setText(textBox.getText() + "onMouseOver(" + event.getLatLng() + ")");
            }

        };

        map.addMapMouseOverHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapMouseOverHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;

    case MAP_MOUSE_MOVE_HANDLER: {
        final MapMouseMoveHandler h = new MapMouseMoveHandler() {

            public void onMouseMove(MapMouseMoveEvent event) {
                textBox.setText(textBox.getText() + "onMouseMove(" + event.getLatLng() + ")");
            }
        };
        map.addMapMouseMoveHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                map.removeMapMouseMoveHandler(h);
                // removeRowFromTable(nextListenerId);
            }
        });
    }
        break;

    case MAP_MOVE_END_HANDLER: {
        final MapMoveEndHandler h = new MapMoveEndHandler() {

            public void onMoveEnd(MapMoveEndEvent e) {
                textBox.setText(textBox.getText() + "onMoveEnd()");
            }
        };
        map.addMapMoveEndHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                map.removeMapMoveEndHandler(h);
                // removeRowFromTable(nextListenerId);
            }
        });
    }
        break;

    case MAP_MOVE_HANDLER: {
        final MapMoveHandler h = new MapMoveHandler() {

            public void onMove(MapMoveEvent e) {
                textBox.setText(textBox.getText() + "onMove()");
            }
        };
        map.addMapMoveHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                map.removeMapMoveHandler(h);
                // removeRowFromTable(nextListenerId);
            }
        });
    }
        break;

    case MAP_MOVE_START_HANDLER: {
        final MapMoveStartHandler h = new MapMoveStartHandler() {

            public void onMoveStart(MapMoveStartEvent e) {
                textBox.setText(textBox.getText() + "onMoveStart()");
            }
        };
        map.addMapMoveStartHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                map.removeMapMoveStartHandler(h);
                // removeRowFromTable(nextListenerId);
            }
        });
    }
        break;

    case MAP_REMOVE_MAP_TYPE_HANDLER: {
        final MapRemoveMapTypeHandler h = new MapRemoveMapTypeHandler() {

            public void onRemoveMapType(MapRemoveMapTypeEvent event) {
                textBox.setText(textBox.getText() + "onRemoveMapType(" + event.getType().getName(true) + ")");
            }

        };

        map.addMapRemoveMapTypeHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapRemoveMapTypeHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;
    case MAP_REMOVE_OVERLAY_HANDLER: {
        final MapRemoveOverlayHandler h = new MapRemoveOverlayHandler() {

            public void onRemoveOverlay(MapRemoveOverlayEvent event) {
                textBox.setText(textBox.getText() + "onRemoveOverlay(" + event.getOverlay().toString() + ")");
            }

        };

        map.addMapRemoveOverlayHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                map.removeMapRemoveOverlayHandler(h);
                // removeRowFromTable(nextListenerId);
            }

        });
    }
        break;
    case MAP_RIGHT_CLICK_HANDLER: {
        final MapRightClickHandler h = new MapRightClickHandler() {

            public void onRightClick(MapRightClickEvent e) {
                textBox.setText(textBox.getText() + "onRightClick(" + e.getPoint() + ")");
            }
        };
        map.addMapRightClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                map.removeMapRightClickHandler(h);
                // removeRowFromTable(nextListenerId);
            }
        });
    }
        break;

    case MAP_TYPE_CHANGED_HANDLER: {
        final MapTypeChangedHandler h = new MapTypeChangedHandler() {

            public void onTypeChanged(MapTypeChangedEvent e) {
                textBox.setText(textBox.getText() + "onTypeChanged()");
            }
        };
        map.addMapTypeChangedHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                map.removeMapTypeChangedHandler(h);
                // removeRowFromTable(nextListenerId);
            }
        });
    }
        break;

    case MAP_ZOOM_END_HANDLER: {
        final MapZoomEndHandler h = new MapZoomEndHandler() {

            public void onZoomEnd(MapZoomEndEvent e) {
                textBox.setText(textBox.getText() + "onZoomEnd(" + e.getNewZoomLevel() + ","
                        + e.getOldZoomLevel() + ")");
            }
        };
        map.addMapZoomEndHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                map.removeMapZoomEndHandler(h);
                // removeRowFromTable(nextListenerId);
            }
        });
    }
        break;
    case MARKER_CLICK_HANDLER: {

        final MarkerClickHandler h = new MarkerClickHandler() {

            public void onClick(MarkerClickEvent e) {
                textBox.setText(textBox.getText() + "onClick()");
            }
        };
        marker.addMarkerClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerClickHandler(h);
            }
        });
    }
        break;
    case MARKER_DOUBLE_CLICK_HANDLER: {

        final MarkerDoubleClickHandler h = new MarkerDoubleClickHandler() {

            public void onDoubleClick(MarkerDoubleClickEvent e) {
                textBox.setText(textBox.getText() + "onDoubleClick()");
            }
        };
        marker.addMarkerDoubleClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerDoubleClickHandler(h);
            }
        });
    }
        break;
    case MARKER_MOUSE_DOWN_HANDLER: {

        final MarkerMouseDownHandler h = new MarkerMouseDownHandler() {

            public void onMouseDown(MarkerMouseDownEvent e) {
                textBox.setText(textBox.getText() + "onMouseDown()");
            }
        };
        marker.addMarkerMouseDownHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerMouseDownHandler(h);
            }
        });
    }
        break;
    case MARKER_MOUSE_UP_HANDLER: {

        final MarkerMouseUpHandler h = new MarkerMouseUpHandler() {

            public void onMouseUp(MarkerMouseUpEvent e) {
                textBox.setText(textBox.getText() + "onMouseUp()");
            }
        };
        marker.addMarkerMouseUpHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerMouseUpHandler(h);
            }
        });
    }
        break;
    case MARKER_MOUSE_OVER_HANDLER: {

        final MarkerMouseOverHandler h = new MarkerMouseOverHandler() {

            public void onMouseOver(MarkerMouseOverEvent e) {
                textBox.setText(textBox.getText() + "onMouseOver()");
            }
        };
        marker.addMarkerMouseOverHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerMouseOverHandler(h);
            }
        });
    }
        break;
    case MARKER_MOUSE_OUT_HANDLER: {

        final MarkerMouseOutHandler h = new MarkerMouseOutHandler() {

            public void onMouseOut(MarkerMouseOutEvent e) {
                textBox.setText(textBox.getText() + "onMouseOut()");
            }
        };
        marker.addMarkerMouseOutHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerMouseOutHandler(h);
            }
        });
    }
        break;
    case MARKER_INFO_WINDOW_OPEN_HANDLER: {

        final MarkerInfoWindowOpenHandler h = new MarkerInfoWindowOpenHandler() {

            public void onInfoWindowOpen(MarkerInfoWindowOpenEvent e) {
                textBox.setText(textBox.getText() + "onInfoWindowOpen()");
            }
        };
        marker.addMarkerInfoWindowOpenHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerInfoWindowOpenHandler(h);
            }
        });
    }
        break;
    case MARKER_INFO_WINDOW_BEFORECLOSE_HANDLER: {

        final MarkerInfoWindowBeforeCloseHandler h = new MarkerInfoWindowBeforeCloseHandler() {

            public void onInfoWindowBeforeClose(MarkerInfoWindowBeforeCloseEvent e) {
                textBox.setText(textBox.getText() + "onInfoWindowBeforeClose()");
            }
        };
        marker.addMarkerInfoWindowBeforeCloseHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerInfoWindowBeforeCloseHandler(h);
            }
        });
    }
        break;
    case MARKER_INFO_WINDOW_CLOSE_HANDLER: {

        final MarkerInfoWindowCloseHandler h = new MarkerInfoWindowCloseHandler() {

            public void onInfoWindowClose(MarkerInfoWindowCloseEvent e) {
                textBox.setText(textBox.getText() + "onInfoWindowClose()");
            }
        };
        marker.addMarkerInfoWindowCloseHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerInfoWindowCloseHandler(h);
            }
        });
    }
        break;
    case MARKER_REMOVE_HANDLER: {

        final MarkerRemoveHandler h = new MarkerRemoveHandler() {

            public void onRemove(MarkerRemoveEvent e) {
                textBox.setText(textBox.getText() + "onRemove()");
            }
        };
        marker.addMarkerRemoveHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerRemoveHandler(h);
            }
        });
    }
        break;
    case MARKER_DRAG_START_HANDLER: {

        final MarkerDragStartHandler h = new MarkerDragStartHandler() {

            public void onDragStart(MarkerDragStartEvent e) {
                textBox.setText(textBox.getText() + "onDragStart()");
            }
        };
        marker.addMarkerDragStartHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerDragStartHandler(h);
            }
        });
    }
        break;
    case MARKER_DRAG_HANDLER: {

        final MarkerDragHandler h = new MarkerDragHandler() {

            public void onDrag(MarkerDragEvent e) {
                textBox.setText(textBox.getText() + "onDrag()");
            }
        };
        marker.addMarkerDragHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerDragHandler(h);
            }
        });
    }
        break;
    case MARKER_DRAG_END_HANDLER: {

        final MarkerDragEndHandler h = new MarkerDragEndHandler() {

            public void onDragEnd(MarkerDragEndEvent e) {
                textBox.setText(textBox.getText() + "onDragEnd()");
            }
        };
        marker.addMarkerDragEndHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerDragEndHandler(h);
            }
        });
    }
        break;
    case MARKER_VISIBILITY_CHANGED_HANDLER: {

        final MarkerVisibilityChangedHandler h = new MarkerVisibilityChangedHandler() {

            public void onVisibilityChanged(MarkerVisibilityChangedEvent e) {
                textBox.setText(textBox.getText() + "onVisibilityChanged(" + e.isVisible() + ")");
            }
        };
        marker.addMarkerVisibilityChangedHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                marker.removeMarkerVisibilityChangedHandler(h);
            }
        });
    }
        break;

    case POLYLINE_CLICK_HANDLER: {

        final PolylineClickHandler h = new PolylineClickHandler() {

            public void onClick(PolylineClickEvent e) {
                textBox.setText(textBox.getText() + "onClick(" + e.getLatLng() + ")");
            }

        };
        polyline.addPolylineClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polyline.removePolylineClickHandler(h);
            }

        });
    }
        break;

    case POLYLINE_REMOVE_HANDLER: {

        final PolylineRemoveHandler h = new PolylineRemoveHandler() {

            public void onRemove(PolylineRemoveEvent e) {
                textBox.setText(textBox.getText() + "onRemove()");
            }

        };
        polyline.addPolylineRemoveHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polyline.removePolylineRemoveHandler(h);
            }

        });
    }
        break;

    case POLYLINE_VISIBILITY_CHANGED_HANDLER: {

        final PolylineVisibilityChangedHandler h = new PolylineVisibilityChangedHandler() {

            public void onVisibilityChanged(PolylineVisibilityChangedEvent e) {
                textBox.setText(textBox.getText() + "onVisibilityChanged(" + e.isVisible() + ")");
            }

        };
        polyline.addPolylineVisibilityChangedHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polyline.removePolylineVisibilityChangedHandler(h);
            }

        });
    }
        break;

    case POLYLINE_MOUSEOUT_HANDLER: {

        final PolylineMouseOutHandler h = new PolylineMouseOutHandler() {

            public void onMouseOut(PolylineMouseOutEvent e) {
                textBox.setText(textBox.getText() + "onMouseOut()");
            }

        };
        polyline.addPolylineMouseOutHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polyline.removePolylineMouseOutHandler(h);
            }

        });
    }
        break;

    case POLYLINE_MOUSEOVER_HANDLER: {

        final PolylineMouseOverHandler h = new PolylineMouseOverHandler() {

            public void onMouseOver(PolylineMouseOverEvent e) {
                textBox.setText(textBox.getText() + "onMouseOver()");
            }

        };
        polyline.addPolylineMouseOverHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polyline.removePolylineMouseOverHandler(h);
            }

        });
    }
        break;

    case POLYGON_CLICK_HANDLER: {

        final PolygonClickHandler h = new PolygonClickHandler() {

            public void onClick(PolygonClickEvent e) {
                textBox.setText(textBox.getText() + "onClick(" + e.getLatLng() + ")");
            }

        };
        polygon.addPolygonClickHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polygon.removePolygonClickHandler(h);
            }

        });
    }
        break;

    case POLYGON_REMOVE_HANDLER: {

        final PolygonRemoveHandler h = new PolygonRemoveHandler() {

            public void onRemove(PolygonRemoveEvent e) {
                textBox.setText(textBox.getText() + "onRemove()");
            }

        };
        polygon.addPolygonRemoveHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polygon.removePolygonRemoveHandler(h);
            }

        });
    }
        break;

    case POLYGON_VISIBILITY_CHANGED_HANDLER: {

        final PolygonVisibilityChangedHandler h = new PolygonVisibilityChangedHandler() {

            public void onVisibilityChanged(PolygonVisibilityChangedEvent e) {
                textBox.setText(textBox.getText() + "onVisibilityChanged(" + e.isVisible() + ")");
            }

        };
        polygon.addPolygonVisibilityChangedHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polygon.removePolygonVisibilityChangedHandler(h);
            }

        });
    }
        break;

    case POLYGON_MOUSEOUT_HANDLER: {

        final PolygonMouseOutHandler h = new PolygonMouseOutHandler() {

            public void onMouseOut(PolygonMouseOutEvent e) {
                textBox.setText(textBox.getText() + "onMouseOut()");
            }

        };
        polygon.addPolygonMouseOutHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polygon.removePolygonMouseOutHandler(h);
            }

        });
    }
        break;

    case POLYGON_MOUSEOVER_HANDLER: {

        final PolygonMouseOverHandler h = new PolygonMouseOverHandler() {

            public void onMouseOver(PolygonMouseOverEvent e) {
                textBox.setText(textBox.getText() + "onMouseOver()");
            }

        };
        polygon.addPolygonMouseOverHandler(h);
        removeHandlerButton.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                polygon.removePolygonMouseOverHandler(h);
            }

        });
    }
        break;

    default:
        Window.alert("Unhandled HandlerActions case : " + a.valueOf());
    }
}