Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.Button


        fillFlag = fillCheckBox.getValue();
      }
    });
    grid.setWidget(1, 3, fillCheckBox);

    Button addPolylineButton = new Button("Make Polyline");
    addPolylineButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        message1.setText("opacity=" + opacity + " color=" + color + " weight="
            + weight + " polygon=" + makePolygon + " center=" + map.getCenter()
            + " zoom=" + map.getZoomLevel());
        addPolyDialog.hide();
        createPolyline();
        editPolylineButton.setEnabled(true);
      }
    });

    Button addPolygonButton = new Button("Make Polygon");
    addPolygonButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        message1.setText("Opacity=" + opacity + " color=" + color + "weight="
            + weight + "polygon = " + makePolygon + "Center=" + map.getCenter()
            + " zoom=" + map.getZoomLevel() + "fill=" + fillFlag);
        addPolyDialog.hide();
        createPolygon();
        editPolygonButton.setEnabled(true);
      }
    });

    Button cancelButton = new Button("Cancel");
    cancelButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        addPolyDialog.hide();
      }
    });
View Full Code Here


    Panel panel = new FlowPanel();

    map = new MapWidget(LatLng.newInstance(40.652513, -73.936615), 12);
    map.setSize("640px", "480px");
    panel.add(map);
    Button toggleTraffic = new Button("Toggle Traffic");
    toggleTraffic.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (trafficShown) {
          map.removeOverlay(trafficInfo);
        } else {
          map.addOverlay(trafficInfo);
View Full Code Here

    map.setUIToDefault();
    panel.add(map);

    // Toggle the visibility of the overlays by
    // adding and removing the overlay.
    removeAddButton = new Button("Add KML Overlay");
    // Toggle the visibility of the overlays
    // using the show() and hide() methods
    showHideButton = new Button("Hide");
    removeAddButton.setEnabled(false);
    removeAddButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        toggleOverlay();
      }
View Full Code Here

    map = new MapWidget(LatLng.newInstance(49.496675, -102.65625), 3);
    map.setSize("640px", "480px");
    map.setUIToDefault();
    panel.add(map);
    toggleButton = new Button("Toggle Markers");
    toggleButton.setEnabled(false);
    toggleButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (geoXml == null) {
          return;
View Full Code Here

    final InfoWindowContent content = new InfoWindowContent(
        "There's more to see (hit the maximize button)");
    content.setMaxTitle(new HTML("<i>Maximized Italic Boots</i>"));
    VerticalPanel panel = new VerticalPanel();
    panel.add(new Image("boot.jpg"));
    Button b = new Button("Click for Message");
    final Label l = new Label();
    HorizontalPanel hp = new HorizontalPanel();
    hp.add(b);
    hp.add(l);
    l.getElement().getStyle().setPropertyPx("margin", 7);
    b.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        GWT.log("Got click in maximized window.", null);
        if (l.getText().equals("")) {
          l.setText("Hello World!");
        } else {
View Full Code Here

    final TextBox textBox = new TextBox();
    textBox.setReadOnly(true);
    textBox.setSize("30em", "1em");
    handlerTable.setWidget(rowNumber, 2, textBox);

    Button clearButton = new Button("Clear Text");
    clearButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            map.removeMapAddOverlayHandler(h);
            // removeRowFromTable(nextListenerId);
          }

        });
      }
        break;

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

          public void onClick(MapClickEvent e) {
            String additionalText = "";
            if (e.getOverlay() != null) {
              additionalText = " Overlay clicked" + e.getOverlayLatLng();
            }
            textBox.setText(textBox.getText() + "onClick(" + e.getLatLng()
                + ")" + additionalText);
          }

        };
        map.addMapClickHandler(h);
        removeHandlerButton.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            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.addClickHandler(new ClickHandler() {

          public void onClick(ClickEvent event) {
            polygon.removePolygonMouseOverHandler(h);
          }
View Full Code Here

    hp.setSpacing(10);

    vp.add(hp);

    // Create a button to hide/show the marker
    final Button hideButton = new Button("Hide Marker");
    hideButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        boolean state = !marker.isVisible();
        marker.setVisible(state);
        if (state) {
          hideButton.setText("Hide Marker");
        } else {
          hideButton.setText("Show Marker");
        }
      }
    });
    hp.add(hideButton);

    // Create a button to remove the marker from the map.
    final Button removeButton = new Button("Remove Marker");
    removeButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (!markerRemoved) {
          map.removeOverlay(marker);
          removeButton.setText("Add Marker");
        } else {
          map.addOverlay(marker);
          removeButton.setText("Remove Marker");
        }
        hideButton.setEnabled(markerRemoved);
        markerRemoved = !markerRemoved;
      }
    });
    hp.add(removeButton);

    // Create a button to hide/show the polygon
    final Button hidePolygonButton = new Button("Hide Polygon");
    hidePolygonButton.setEnabled(false);
    hidePolygonButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        boolean state = !polygon.isVisible();
        polygon.setVisible(state);
        if (state) {
          hidePolygonButton.setText("Hide Polygon");
        } else {
          hidePolygonButton.setText("Show Polygon");
        }
      }
    });
    hp.add(hidePolygonButton);

    // Create a button to remove the polygon from the map.
    final Button removePolygonButton = new Button("Add Polygon");
    removePolygonButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (!polygonRemoved) {
          map.removeOverlay(polygon);
          removePolygonButton.setText("Add Polygon");
        } else {
          map.addOverlay(polygon);
          removePolygonButton.setText("Remove Polygon");
        }
        hidePolygonButton.setEnabled(polygonRemoved);
        polygonRemoved = !polygonRemoved;
      }
    });
    hp.add(removePolygonButton);

    // Create a button to hide/show the polyline
    final Button hidePolylineButton = new Button("Hide Polyline");
    hidePolylineButton.setEnabled(false);
    hidePolylineButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        boolean state = !polyline.isVisible();
        polyline.setVisible(state);
        if (state) {
          hidePolylineButton.setText("Hide Polyline");
        } else {
          hidePolylineButton.setText("Show Polyline");
        }
      }
    });
    hp.add(hidePolylineButton);

    // Create a button to remove the polyline from the map.
    final Button removePolylineButton = new Button("Add Polyline");
    removePolylineButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (!polylineRemoved) {
          map.removeOverlay(polyline);
          removePolylineButton.setText("Add Polyline");
        } else {
          map.addOverlay(polyline);
          removePolylineButton.setText("Remove Polyline");
        }
        hidePolylineButton.setEnabled(polylineRemoved);
        polylineRemoved = !polylineRemoved;
      }
    });
    hp.add(removePolylineButton);

    final Button clearOverlaysButton = new Button("Clear Overlays");
    clearOverlaysButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        map.clearOverlays();
      }
    });

    hp.add(clearOverlaysButton);

    hp = new HorizontalPanel();
    hp.setSpacing(10);
    vp.add(hp);

    final Button infoWindowButton = new Button("Show InfoWindow");
    infoWindowButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        InfoWindow info = map.getInfoWindow();
        InfoWindowContent content = new InfoWindowContent("Hello Maps!");
        content.setMaxContent("Hello Maps - more content");
        content.setMaxTitle("Hello Maps");
        info.open(map.getCenter(), content);
      }
    });
    hp.add(infoWindowButton);

    final Button mInfoWindowButton = new Button("Marker InfoWindow");
    mInfoWindowButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        InfoWindow info = map.getInfoWindow();
        InfoWindowContent content = new InfoWindowContent("Hello Maps!");
        content.setMaxContent("Hello Maps - more content");
        content.setMaxTitle("Hello Maps");
        info.open(marker, content);
      }
    });
    hp.add(mInfoWindowButton);

    final Button mapTypeButton = new Button("Add Map Type");
    mapTypeButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        if (mapTypeRemoved) {
          map.addMapType(MapType.getSkyVisibleMap());
          mapTypeButton.setText("Remove MapType");
        } else {
          map.removeMapType(MapType.getSkyVisibleMap());
          mapTypeButton.setText("Add MapType");
        }
        map.setUIToDefault();
        mapTypeRemoved = !mapTypeRemoved;
      }

    });
    hp.add(mapTypeButton);

    // Create a button to clear out the table.
    final Button clearTableButton = new Button("Clear Table");
    clearTableButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        clearListenerTable();
      }
    });
    hp.add(clearTableButton);
View Full Code Here

    for (HandlerActions a : HandlerActions.values()) {
      listenerBox.addItem(a.valueOf());
    }
    h.add(listenerBox);

    Button b = new Button("Add Handler");
    b.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        int selectedIndex = listenerBox.getSelectedIndex();
        HandlerActions a = HandlerActions.values()[selectedIndex];
        addListenerToMarker(a);
View Full Code Here

  @Override
  public void onModuleLoad() {
    calendar.initialize(new SimpleEventBus(),
        new GoogleApiRequestTransport(APPLICATION_NAME, API_KEY));

    final Button b = new Button("Authenticate to insert, update and delete an event");
    b.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent e) {
        login();
        b.setVisible(false);
      }
    });
    RootPanel.get().add(b);
  }
View Full Code Here

    login();
  }

  /** Demonstrates authentication using OAuth 2.0. */
  private void login() {
    final Button button = new Button("Log in to get started");
    button.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        new ClientOAuth2Login(CLIENT_ID)
            .withScopes(UrlshortenerAuthScope.URLSHORTENER)
            .login(new Receiver<String>() {
              @Override
              public void onSuccess(String accessToken) {
                initialize(accessToken);
              }
            });
        button.setVisible(false);
      }
    });
    RootPanel.get().add(button);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.Button

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.