List of usage examples for com.google.gwt.user.client.ui SuggestOracle.Response SuggestOracle.Response
public Response(Collection<? extends Suggestion> suggestions)
From source file:org.drools.guvnor.client.widgets.query.QuickFindWidget.java
License:Apache License
/** * This will load a list of items as they are typing. */// w w w. j a va 2 s . c o m protected void loadShortList(String searchText, Boolean searchArchived, Boolean isCaseSensitive, final Request r, final Callback cb) { final QueryPageRequest queryRequest = new QueryPageRequest(searchText, searchArchived, isCaseSensitive, 0, 5); AssetServiceAsync assetService = GWT.create(AssetService.class); assetService.quickFindAsset(queryRequest, new GenericCallback<PageResponse<QueryPageRow>>() { public void onSuccess(PageResponse<QueryPageRow> result) { List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>(); for (QueryPageRow row : result.getPageRowList()) { final String name = row.getName(); items.add(new SuggestOracle.Suggestion() { public String getDisplayString() { return name; } public String getReplacementString() { return name; } }); } cb.onSuggestionsReady(r, new SuggestOracle.Response(items)); } }); }