Java Code Examples for com.google.gwt.user.client.ui.SuggestOracle#Request

The following examples show how to use com.google.gwt.user.client.ui.SuggestOracle#Request . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JMXPresenter.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void requestSuggestions(final SuggestOracle.Request request, final SuggestOracle.Callback callback) {

    LoadSocketBindingsCmd cmd = new LoadSocketBindingsCmd(dispatcher, factory, metaData);
    cmd.execute("full-ha-sockets", new SimpleCallback<List<SocketBinding>>() {
        @Override
        public void onSuccess(List<SocketBinding> result) {

            List<SimpleSuggestion> suggestions = new ArrayList<SimpleSuggestion>();
            for (SocketBinding binding : result) {
                if (binding.getName().startsWith(request.getQuery())) {
                    SimpleSuggestion suggestion = new SimpleSuggestion(
                            binding.getName(), binding.getName()
                    );
                    suggestions.add(suggestion);
                }
            }


            SuggestOracle.Response response = new SuggestOracle.Response();
            response.setSuggestions(suggestions);
            response.setMoreSuggestionsCount(suggestions.size());
            callback.onSuggestionsReady(request, response);
        }
    });


}
 
Example 2
Source File: SuggestionManagement.java    From core with GNU Lesser General Public License v2.1 votes vote down vote up
void requestSuggestions(SuggestOracle.Request request, SuggestOracle.Callback callback);