I have RPC SuggestBox, but unfortunately it returns me all data from server side independently input value in suggest box, and I wanted to convert suggestion into array, which I will fetch in label in ScrollPanel.
public class RPCSuggestImpl extends RemoteServiceServlet implements RPCSuggest { public SuggestOracle.Response getQuote(SuggestOracle.Request req) { SuggestOracle.Response resp = new SuggestOracle.Response(); List<ItemSuggestion> suggestions=new ArrayList<ItemSuggestion>(); for (int i=0;i<1000;i++) { Integer j=i; suggestions.add(new ItemSuggestion(j.toString())); } resp.setSuggestions(suggestions); return resp; } }
public interface RPCSuggest extends RemoteService { SuggestOracle.Response getQuote(SuggestOracle.Request req);
public class ItemSuggestion implements IsSerializable, SuggestOracle.Suggestion { private String s; // Required for IsSerializable to work public ItemSuggestion() { } // Convenience method for creation of a suggestion public ItemSuggestion(String s) { this.s = s; } public String getDisplayString() { return s; } public String getReplacementString() { return s; } } // end inner class ItemSuggestion
public class ItemSuggestionOracle extends SuggestOracle { public static final RPCSuggestAsync rpcService = RPCSuggest.App.getInstance(); public boolean isDisplayStringHTML() { return true; } public void requestSuggestions(SuggestOracle.Request req,SuggestOracle.Callback callback) { rpcService.getQuote(req, new ItemSuggestCallback(req, callback)); } class ItemSuggestCallback implements AsyncCallback { private SuggestOracle.Request req; private SuggestOracle.Callback callback; public ItemSuggestCallback(SuggestOracle.Request _req, SuggestOracle.Callback _callback) { req = _req; callback = _callback; } public void onFailure(Throwable error) { callback.onSuggestionsReady(req, new SuggestOracle.Response()); } public void onSuccess(Object retValue) { callback.onSuggestionsReady(req, (SuggestOracle.Response) retValue); } } }