Example usage for com.google.gwt.maps.client InfoWindowContent setNoCloseOnClick

List of usage examples for com.google.gwt.maps.client InfoWindowContent setNoCloseOnClick

Introduction

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

Prototype

public void setNoCloseOnClick(boolean noCloseFlag) 

Source Link

Document

Indicates whether or not the info window should close for a click on the map that was not on a marker.

Usage

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

License:Apache License

/**
 * Display one of the info Window test cases.
 *///ww  w  .j  a va 2 s  .  c o  m
private void displayInfoWindow() {

    // pop down the existing info window.
    if (info != null) {
        info.close();
    }

    info = map.getInfoWindow();
    String selection = actionListBox.getItemText(actionListBox.getSelectedIndex());

    if (selection == null) {
        return;
    }

    InfoWindowContent content;

    if (selection.equals(TEST_MAX_CONTENT)) {

        // Demonstrate the use of the maxTitle and maxContent properties
        HTML htmlWidget = new HTML(
                "<h1>ATTENTION PLEASE</h1>" + "<p> I have a few things to say to you (click maximize.)</p>");
        content = new InfoWindowContent(htmlWidget);
        content.setMaxContent("<p>Now is the time for all good men to come to the"
                + " aid of their country because we hold these truths to be self"
                + " evident, that I have a dream, that one day our children and our"
                + " children's children will tear down this wall!</p>"
                + "<p>Now is the time for all good men to come to the"
                + " aid of their country because we hold these truths to be self"
                + " evident, that I have a dream, that one day our children and our"
                + " children's children will tear down this wall!</p>");
        content.setMaxTitle("ATTENTION PLEASE");

    } else if (selection.equals(TEST_IMAGE)) {

        // An image that isn't loaded yet doesn't work well sometimes
        // Specify the width and height to work around this.
        HTML htmlWidget = new HTML("<img src=\"boot.jpg\" width=\"235\" height=\"287\">");
        content = new InfoWindowContent(htmlWidget);
    } else if (selection.equals(TEST_NO_CLICK)) {

        // Demonstrates setting the info window to stay "sticky" and not
        // automatically close when the user clicks on the maps window.
        HTML htmlWidget = new HTML("<h1>STICKY INFO WINDOW</h1>"
                + "<p> Click if you must, you won't get rid of me that easily.</p>");
        content = new InfoWindowContent(htmlWidget);
        content.setNoCloseOnClick(true);
    } else if (selection.equals(TEST_TABS)) {

        // Display tabs in the InfoWindow
        content = displayInfoWindowTabs();
    } else if (selection.equals(TEST_MAX_TITLE_CONTENT_WIDGET)) {

        // Display the maximized content using widgets instead of strings.
        content = displayInfoWindowMaxWidget();
    } else if (selection.equals(TEST_MAP_BLOWUP)) {

        // Display a Map Blowup Window
        content = new InfoWindowContent.MapBlowupContent();
    } else {

        // The default case
        Tree tree = new Tree();
        TreeItem foo = new TreeItem("Foo");
        tree.addItem(foo);
        TreeItem bar = new TreeItem("bar");
        foo.addItem(bar);
        bar.addItem("baz");
        bar.addItem("gwt");
        // max-height must be set in advance so info window is sized appropriately
        tree.setSize("217px", "104px");
        content = new InfoWindowContent(tree);
    }

    info.open(map.getCenter(), content);
}