/** @param event */ public void onMapClick(MapClickEvent event) { LatLng e = event.getLatLng(); if (e == null) { e = event.getOverlayLatLng(); // if(mState == State.Default) // { // MapItemOverlay mio = (MapItemOverlay) event.getOverlay(); // HasCoordinates item = mio.getMapItem(); // if(item instanceof MapItem) // showMapItemEdit((MapItem)item); // } } if (mState == State.Adding || mState == State.Editing) { mDataModel.getX().setValue(e.getLongitude()); mDataModel.getY().setValue(e.getLatitude()); mDisplay.getStreetView().setLocation(e); handleChangePosition(e); } else if (mState == State.AddingStar) { Star s = new Star(); s.setType(mStarType); s.setX(e.getLongitude()); s.setY(e.getLatitude()); onFinishAddingStar(s); } }
/** Changes states of objects during @value {@link State#Default} */ public void onFinishAdding(boolean canceled) { mState = State.Default; mDisplay.setContextButtonsVisible(false); mMapController.finishWorking(canceled); mDisplay.getMenuContent().setOpen(false); onClearContextItems(); mDisplay.setMapItem(null); mDisplay.getStreetView().hide(); resetButtons(); mDisplay.setCurrentMenuTab(0); mDisplay.getForm().getMapItemType().setValue(""); // its first null item }
/** Bind to window */ private void bind() { mDisplay.getStreetView().setViewportMap(mapWidget); mDisplay .getSearchButton() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { String text = mDisplay.getSearchBox().getText().trim(); if (text.length() > 0) { onSearch(text); } } }); }