Friday, September 10, 2010

Re: showing all the elements from SuggestOracle in suggestionBox

I don't suggest you to do that. I think it's quite misleading for the
user. A better solution should be to show a popup with a message like
"no suggestions found" or something like that.
It's quite simple using 2.1 milestones: extend either
SuggestBox.DefaultSuggestionDisplay or SuggestBox.SuggestionDisplay
and override showSuggestions method, checking if suggestions.size() is
zero and displaying a "no suggestions found" popup instead of the
default one.

If you really want to implement the behavior you mentioned, maybe this
hint could be useful too, but atm i have no idea on how to do that.

ciosbel.
On Sep 8, 1:52 pm, Santosh kumar <kopp....@gmail.com> wrote:
> Hi *ciosbel*,
>
> Thank you for your reply ..!!
>
> As u said, i am using setDefaultSuggestionsFromText method, its working
> fine.. !!! i thought solution would be very difficult...
> Its coool !! thank you once again !!!
>
> setDefaultSuggestionsFromText(Collection<java.lang.String> suggestionList)
> using this method, if their is no match found for the key pressed, Here i am
> displaying nothing. But after onChange its displaying the
> DefaultSuggestList.
>
> But my thinking is immediate onPress of the key i have to display the popup
> DefaultSuggestList if their is no match found for the key pressed.
>
> Please let me know if you know the solution ..!!
>
>
>
> On Wed, Sep 8, 2010 at 3:45 AM, ciosbel <andrew...@gmail.com> wrote:
> > Instead defining your own oracle (which is, indeed, the best
> > solution), just use a MultiWordSuggestOracle.
> > There you can find methods like:
>
> > setDefaultSuggestions(Collection<SuggestOracle.Suggestion>
> > suggestionList)
> > or
> > setDefaultSuggestionsFromText(Collection<java.lang.String>
> > suggestionList)
>
> > You can simply add suggestions to you oracle (oracle.add ...) and then
> > use one of the above to set default suggestions.
> > Now, using yourSuggestBoxInstance.showSuggestionList(), *all* your
> > suggestions will popup.
> > Remember that the oracle that provides suggestion and the default set
> > you specified using one of the above are two different things, with
> > two different purposes. So, if your list of suggestions will change in
> > future (i.e. after a clear/add in the oracle) just remember to reset
> > the defaults.
>
> > If you want to display them *all* on textbox focus...
>
> > yourSuggestBoxInstance.getTextBox().addFocusHandler(new FocusHandler()
> > {
> >  public void onFocus(FocusEvent event) {
> >    // showing all default suggestions
> >    yourSuggestBoxInstance.showSuggestionList();
> >  }
> > });
>
> > Do note also, that with 2.1 milestones the interface of the suggestbox
> > has been slightly changed. In particular you can now define your own
> > display for the popup, and use it instead of the default (and a bit
> > old) one. The custom popup can be defined by either extending
> > SuggestBox.SuggestionDisplay (if you start from zero), or
> > SuggestBox.DefaultSuggestionDisplay if you want to start from the
> > default one.
>
> > Hope it helps.
>
> > cios.
> > On 7 Set, 12:46, Santosh kumar <kopp....@gmail.com> wrote:
> > > Hi ,
>
> > > I am adding the items to the suggestoracle on onmodule load. Its working
> > > fine if the match is found for the key pressed (alphabet) .
> > > But i want to show *all Existing Items* from the suggestoracle when their
> > is
> > > no match found for the key pressed (alphabet) by the user ???
>
> > > Pls let me know if any one knows the solution ..!!
>
> > > On Fri, Aug 13, 2010 at 7:19 PM, ctasada <ctas...@gmail.com> wrote:
> > > > You can send me a private message attaching the source of your class,
> > > > so I can take a look.
>
> > > > I'm using it in my code without problems.
>
> > > > On Aug 13, 6:33 am, aditya sanas <007aditya.b...@gmail.com> wrote:
> > > > > Hello,
>
> > > > > yes you are right we dont have direct access to SuggestBox Popups.
>
> > > > > I have already extended SuggestOracle and have overridden method
>
> > > > > requestSuggestion(request,callback);
>
> > > > > code for the following as follows :
>
> > > > > public class StartsWithSuggestOracle extends SuggestOracle
> > > > > {
> > > > >    //...  some other code...
>
> > > > > *    @Override*
> > > > > *    public void requestSuggestions(Request request, Callback
> > callback) *
> > > > > *    { *
> > > > > *        final List suggestions =
> > > > > computeItemsFor(request.getQuery().toLowerCase(),request.getLimit());
> > *
> > > > > *        Response response = new Response(suggestions); *
> > > > > *        callback.onSuggestionsReady(request, response); *
> > > > > *    } *
>
> > > > > }
>
> > > > > and the underlined method computeItemsFor(); returns me the
> > suggestions
> > > > > based upon request so as per my
>
> > > > > logic if request contains no character that is an empty string "" i
> > have
> > > > > returned all suggestions from oracle object.
>
> > > > > so here i m able to get this response correctly but i m nt getting
> > wht
> > > > > should be done next with this response.
>
> > > > > from where i should give a call to this method and how that list get
> > > > > populated.
>
> > > > > I have followed that link suggested by you but that was the same
> > > > mechanism
> > > > > that used there.
>
> > > > > so i m lil confuse why its not showing the response.
>
> > > > > --
> > > > > Aditya
>
> > > > > On Thu, Aug 12, 2010 at 5:50 PM, ctasada <ctas...@gmail.com> wrote:
> > > > > > Hi Aditya,
>
> > > > > > The problem is that you don't have direct access to the SuggestBox
> > > > > > popup.
>
> > > > > > If you want to see all the possible solutions you should extend the
> > > > > > SuggestOracle and implement your own requestSuggestions method (see
> > > > > > this link for some nice examples:
> >http://development.lombardi.com/?p=39
> > > > )
>
> > > > > > In this way yo can simply return all your list, even ignoring the
> > > > > > limit.
>
> > > > > > Regards,
> > > > > > Carlos.
>
> > > > > > On Aug 12, 10:50 am, Aditya <007aditya.b...@gmail.com> wrote:
> > > > > > > hi,
>
> > > > > > > I want to show all elements from the suggestoracle whenever
> > > > > > > suggestionbox recieves a focus.
>
> > > > > > > I did some search for it and i found something as follows :
>
> > > >http://groups.google.com/group/google-web-toolkit/browse_thread/threa.
> > ..
>
> > > > > > > Now i m able to recieve Response
>
> > > > > > > this.getSuggestOracle().requestSuggestions(request, new
> > Callback() {
> > > > > > > @Override
> > > > > > > public void onSuggestionsReady(Request request, Response
> > response) {
> > > > > > >                 // here I m getting complete list from
> > suggestoracle
> > > > > > >         }
>
> > > > > > > });
>
> > > > > > > I am able to get list of suggestions in this response but i dnt
> > knw
> > > > > > > what should i do next...?
>
> > > > > > > what should be done with this response how this will help me to
> > > > > > > populate suggestions...?
>
> > > > > > > Thank you.
>
> > > > > > > --
> > > > > > > Aditya
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > > > > "Google Web Toolkit" group.
> > > > > > To post to this group, send email to
> > > > google-web-toolkit@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > > > google-web-toolkit+unsubscribe@googlegroups.com<google-web-toolkit%2Bunsubscribe@googlegroups.com>
> > <google-web-toolkit%2Bunsubscribe@googlegroups.com<google-web-toolkit%252Bunsubscribe@googlegroups.com>
>
> > > > <google-web-toolkit%2Bunsubscribe@googlegroups.com<google-web-toolkit%252Bunsubscribe@googlegroups.com>
> > <google-web-toolkit%252Bunsubscribe@googlegroups.com<google-web-toolkit%25252Bunsubscribe@googlegroups.com>
>
> > > > > > .
> > > > > > 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
> > google-web-toolkit@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > google-web-toolkit+unsubscribe@googlegroups.com<google-web-toolkit%2Bunsubscribe@googlegroups.com>
> > <google-web-toolkit%2Bunsubscribe@googlegroups.com<google-web-toolkit%252Bunsubscribe@googlegroups.com>
>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > > --
> > > Thanks & Regards
>
> > > *S a n t o s h  k u m a r . k*
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-web-toolkit@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscribe@googlegroups.com<google-web-toolkit%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> Thanks & Regards
>
> *S a n t o s h  k u m a r . k*

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment