I am using gwt-ajaxsearch r290 release.
My Entry point class :
package com.goog.client;
import com.google.gwt.ajaxsearch.client.ExpandMode;
import com.google.gwt.ajaxsearch.client.KeepLabel;
import com.google.gwt.ajaxsearch.client.KeepListener;
import com.google.gwt.ajaxsearch.client.LinkTarget;
import com.google.gwt.ajaxsearch.client.NewsResult;
import com.google.gwt.ajaxsearch.client.NewsSearch;
import com.google.gwt.ajaxsearch.client.Result;
import com.google.gwt.ajaxsearch.client.ResultSetSize;
import com.google.gwt.ajaxsearch.client.Search;
import com.google.gwt.ajaxsearch.client.SearchControl;
import com.google.gwt.ajaxsearch.client.SearchControlOptions;
import com.google.gwt.ajaxsearch.client.SearchListener;
import com.google.gwt.ajaxsearch.client.VideoResult;
import com.google.gwt.ajaxsearch.client.VideoSearch;
import com.google.gwt.ajaxsearch.client.WebResult;
import com.google.gwt.ajaxsearch.client.WebSearch;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowResizeListener;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class GSearch implements EntryPoint , KeepListener,
SearchListener,
WindowResizeListener {
private class GoogleCodeWebSearch extends WebSearch {
public GoogleCodeWebSearch() {
setSiteRestriction("
code.google.com");
setUserDefinedLabel("Google Code");
setResultSetSize(ResultSetSize.LARGE);
}
}
private VerticalPanel clips = new VerticalPanel();
private HorizontalPanel hp = new HorizontalPanel();
public void onKeep(SearchControl control, final Result result) {
String title;
if (result instanceof WebResult) {
WebResult web = (WebResult) result;
title = web.getTitle();
} else if (result instanceof NewsResult) {
NewsResult web = (NewsResult) result;
title = web.getTitle();
} else if (result instanceof VideoResult) {
VideoResult video = (VideoResult) result;
title = video.getTitle();
// Metadata is also available
System.out.println(video.getTbHeight() + "x" +
video.getTbWidth() + " "
+ video.getDuration() + "seconds");
} else {
// Ads don't have an official interface
title = "Advertisement";
}
HTML h = new HTML(title);
h.addStyleName("clipLink");
h.addClickListener(new ClickListener() {
public void onClick(Widget w) {
PopupPanel p = new PopupPanel(true);
p.addStyleName("keepPopup");
p.setWidget(result.getHtml());
p.setPopupPosition(w.getAbsoluteLeft() + 5,
w.getAbsoluteTop()
+ w.getOffsetHeight() + 5);
p.show();
}
});
clips.add(h);
}
public void onModuleLoad() {
Window.addWindowResizeListener(this);
clips.setWidth("100%");
clips.addStyleName("clips");
clips.add(new Label("Saved Clippings:"));
// Or configure inline
WebSearch ws = new WebSearch();
ws.setSiteRestriction("
ajaxian.com");
ws.setUserDefinedLabel("Ajaxian");
ws.setResultSetSize(ResultSetSize.SMALL);
SearchControlOptions options = new SearchControlOptions();
// We can use custom subclasses
options.add(new GoogleCodeWebSearch(), ExpandMode.OPEN);
options.add(ws);
options.add(new NewsSearch());
options.add(new VideoSearch(), ExpandMode.CLOSED);
options.setKeepLabel(KeepLabel.SAVE);
options.setLinkTarget(LinkTarget.BLANK);
SearchControl searchControl = new SearchControl(options);
searchControl.addKeepListener(this);
searchControl.addSearchListener(this);
searchControl.execute("Google Web Toolkit");
clips.setWidth("200px");
hp.add(clips);
hp.add(searchControl);
RootPanel.get().add(hp, 5, 5);
onWindowResized(Window.getClientWidth(),
Window.getClientHeight());
}
/**
* This is just to show that the concrete returned types are those
defined
* in the API.
*/
public void onSearchResult(Search search, Result result) {
System.out.println("The result is a " +
result.getClass().getName());
}
public void onWindowResized(int width, int height) {
hp.setPixelSize(width - 30, height - 30);
}
}
Host.html
<html>
<head>
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Wrapper HTML for GSearch</title>
<!-- -->
<!-- Use normal html, such as style -->
<!-- -->
<style>
body,td,a,div,.p{font-family:arial,sans-serif}
div,td{color:#000000}
a:link,.w,.w a:link{color:#0000cc}
a:visited{color:#551a8b}
a:active{color:#ff0000}
</style>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
</head>
<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic ui -->
<!-- -->
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" style="width:
0;height:0;border:0"></iframe>
<script type="text/javascript" language="javascript"
src="com.goog.GSearch.nocache.js"></script>
<script type="text/javascript" src="
http://www.google.com/jsapi?
key=ABQIAAAA1DYB-gtW1-xyz"></script>
</body>
</html>
On Jul 16, 8:11 pm, "Eric Ayers" <
zun...@google.com> wrote:
> GWTBridget.java should be there in:
>
> ./dev/core/super/com/google/gwt/core/client/GWTBridge.java
>
> (although this is a relatively new class.)
>
> For gwt-ajaxsearch - are you using the r290 release or something else?
>
>
http://code.google.com/p/gwt-google-apis/downloads/list?can=1
>
> I think if you could provide a small reproducible sample that would be the
> best thing, otherwise, I'm just guessing!
>
> On Wed, Jul 16, 2008 at 10:27 AM, Ghostcoder <
thanneer.ma...@gmail.com>
> >
http://code.google.com/docreader/#p(gwt-google-apis)s(gwt-google-apis.<
http://code.google.com/docreader/#p%28gwt-google-apis%29s%28gwt-googl....>
> > .<
> >
http://code.google.com/docreader/#p%28gwt-google-apis%29s%28gwt-googl....