Example usage for com.google.gwt.maps.client.overlay MarkerOptions MarkerOptions

List of usage examples for com.google.gwt.maps.client.overlay MarkerOptions MarkerOptions

Introduction

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

Prototype

protected MarkerOptions() 

Source Link

Document

JavaScript overlays require a protected constructor.

Usage

From source file:com.mashery.examples.api.client.ActiveExample.java

License:Open Source License

public ActiveExample(final PopupMapWidget mapWidget) {
    FlowPanel panel = new FlowPanel();

    panel.add(new HTML("<h1>Search</h1>"));

    FormPanel form = new FormPanel();
    panel.add(form);//ww  w .j ava2s .co m

    FlexTable entryGrid = new FlexTable();
    form.add(entryGrid);
    FlexTable.FlexCellFormatter formatter = (FlexCellFormatter) entryGrid.getCellFormatter();
    entryGrid.setWidget(0, 0, new Label("Keywords:"));
    formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    final TextBox keywordsText = new TextBox();
    entryGrid.setWidget(0, 1, keywordsText);
    keywordsText.setWidth("200px");

    entryGrid.setWidget(1, 0, new Label("Location:"));
    formatter.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    final TextBox locationText = new TextBox();
    entryGrid.setWidget(1, 1, locationText);
    locationText.setWidth("200px");

    Anchor fromMapLink = new Anchor("<- from Map");
    final Geocoder geocoder = new Geocoder();
    fromMapLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            mapWidget.show();
            HasLatLng center = mapWidget.getMap().getCenter();
            GeocoderRequest request = new GeocoderRequest();
            request.setLatLng(center);
            geocoder.geocode(request, new GeocoderCallback() {
                @Override
                public void callback(List<HasGeocoderResult> responses, String status) {
                    if (responses != null) {
                        String postalCode = null;
                        String country = null;
                        RESULTS: for (HasGeocoderResult result : responses) {
                            if (result.getTypes().contains("postal_code")) {
                                for (HasAddressComponent addr : result.getAddressComponents()) {
                                    if (postalCode == null && addr.getTypes().contains("postal_code"))
                                        postalCode = addr.getLongName();

                                    if (country == null && addr.getTypes().contains("country"))
                                        country = addr.getLongName();

                                    if (postalCode != null && country != null)
                                        break RESULTS;
                                }
                            }
                        }

                        if (postalCode != null) {
                            if (country == null)
                                locationText.setText(postalCode);
                            else
                                locationText.setText(postalCode + ", " + country);
                        }
                    }
                }
            });
        }
    });

    entryGrid.setWidget(1, 2, fromMapLink);

    SubmitButton submitButton = new SubmitButton("Search");
    entryGrid.setWidget(2, 0, submitButton);
    formatter.setColSpan(2, 0, 3);
    formatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    final SearchResultsTable table = new SearchResultsTable(10);
    panel.add(table);
    table.setWidth("500px");

    form.addSubmitHandler(new FormPanel.SubmitHandler() {
        @Override
        public void onSubmit(SubmitEvent event) {
            String keywords = keywordsText.getValue().trim();
            String location = locationText.getValue().trim();
            table.loadData(keywords.length() == 0 ? null : keywords, location.length() == 0 ? null : location);
            event.cancel();
        }
    });

    infoPanel = new PopupPanel(true);
    infoPanel.setAutoHideOnHistoryEventsEnabled(true);
    infoGrid = new FlexTable();
    infoPanel.setWidget(infoGrid);
    FlowPanel linkPanel = new FlowPanel();
    infoGrid.setWidget(3, 0, linkPanel);

    Anchor mapLink = new Anchor("Map", "#");
    linkPanel.add(mapLink);
    mapLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            if (selectedResult == null)
                return;

            Meta meta = selectedResult.getMeta();
            if (meta == null) {
                Window.alert("No location available.");
                return;
            }

            MarkerOptions opt = new MarkerOptions();
            if (meta.getAssetName() != null)
                opt.setTitle(meta.getAssetName().trim());

            opt.setPosition(new LatLng(meta.getLatitude(), meta.getLongitude()));
            opt.setClickable(true);
            opt.setVisible(true);
            mapWidget.show(new Marker(opt));
        }
    });

    mapWidget.addAutoHidePartner(mapLink.getElement());

    linkPanel.add(new InlineHTML("&nbsp;|&nbsp;"));
    linkPanel.add(visitLink = new Anchor("Visit", "#"));

    ((FlexTable.FlexCellFormatter) infoGrid.getCellFormatter()).setColSpan(1, 0, 2);
    ((FlexTable.FlexCellFormatter) infoGrid.getCellFormatter()).setColSpan(2, 0, 2);
    ((FlexTable.FlexCellFormatter) infoGrid.getCellFormatter()).setColSpan(3, 0, 2);

    initWidget(new ScrollPanel(panel));
}

From source file:com.mashery.examples.api.client.EtsyExample.java

License:Open Source License

public EtsyExample(final PopupMapWidget mapWidget) {
    AbsolutePanel rootPanel = new AbsolutePanel();
    rootPanel.setSize("100%", "100%");

    SplitLayoutPanel panel = new SplitLayoutPanel();
    rootPanel.add(panel);/* w  w w  .j a va  2 s  . com*/
    panel.setHeight("100%");

    FlowPanel topPanel = new FlowPanel();
    panel.addNorth(topPanel, 250d);

    topPanel.add(new HTML("<h1>Featured Listings</h1>"));

    dragController = new PickupDragController(rootPanel, false);
    dragController.setBehaviorDragProxy(true);
    dragController.setBehaviorMultipleSelection(false);
    dragController.setBehaviorDragStartSensitivity(2);

    featuredListingsTable = new FeaturedListingsTable(20);
    topPanel.add(new ScrollPanel(featuredListingsTable));

    DockLayoutPanel bottomPanelContainer = new DockLayoutPanel(Unit.PX);
    panel.add(bottomPanelContainer);

    bottomPanelContainer.addNorth(new HTML("<h1>Favorite Listings</h1>"), 50d);

    bottomPanel = new DeckPanel();
    bottomPanelContainer.add(bottomPanel);

    bottomPanel.add(new HTML("Obtaining your Etsy account information..."));

    favoriteListingsTable = new FavoriteListingsTable(20);

    dropController = new SimpleDropController(favoriteListingsTable) {
        public void onDrop(DragContext context) {
            Image img = (Image) context.draggable;
            String id = img.getElement().getId();
            if (id != null && id.startsWith("listing_")) {
                try {
                    int listingId = Integer.parseInt(id.substring("listing_".length()));
                    favoriteListingsTable.createUserFavoriteListing(listingId);
                } catch (NumberFormatException e) {
                    GWT.log("Unable to parse listing id.", e);
                }
            }
        }
    };

    dragController.registerDropController(dropController);

    FlowPanel userPanel = new FlowPanel();

    userPanel.add(userLabel = new InlineHTML());
    userPanel.add(new InlineHTML("&nbsp;&nbsp;&nbsp;"));
    Anchor disconnectLink = new Anchor("Disconnect", "#");
    userPanel.add(disconnectLink);
    disconnectLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            disconnectEtsyAccount();
        }
    });

    userPanel.add(new InlineHTML("&nbsp;|&nbsp;"));
    Anchor mapProfileLink = new Anchor("Map Profile", "#");
    userPanel.add(mapProfileLink);
    mapProfileLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            if (user != null) {
                UserProfile profile = user.getProfile();
                if (profile != null) {
                    MarkerOptions opt = new MarkerOptions();
                    opt.setTitle(profile.getLoginName());
                    opt.setPosition(new LatLng(profile.getLat(), profile.getLon()));
                    opt.setClickable(true);
                    opt.setVisible(true);
                    mapWidget.show(new Marker(opt));
                }
            }
        }
    });

    mapWidget.addAutoHidePartner(mapProfileLink.getElement());

    userPanel.add(new HTML());
    userPanel.add(favoriteListingsTable);

    bottomPanel.add(new ScrollPanel(userPanel));
    bottomPanel.add(new HTML("You must be logged in in order to manage your favorite listings."));
    bottomPanel.add(createOAuthPanel());

    etsySvc = GWT.create(EtsyService.class);

    infoPanel = new PopupPanel(true);
    infoPanel.setAutoHideOnHistoryEventsEnabled(true);
    infoGrid = new Grid(2, 1);
    infoPanel.setWidget(infoGrid);
    infoGrid.setWidth("240px");

    mapListingLink = new Anchor("Map", "#");
    mapListingLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            if (selectedListing == null)
                return;

            Shop shop = selectedListing.getShop();
            if (shop == null) {
                Window.alert("No shop information available.");
                return;
            }

            if (!shop.hasLatLon()) {
                Window.alert("No location information available.");
                return;
            }

            MarkerOptions opt = new MarkerOptions();
            opt.setTitle(shop.getShopName());
            opt.setPosition(new LatLng(shop.getLat(), shop.getLon()));
            opt.setClickable(true);
            opt.setVisible(true);
            mapWidget.show(new Marker(opt));
        }
    });

    mapWidget.addAutoHidePartner(mapListingLink.getElement());

    deleteFavListingLink = new Anchor("Delete", "#");
    deleteFavListingLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            favoriteListingsTable.deleteUserFavoriteListing(selectedListing.getListingId());
            infoPanel.hide();
        }
    });

    initWidget(rootPanel);

    bottomPanel.showWidget(0);
}

From source file:com.mashery.examples.api.client.HotwireExample.java

License:Open Source License

public HotwireExample(final PopupMapWidget mapWidget) {
    FlowPanel panel = new FlowPanel();

    panel.add(new HTML("<h1>Hotel Deals</h1>"));

    FormPanel form = new FormPanel();
    panel.add(form);/*from   w ww .ja v a 2 s .  c o  m*/

    FlexTable entryGrid = new FlexTable();
    form.add(entryGrid);
    FlexTable.FlexCellFormatter formatter = (FlexCellFormatter) entryGrid.getCellFormatter();
    entryGrid.setWidget(0, 0, new Label("Destination:"));
    formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    FlowPanel destPanel = new FlowPanel();
    entryGrid.setWidget(0, 1, destPanel);
    formatter.setColSpan(0, 1, 5);

    final TextBox destText = new TextBox();
    destPanel.add(destText);
    destText.setWidth("220px");

    Anchor fromMapLink = new Anchor("<- from Map");
    fromMapLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            HasLatLng center = mapWidget.getMap().getCenter();
            destText.setText(center.getLatitude() + "," + center.getLongitude());
        }
    });

    destPanel.add(new InlineHTML("&nbsp;"));
    destPanel.add(fromMapLink);

    entryGrid.setWidget(1, 0, new Label("From:"));
    formatter.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    final TextBox startDateText = new TextBox();
    entryGrid.setWidget(1, 1, startDateText);
    startDateText.setWidth("100px");

    final PopupPanel startDatePanel = new PopupPanel(true);
    startDatePanel.setAutoHideOnHistoryEventsEnabled(true);

    final ToggleButton startDateButton = new ToggleButton(new Image("resources/img/date-picker.gif"));
    entryGrid.setWidget(1, 2, startDateButton);
    startDateButton.setPixelSize(16, 16);
    startDatePanel.addAutoHidePartner(startDateButton.getElement());
    startDateButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            startDatePanel.showRelativeTo(startDateButton);
        }
    });

    startDatePanel.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            startDateButton.setDown(false);
        }
    });

    final DateTimeFormat dateFormat = DateTimeFormat.getFormat("MM/dd/yyyy");

    final DatePicker startDatePicker = new DatePicker();
    startDatePanel.setWidget(startDatePicker);
    startDatePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
        @Override
        public void onValueChange(ValueChangeEvent<Date> event) {
            startDateText.setText(dateFormat.format(event.getValue()));
            startDatePanel.hide();
        }
    });

    startDateText.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            try {
                Date date = dateFormat.parse(event.getValue());
                startDatePicker.setValue(date);
            } catch (IllegalArgumentException e) {
                // ignore
            }
        }
    });

    Date date = new Date();
    startDatePicker.setValue(date, true);

    entryGrid.setWidget(1, 3, new Label("To:"));
    formatter.setHorizontalAlignment(1, 2, HasHorizontalAlignment.ALIGN_RIGHT);

    final TextBox endDateText = new TextBox();
    entryGrid.setWidget(1, 4, endDateText);
    endDateText.setWidth("100px");

    final PopupPanel endDatePanel = new PopupPanel(true);
    endDatePanel.setAutoHideOnHistoryEventsEnabled(true);

    final ToggleButton endDateButton = new ToggleButton(new Image("resources/img/date-picker.gif"));
    entryGrid.setWidget(1, 5, endDateButton);
    endDateButton.setPixelSize(16, 16);
    endDatePanel.addAutoHidePartner(endDateButton.getElement());
    endDateButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            endDatePanel.showRelativeTo(endDateButton);
        }
    });

    endDatePanel.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            endDateButton.setDown(false);
        }
    });

    final DatePicker endDatePicker = new DatePicker();
    endDatePanel.setWidget(endDatePicker);
    endDatePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
        @Override
        public void onValueChange(ValueChangeEvent<Date> event) {
            endDateText.setText(dateFormat.format(event.getValue()));
            endDatePanel.hide();
        }
    });

    endDateText.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            try {
                Date date = dateFormat.parse(event.getValue());
                endDatePicker.setValue(date);
            } catch (IllegalArgumentException e) {
                // ignore
            }
        }
    });

    date = CalendarUtil.copyDate(date);
    CalendarUtil.addDaysToDate(date, 1);
    endDatePicker.setValue(date, true);

    SubmitButton submitButton = new SubmitButton("Search");
    entryGrid.setWidget(2, 0, submitButton);
    formatter.setColSpan(2, 0, 6);
    formatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    final HotelDealsTable table = new HotelDealsTable(10);
    panel.add(table);
    table.setWidth("500px");

    form.addSubmitHandler(new FormPanel.SubmitHandler() {
        @Override
        public void onSubmit(SubmitEvent event) {
            String dest = destText.getValue().trim();
            String start = startDateText.getValue().trim();
            String end = endDateText.getValue().trim();
            table.loadData(dest.length() == 0 ? null : dest, start.length() == 0 ? null : start,
                    end.length() == 0 ? null : end);
            event.cancel();
        }
    });

    infoPanel = new PopupPanel(true);
    infoPanel.setAutoHideOnHistoryEventsEnabled(true);
    infoGrid = new FlexTable();
    infoPanel.setWidget(infoGrid);
    FlowPanel linkPanel = new FlowPanel();
    infoGrid.setWidget(3, 0, linkPanel);

    Anchor mapLink = new Anchor("Map", "#");
    linkPanel.add(mapLink);
    mapLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            event.preventDefault();
            if (selectedResult == null)
                return;

            MarkerOptions opt = new MarkerOptions();
            opt.setTitle(selectedResult.getHeadline());
            LatLng latLng = new LatLng(selectedResult.getNeighborhoodLatitude(),
                    selectedResult.getNeighborhoodLongitude());
            opt.setPosition(latLng);
            opt.setClickable(true);
            opt.setVisible(true);
            mapWidget.show(new Marker(opt));

        }
    });

    mapWidget.addAutoHidePartner(mapLink.getElement());

    linkPanel.add(new InlineHTML("&nbsp;|&nbsp;"));
    linkPanel.add(visitLink = new Anchor("Visit", "#"));

    initWidget(new ScrollPanel(panel));
}

From source file:com.mashery.examples.api.client.QuovaExample.java

License:Open Source License

public QuovaExample(final PopupMapWidget mapWidget) {
    FlowPanel panel = new FlowPanel();

    panel.add(new HTML("<h1>IP Info</h1>"));

    FormPanel entryForm = new FormPanel();
    panel.add(entryForm);//w w  w  .j a  v a  2 s . c  o m

    Grid entryPanel = new Grid(1, 3);
    entryForm.setWidget(entryPanel);

    entryPanel.setWidget(0, 0, new Label("IP Address:"));
    entryPanel.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_MIDDLE);

    addressText = new TextBox();
    entryPanel.setWidget(0, 1, addressText);
    addressText.setWidth("150px");
    entryPanel.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    submitButton = new SubmitButton("Look Up");
    entryPanel.setWidget(0, 2, submitButton);
    entryPanel.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT,
            HasVerticalAlignment.ALIGN_MIDDLE);

    final IPInfoServiceAsync ipInfoSvc = GWT.create(IPInfoService.class);
    entryForm.addSubmitHandler(new FormPanel.SubmitHandler() {
        @Override
        public void onSubmit(SubmitEvent event) {
            addressText.setReadOnly(true);
            submitButton.setEnabled(false);

            String value = addressText.getText().trim();
            lookupIPInfo(ipInfoSvc, value.length() == 0 ? null : value);
            event.cancel();
        }
    });

    panel.add(new HTML("<em>Note: Leave blank to use your auto-detected IP address.</em>"));
    panel.add(new HTML());

    generalTable = new FlexTable();
    panel.add(generalTable);

    FlexTable.FlexCellFormatter formatter = (FlexCellFormatter) generalTable.getCellFormatter();
    int row = -1;
    formatter.setWidth(0, 0, "160px");
    generalTable.setText(++row, 0, "IP Address:");
    generalTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    generalTable.setText(++row, 0, "IP Type:");
    generalTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    generalTable.setText(++row, 0, "Anonymizer Status:");
    generalTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    for (int i = 0, n = generalTable.getRowCount(); i < n; ++i)
        formatter.getElement(i, 0).getStyle().setFontWeight(FontWeight.BOLD);

    DisclosurePanel networkPanel = new DisclosurePanel("Network");
    panel.add(networkPanel);
    networkPanel.setAnimationEnabled(true);

    networkTable = new FlexTable();
    networkPanel.setContent(networkTable);

    formatter = (FlexCellFormatter) networkTable.getCellFormatter();
    row = -1;
    formatter.setWidth(0, 0, "144px");
    networkTable.setText(++row, 0, "Organization:");
    networkTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    networkTable.setText(++row, 0, "Carrier:");
    networkTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    networkTable.setText(++row, 0, "ASN:");
    networkTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    networkTable.setText(++row, 0, "Connection Type:");
    networkTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    networkTable.setText(++row, 0, "Line Speed:");
    networkTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    networkTable.setText(++row, 0, "IP Routing Type:");
    networkTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    networkTable.setText(++row, 0, "Domain:");
    networkTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    for (int i = 0, n = networkTable.getRowCount(); i < n; ++i)
        formatter.getElement(i, 0).getStyle().setFontWeight(FontWeight.BOLD);

    locationPanel = new DisclosurePanel("Location");
    panel.add(locationPanel);
    locationPanel.setAnimationEnabled(true);

    locationTable = new FlexTable();
    locationPanel.setContent(locationTable);

    formatter = (FlexCellFormatter) locationTable.getCellFormatter();
    row = -1;
    formatter.setWidth(0, 0, "144px");
    locationTable.setText(++row, 0, "Continent:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "Country:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "Region:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "State:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "DMA:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "MSA:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "City:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "Postal Code:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "Time Zone:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "Area Code:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "Latitude:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    locationTable.setText(++row, 0, "Longitude:");
    locationTable.setText(row, 1, "");
    formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    for (int i = 0, n = locationTable.getRowCount(); i < n; ++i)
        formatter.getElement(i, 0).getStyle().setFontWeight(FontWeight.BOLD);

    mapButton = new Button("Locate on Map", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            MarkerOptions opt = new MarkerOptions();
            opt.setTitle(result.getIpAddress());
            opt.setPosition(new LatLng(result.getLatitude(), result.getLongitude()));
            opt.setClickable(true);
            opt.setVisible(true);
            mapWidget.show(new Marker(opt));
        }
    });

    mapButton.setEnabled(false);
    locationTable.setWidget(++row, 0, mapButton);
    formatter.setColSpan(row, 0, 2);
    //      formatter.setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    initWidget(new ScrollPanel(panel));
}