Thursday, January 28, 2010

GWT, Firebug -- lookup meta description, title

In GWT, The page title, meta description and meta keywords are changed dynamically as GWT token changes
So view source will show different values than in DOM.

By using firebug, we can view those information.

We put description before keywords, so the order would be:

For meta.description
document.getElementsByTagName('meta')[0].content;

For meta.keywords
document.getElementsByTagName('meta')[1].content;

For title
document.title

Saturday, January 23, 2010

GWT Create suggestion box

Have got request of how to create GWT suggestion box. Here is the copied version from my post in user group.

what you need to do it to overrite SuggestOracle, for example
YourSuggesOracle extends SuggestOracle
in method of
public void requestSuggestions( Request request, Callback callback ) {
// get query
String query
= request.getQuery();

if (query.length >=3) {
Call your RPC

set your result list to
Collection suggestions = new ArrayList();

Response response = new Response( suggestions );
callback.onSuggestionsReady( request, response );

}
}


Then you can use that orerride class
YourSuggesOracle oracle = new YourSuggesOracle ();
SuggestBox destination = new SuggestBox(oracle);


finally, you can get value of it
destination.getText();