it depends how you access your backend? How do you transmit your DTO's from the backend to the frontend? Manually parsing JSON? RequestFactory? RPC?
On Mon, Aug 27, 2012 at 4:49 PM, Deepak Singh <[email protected]> wrote: > I understand this. But my question is how do i implement > CustomSuggestOracle.java > > What will be implementation of the method getMatchingCities() in > customSuggestionOracle ? > > Thanks > Deepak > > > On Mon, Aug 27, 2012 at 12:42 PM, Ümit Seren <[email protected]> wrote: >> >> It depends how you want to access your backend. Assuming you do a normal >> Ajax call you could do something like this: >> >> private List<CustomSuggestion> getMatchingCities(String query, int limit) >> { >> List<CustomSuggestion> list = new ArrayList<CustomSuggestion>(); >> RequestBuilder request = new >> RequestBuilder(RequestBuilder.GET,url+"?query="+query+"&limit=" + limit); >> request.setCallback(new RequestCallback() { >> @Override >> public void onResponseReceived(Request request, Response response) { >> //parse the result (maybe JSON) and populate your ArrayList >> } >> @Override >> public void onError(Request request, Throwable exception) { >> // TODO Auto-generated method stub >> } >> }); >> try >> { >> request.send(); >> } >> catch (Exception e) { >> } >> } >> >> On Sunday, August 26, 2012 11:20:31 PM UTC+2, Deepak Singh wrote: >>> >>> Hi, >>> >>> I tried this way >>> >>> public class CustomSuggestion implements Suggestion{ >>> public CityNameDTO dto = null; >>> public CustomSuggestion(CityNameDTO dto) { >>> this.dto = dto; >>> } >>> @Override >>> public String getDisplayString() { >>> return dto.getCityName(); >>> } >>> >>> @Override >>> public String getReplacementString() { >>> return dto.getCityId(); >>> } >>> >>> } >>> >>> >>> public class CustomSuggestOracle extends SuggestOracle{ >>> >>> List<CustomSuggestion> citySugggestions = null; >>> @Override >>> public void requestSuggestions(Request request, Callback callback) { >>> Response response = new Response(getMatchingCities(request.getQuery(), >>> request.getLimit())); >>> } >>> private List<CustomSuggestion> getMatchingCities(String query, int limit) >>> { >>> List<CustomSuggestion> list = new ArrayList<CustomSuggestion>(); >>> } >>> } >>> >>> >>> Now i am not able to understand how to go ahead with this >>> customSuggestOracle. >>> >>> Could you pls guide me here? >>> >>> Thanks >>> Deepak >>> >>> On Sun, Aug 26, 2012 at 11:18 PM, Thomas Broyer <[email protected]> >>> wrote: >>>> >>>> >>>> >>>> On Sunday, August 26, 2012 6:36:11 PM UTC+2, Deepak Singh wrote: >>>>> >>>>> But after selecting a value, how do i get the id of the selected value? >>>> >>>> >>>> SuggestBox works best if you use the ID as the "replacementString" and >>>> the label as the "displayString" of the Suggestions in your SuggestOracle. >>>> In that case, you don't have to do anything, the ID will be set in the text >>>> box upon selecting a suggestion. >>>> (e.g. the "replacement string" is an email address, and the display >>>> string also contains the full name, the oracle using both the full name and >>>> email address for providing suggestions) >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Google Web Toolkit" group. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msg/google-web-toolkit/-/Ldxgth8ifd0J. >>>> >>>> To post to this group, send email to [email protected]. >>>> >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/google-web-toolkit?hl=en. >>> >>> >>> >>> >>> -- >>> Deepak Singh >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Web Toolkit" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-web-toolkit/-/cGP5gBfv5soJ. >> >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-web-toolkit?hl=en. > > > > > -- > Deepak Singh > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
