This version does not implement the complete API, and is restricted to the following (for time rather than technical issues)
To use, do the following:
1. Add the following to the HTML file<,p>
<link href="http://www.google.com/uds/css/gsearch.css" rel="stylesheet" type="text/css"/> <script src="http://www.google.com/uds/api?file=uds.js&v=0.1&key=XXXXXXXX" type="text/javascript"> </script>
Where key=XXXXXXXX needs to be replaced with a valid Google Ajax Search API Key available from the Google AJAX Search API site.
2. In your *application*.gwt.xml file add:
<!-- Inherit the Widgit library --> <inherits name='org.gwtwidgets.WidgetLibrary'/>
3. Widget can be used similar to the following:
// Create an instance of the SearchWidget GSearchWidget searchWidget = new GSearchWidget(); searchWidget.getGSearch(); // Set the result set size to one of 2 enumerations searchWidget.setResultSetSize(GSearch.SMALL_RESULTSET); // Set the target for links in the search to one of 4 enumerations searchWidget.setLinkTarget(GSearch.LINK_TARGET_SELF); // If own text input field used, can set the timeout on the // control for firing off the search to one of 3 enumerations searchWidget.setTimeoutInterval(GSearchControl.TIMEOUT_SHORT); // Create a GsearcherOptions GsearcherOptions searchOptions = new GsearcherOptions(); // Set the results to be closed on first call searchOptions.setExpandMode(GSearchControl.EXPAND_MODE_CLOSED); // Create a GwebSearcher GwebSearch theWebSearcher = searchWidget.getGwebSearch(); // OPTIONS: // Optionally restrict its results to those from amamzon.co.uk theWebSearcher.setSiteRestriction("www.amazon.co.uk"); // Add the searcher to the Widget searchWidget.addSearcher(theWebSearcher,searchOptions); // Create a GlocalSearch GlocalSearch theLocalSearcher = searchWidget.getGlocalSearch(); // OPTIONS: // Put its location to Stockholm // Parameters of GPoint or GLatLng not implemented yet as that // creates a dependancy on Google Map implemenations... // ...of which there is a really good one by aglaforge theLocalSearcher.setCenterPoint("Stockholm, Sweden"); // Add the searcher to the Widget searchWidget.addSearcher(theLocalSearcher,searchOptions); // Create a GvideoSearch GvideoSearch theVideoSearcher = GvideoSearch.create(); // OPTIONS: // No additional methods // Add the searcher to the Widget searchWidget.addSearcher(theVideoSearcher,searchOptions); // Create a GblogSearch GblogSearch theBlogSearcher = GblogSearch.create(); // OPTIONS: // Could restrict the searched sites if we wanted // theWebSearcher.setSiteRestriction("www.blogspot.com"); // Add the searcher to the Widget searchWidget.addSearcher(theBlogSearcher,searchOptions); // Create a GdrawOptions GdrawOptions theOptions = new GdrawOptions(); // Set the search to return in a Tabbed view as opposed to Linnear theOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED); // If using a different input area, can define as follows: // TextBox theSearchEntry = new TextBox(); // theOptions.setInput(theSearchEntry.getElement()); // Draw the search control searchWidget.draw(theOptions); // Automatically execute a search across the searchers searchWidget.execute("'Isbar Stockholm'");