Example usage for com.google.gwt.maps.client Maps loadMapsApi

List of usage examples for com.google.gwt.maps.client Maps loadMapsApi

Introduction

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

Prototype

public static void loadMapsApi(String key, String version, boolean usingSensor, Runnable onLoad) 

Source Link

Document

Initializes the Maps API using the AjaxLoader.

Usage

From source file:com.google.gwt.gadgets.sample.traveler.client.TravelerGadget.java

License:Apache License

@Override
protected void init(final TravelerPreferences prefs) {
    Maps.loadMapsApi("", "2", false, new Runnable() {
        public void run() {
            buildUi(prefs);//from  w w  w  . j a  v a 2 s.  c  o m
        }
    });
}

From source file:com.google.gwt.sample.vanfood.client.VanFood.java

/**
 * This is the entry point method.//from   ww w.j a  va2 s.  com
 */
public void onModuleLoad() {
    LoginServiceAsync loginService = GWT.create(LoginService.class);
    loginService.login(GWT.getHostPageBaseURL(), new AsyncCallback<LoginInfo>() {
        public void onFailure(Throwable error) {
            handleError(error);
        }

        public void onSuccess(LoginInfo result) {
            loginInfo = result;
            if (loginInfo.isLoggedIn() && loginInfo.isAdmin()) {
                Maps.loadMapsApi(apiKey, "2", false, new Runnable() {
                    public void run() {
                        loadVanFood();
                        loadAdminPage();
                    }
                });
            } else if (loginInfo.isLoggedIn()) {
                Maps.loadMapsApi(apiKey, "2", false, new Runnable() {
                    public void run() {
                        loadVanFood();
                    }
                });

            } else {
                loadLogin();
            }
        }
    });
}

From source file:org.ow2.aspirerdfid.tracking.demo.client.TrackingDemo.java

License:Open Source License

public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get();

    mainPanel = new DockLayoutPanel(Unit.EM);
    rootPanel.add(mainPanel, 0, 0);// w  w  w.  jav  a  2  s.co  m
    //mainPanel.setSize("1024px", "768px");
    mainPanel.setHeight("100%");
    mainPanel.setWidth("100%");

    horizontalPanel = new HorizontalPanel();
    mainPanel.addNorth(horizontalPanel, 7.8);

    image = new Image("images/ApireRFID_logo.png");
    horizontalPanel.add(image);
    image.setSize("163px", "67px");

    tagSearchTextBox = new TextBox();
    tagSearchTextBox.addKeyPressHandler(this);
    tagSearchTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel.add(tagSearchTextBox);
    horizontalPanel.setCellVerticalAlignment(tagSearchTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    tagSearchTextBox.setSize("160px", "18px");

    button = new Button("New button");
    button.addClickHandler(this);
    button.setText("Search");
    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(button, HasVerticalAlignment.ALIGN_MIDDLE);
    button.setWidth("92px");

    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    ProvidesKey<TagDataPoint> keyProvider = new ProvidesKey<TagDataPoint>() {
        public Object getKey(TagDataPoint item) {
            // Always do a null check.
            return (item == null) ? null : item.id;
        }
    };

    // Create a CellList using the keyProvider.
    CellList<TagDataPoint> cellList = new CellList<TagDataPoint>(new TagDataPointCell(), keyProvider);
    cellList.setWidth("100%");
    cellList.setPageSize(99);

    // Add a selection model to handle user selection.
    final SingleSelectionModel<TagDataPoint> selectionModel = new SingleSelectionModel<TagDataPoint>();
    cellList.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @SuppressWarnings("deprecation")
        public void onSelectionChange(SelectionChangeEvent event) {
            TagDataPoint selected = selectionModel.getSelectedObject();
            if (selected != null) {
                // Update the properties flexTable
                // ClearFlexTable
                for (int i = epcClassPropTable.getRowCount() - 1; i > 0; i--) {
                    epcClassPropTable.removeRow(i);
                }
                if (!selected.getEpcClassProperties().equals("")) {
                    JSONValue value = JSONParser.parse(selected.getEpcClassProperties());
                    JSONArray proparray = value.isArray();
                    if (proparray != null) {
                        for (int i = 0; i <= proparray.size() - 1; i++) {
                            JSONObject propObj = proparray.get(i).isObject();
                            for (String key : propObj.keySet()) {
                                String keyvalue = propObj.get(key).isString().stringValue();
                                epcClassPropTable.setText(i + 1, 0, key);
                                epcClassPropTable.setText(i + 1, 1, keyvalue);
                                epcClassPropTable.getCellFormatter().addStyleName(i + 1, 0,
                                        "watchListNumericColumn");
                                epcClassPropTable.getCellFormatter().addStyleName(i + 1, 1,
                                        "watchListNumericColumn");
                            }
                        }
                    }
                }
            }
        }
    });

    // Add the cellList to the dataProvider.
    dataProvider.addDataDisplay(cellList);
    ScrollPanel scroller = new ScrollPanel(cellList);
    scroller.setStyleName("scrollable");
    scroller.setHeight("100%");
    scroller.setWidth("100%");

    mainPanel.addWest(scroller, 20);

    epcClassPropTable = new FlexTable();
    mainPanel.addEast(epcClassPropTable, 20);
    epcClassPropTable.setText(0, 0, "Property");
    epcClassPropTable.setText(0, 1, "Value");
    epcClassPropTable.getRowFormatter().addStyleName(0, "epcClassPropHeader");
    epcClassPropTable.addStyleName("epcClassProp");
    epcClassPropTable.getCellFormatter().addStyleName(0, 0, "watchListNumericColumn");
    epcClassPropTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn");

    Maps.loadMapsApi("", "2", false, new Runnable() {
        public void run() {
            buildUi();
        }
    });
}

From source file:org.yocto.sample.client.WorldMap.java

License:Open Source License

public void onModuleLoad() {

    hubs = new HashMap<String, Hub>();

    //Loading page is taken from:

    //Let's initialize the currentHub and template.
    //The values taken are the default values
    GWTYoctoTemplate template = new GWTYoctoTemplate("http://localhost:4444");
    currentHub = new Hub(new YoctoHub(template));

    //Load the Map
    Maps.loadMapsApi("", "2", false, new Runnable() {
        public void run() {
            buildUi();/*from   w ww  .j a  v a 2  s . c  o  m*/
        }
    });

}