List of usage examples for com.google.gwt.ajaxloader.client AjaxLoader loadApi
public static void loadApi(final String api, final String version, Runnable onLoad, AjaxLoaderOptions settings)
From source file:com.ait.toolkit.gmaps.client.GMapsLibraryLoader.java
License:Open Source License
private static void load(final Runnable onLoad, boolean sensor, ArrayList<GmapLibrary> loadLibraries, Language language, String otherParams) { String op = "&sensor=" + sensor; if (otherParams != null) { op += "&" + otherParams; }//from w ww . j a v a 2s . c om if (loadLibraries != null) { op += "&" + getLibraries(loadLibraries); } if (language != null) { op += "&language=" + language.getValue(); } AjaxLoaderOptions settings = AjaxLoaderOptions.newInstance(); settings.setOtherParms(op); AjaxLoader.loadApi("maps", API_VERSION, onLoad, settings); }
From source file:com.floreysoft.gwt.picker.client.utils.PickerLoader.java
License:Apache License
/** * Loads the picker api with the given version and options * * @param version The version to load/*from w w w. j a va 2 s. c o m*/ * @param runnable The callback * @param options The ajax-loader options */ public static void loadApi(String apiKey, String version, Runnable runnable, AjaxLoader.AjaxLoaderOptions options) { AjaxLoader.init(apiKey); AjaxLoader.loadApi(PICKER_API, version, runnable, options); }
From source file:com.floreysoft.gwt.picker.client.utils.ShareLoader.java
License:Apache License
/** * Loads the picker api with the given version and options * * @param version The version to load// w ww .j a v a 2 s . c om * @param runnable The callback * @param options The ajax-loader options */ public static void loadApi(String apiKey, String version, Runnable runnable, AjaxLoader.AjaxLoaderOptions options) { AjaxLoader.init(apiKey); AjaxLoader.loadApi(DRIVE_SHARE_API, version, runnable, options); }
From source file:com.google.gwt.ajaxloader.sample.helloajaxloader.client.HelloAjaxLoader.java
License:Apache License
/** * This is the entry point method./*w ww. j a v a 2 s . co m*/ */ public void onModuleLoad() { verticalPanel.getElement().getStyle().setPropertyPx("margin", 10); verticalPanel.setSpacing(10); RootPanel.get().add(verticalPanel); // Uncomment and replace the key below to load a key for the APIs. You // could replace this with some kind of lookup based on // Window.location.getHost() and Window.location.getPort(); // AjaxLoader.init("ABCDEFG"); AjaxLoader.loadApi("maps", "2", new Runnable() { public void run() { mapsLoaded(); } }, null); AjaxLoaderOptions options = AjaxLoaderOptions.newInstance(); options.setPackages("imagepiechart"); AjaxLoader.loadApi("visualization", "1", new Runnable() { public void run() { pieChartLoaded(); } }, options); }
From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java
License:Apache License
private Widget createLocationPanel() { final VerticalPanel locationPanel = new VerticalPanel(); // show a map based on geocoded or manually-inputted lat-long combination HorizontalPanel descriptionPanel = new HorizontalPanel(); descriptionPanel.add(new HTML("Location name (displayed to readers):")); locationDescriptionTextArea = new TextArea(); locationDescriptionTextArea.setCharacterWidth(50); locationDescriptionTextArea.setHeight("60px"); descriptionPanel.add(locationDescriptionTextArea); Label geocodingOptions = new Label("Geocode based on:"); useDisplayedLocation = new RadioButton("geoGroup", "The displayed location name"); useDisplayedLocation.setValue(true); useAlternateLocation = new RadioButton("geoGroup", "An alternate location that geocodes better: "); alternateTextBox = new TextBox(); alternateTextBox.setEnabled(false);/*ww w.jav a 2 s .c o m*/ HorizontalPanel alternatePanel = new HorizontalPanel(); alternatePanel.add(useAlternateLocation); alternatePanel.add(alternateTextBox); useManualLatLong = new RadioButton("geoGroup", "Manually entered latitude and longitude numbers (enter these below)"); HorizontalPanel latLongPanel = new HorizontalPanel(); latLongPanel.add(new HTML("Latitude: ")); latitudeTextBox = new TextBox(); latitudeTextBox.setEnabled(false); latLongPanel.add(latitudeTextBox); latLongPanel.add(new HTML(" Longitude: ")); longitudeTextBox = new TextBox(); longitudeTextBox.setEnabled(false); latLongPanel.add(longitudeTextBox); HorizontalPanel buttonPanel = new HorizontalPanel(); geocodeButton = new Button("Geocode location"); geocodeButton.setEnabled(false); buttonPanel.add(geocodeButton); geocoderStatus = new Label(""); buttonPanel.add(geocoderStatus); AjaxLoaderOptions options = AjaxLoaderOptions.newInstance(); options.setOtherParms(mapsKey + "&sensor=false"); AjaxLoader.loadApi("maps", "2", new Runnable() { @Override public void run() { map = new MapWidget(); map.setSize(MAP_WIDTH + "px", MAP_HEIGHT + "px"); map.addControl(new SmallMapControl()); map.setDoubleClickZoom(true); map.setDraggable(true); map.setScrollWheelZoomEnabled(true); map.setZoomLevel(MAP_ZOOM); map.setVisible(false); locationPanel.add(map); createLocationHandlers(); } }, options); locationPanel.add(descriptionPanel); locationPanel.add(geocodingOptions); locationPanel.add(useDisplayedLocation); locationPanel.add(alternatePanel); locationPanel.add(useManualLatLong); locationPanel.add(latLongPanel); locationPanel.add(buttonPanel); locationPanel.add(new Label("Tip: once the map is visible, right-click a point on the map to indicate that" + " this is the precise location you want")); DisclosurePanel locationZippy = new DisclosurePanel("Location"); locationZippy.add(locationPanel); return locationZippy; }
From source file:com.google.livingstories.client.lsp.views.contentitems.LocationView.java
License:Apache License
public LocationView(Location location) { this.location = location; initWidget(uiBinder.createAndBindUi(this)); AjaxLoaderOptions options = AjaxLoaderOptions.newInstance(); options.setOtherParms(LivingStoryData.getMapsKey() + "&sensor=false"); // Instantiating the map via a runnable breaks horribly on firefox, for reasons // that are still mysterious to us. If we introduce some delay, though, // it works fine, and doesn't greatly hurt overall page functionality. AjaxLoader.loadApi("maps", "2", new Runnable() { @Override/* w w w . j a v a2 s. c o m*/ public void run() { new Timer() { @Override public void run() { content.add(createMap()); } }.schedule(1000); } }, options); }
From source file:com.google.livingstories.plugins.wordpress.livingstorypropertymanager.client.ui.LocationInput.java
License:Apache License
private Widget createLocationPanel(final Location location) { final VerticalPanel locationPanel = new VerticalPanel(); if (mapsKeyExists) { HorizontalPanel descriptionPanel = new HorizontalPanel(); descriptionPanel.add(new HTML("Location name (displayed to readers):")); locationDescriptionTextArea = new TextArea(); locationDescriptionTextArea.setName("lsp_location_description"); locationDescriptionTextArea.setCharacterWidth(50); locationDescriptionTextArea.setHeight("60px"); descriptionPanel.add(locationDescriptionTextArea); Label geocodingOptions = new Label("Geocode based on:"); useDisplayedLocation = new RadioButton("geoGroup", "The displayed location name"); useDisplayedLocation.setValue(true); useAlternateLocation = new RadioButton("geoGroup", "An alternate location that geocodes better: "); alternateTextBox = new TextBox(); alternateTextBox.setEnabled(false); HorizontalPanel alternatePanel = new HorizontalPanel(); alternatePanel.add(useAlternateLocation); alternatePanel.add(alternateTextBox); useManualLatLong = new RadioButton("geoGroup", "Manually entered latitude and longitude numbers (enter these below)"); HorizontalPanel latLongPanel = new HorizontalPanel(); latLongPanel.add(new HTML("Latitude: ")); latitudeTextBox = new TextBox(); latitudeTextBox.setEnabled(false); latLongPanel.add(latitudeTextBox); latLongPanel.add(new HTML(" Longitude: ")); longitudeTextBox = new TextBox(); longitudeTextBox.setName("lsp_longitude"); longitudeTextBox.setEnabled(false); latLongPanel.add(longitudeTextBox); // Hidden fields are needed to pass the value of the latitude and longitude text boxes to // the PHP code because the text boxes can be disabled. And if they are disabled, their // values can't be accessed. latitudeValue = new Hidden(); latitudeValue.setName("lsp_latitude"); longitudeValue = new Hidden(); longitudeValue.setName("lsp_longitude"); HorizontalPanel buttonPanel = new HorizontalPanel(); geocodeButton = new Button("Geocode location"); geocodeButton.setEnabled(false); buttonPanel.add(geocodeButton);//from w w w. j av a 2 s. c o m geocoderStatus = new Label(""); buttonPanel.add(geocoderStatus); locationPanel.add(descriptionPanel); locationPanel.add(geocodingOptions); locationPanel.add(useDisplayedLocation); locationPanel.add(alternatePanel); locationPanel.add(useManualLatLong); locationPanel.add(latLongPanel); locationPanel.add(buttonPanel); locationPanel.add(new Label("Tip: once the map is visible, right-click a point on the map to" + " indicate that this is the precise location you want")); locationPanel.add(latitudeValue); locationPanel.add(longitudeValue); locationZippy = new DisclosurePanel("Location"); locationZippy.add(locationPanel); // show a map based on geocoded or manually-inputted lat-long combination AjaxLoaderOptions options = AjaxLoaderOptions.newInstance(); options.setOtherParms(mapsKey + "&sensor=false"); AjaxLoader.loadApi("maps", "2", new Runnable() { @Override public void run() { mapsApiReady = true; map = new MapWidget(); map.setSize(MAP_WIDTH + "px", MAP_HEIGHT + "px"); map.addControl(new SmallMapControl()); map.setDoubleClickZoom(true); map.setDraggable(true); map.setScrollWheelZoomEnabled(true); map.setZoomLevel(MAP_ZOOM); map.setVisible(false); locationPanel.add(map); createLocationHandlers(); // Set the provided location on the map, if there is any setLocation(location); // Add handlers to re-center the map when the disclosure panel is toggled, because the // map has trouble centering if it's visibility is changed via the map. The handlers need // to be added here because we want to make sure that the map has been created before // adding the handlers. addDisclosurePanelHandlers(); } }, options); } else { Label noKeyLabel = new Label("Google Maps API key not available. Please specify in" + " the ClientConstants.properties file."); noKeyLabel.setStyleName(Resources.INSTANCE.css().error()); locationPanel.add(noKeyLabel); } return locationZippy; }
From source file:com.google.maps.gwt.samples.basics.client.MapSimpleAjaxLoader.java
License:Apache License
@Override public void onModuleLoad() { AjaxLoaderOptions options = AjaxLoaderOptions.newInstance(); options.setOtherParms("sensor=false&language=ja"); Runnable callback = new Runnable() { public void run() { renderMap();//w ww .j a v a 2s . com } }; AjaxLoader.loadApi("maps", "3", callback, options); }
From source file:com.rhizospherejs.gwt.showcase.client.books.BooksTab.java
License:Open Source License
private BooksTab() { books = new HashMap<String, Book>(); searchApiLoaded = false;/*from www. j a v a2s . com*/ initWidget(ui.createAndBindUi(this)); Resources.INSTANCE.booksCss().ensureInjected(); // Load the Google Book Search APIs. AjaxLoader.loadApi("search", "1", new Runnable() { @Override public void run() { searchApiLoaded = true; } }, null); }