Package com.google.gwt.user.client.ui.SuggestOracle

Examples of com.google.gwt.user.client.ui.SuggestOracle.Response


    box.setEnabled(false);

    // Response comes back after that
    Collection<MultiWordSuggestion> suggestions = new ArrayList<MultiWordSuggestion>();
    suggestions.add(new MultiWordSuggestion("one", "one"));
    oracle.callback.onSuggestionsReady(oracle.request, new Response(suggestions));

    // The suggestion list stays hidden
    assertFalse(display.isSuggestionListShowing());
  }
View Full Code Here


        // only now give them the enumeration
        Collection<Suggestion> s2 = new ArrayList();
        s2.add(new MultiWordSuggestion("M", "M"));
        s2.add(new MultiWordSuggestion("F", "F"));

        config.getEnumerateCallback().onSuccess(new Response(s2));

        Comparison c = (Comparison) s.getCondition();
        Parameter p = (Parameter) c.getRight();
        SelectEditorWidget sew = (SelectEditorWidget) p.getEditorWidget();
        assertEquals("M", sew.getValue());
View Full Code Here

      throws ActionException {
    SuggestTree<Integer> tree = ContextHelper.getSuggestTree(servletContext);
   
    // suggest tree not available?
    if (tree == null) {
      return new RequestGlobalSearchSuggestionResult(new Response());
    }
   
    SuggestionList list = tree.getBestSuggestions(action.getRequest().getQuery());
    ArrayList<ItemSuggestion> suggestions = new ArrayList<ItemSuggestion>();
    for (int i=0;i<list.length();i++){
      suggestions.add(new ItemSuggestion(list.get(i)));     
    }
    Response resp = new Response();
    resp.setSuggestions(suggestions);
    return new RequestGlobalSearchSuggestionResult(resp);
  }
View Full Code Here

     
      @Override
      public void requestSuggestions(final Request request,
          final Callback callback) {
        /* Request suggestions from Oracle*/
        final Response r = new Response();
        final ArrayList<DisplayableItemSuggestion> suggestionList = new ArrayList<DisplayableItemSuggestion>();

        // Normaize input to lower case
        request.setQuery(request.getQuery().toLowerCase());

        // make sure pers. suggest tree is set.
        setPersonalizedSuggestTree();
       
        // Add personalized suggestions to list
        SuggestionList list = personalizedSuggestTree.getBestSuggestions(request.getQuery());
        for (int i=0;i< list.length();i++){
          suggestionList.add(new DisplayableItemSuggestion(list.get(i), request.getQuery(),true));
        }
        r.setSuggestions(suggestionList);
        callback.onSuggestionsReady(request, r);

        //Get suggestions
        dispatcher.execute(
            new RequestGlobalSearchSuggestion(request),
            new AsyncCallback<RequestGlobalSearchSuggestionResult>() {
              @Override
              public void onFailure(Throwable caught) {
              }
             
              @Override
              public void onSuccess(
                  RequestGlobalSearchSuggestionResult result) {
               
                // add results to local suggest tree
                for (Suggestion sug : result.getResponse().getSuggestions()) {
                  suggestionList.add(new DisplayableItemSuggestion(sug.getDisplayString(),request.getQuery(),false));
                }
                r.setSuggestions(suggestionList);
                callback.onSuggestionsReady(request, r);
              }
            });
       
      }
View Full Code Here

                    s.add(new MultiWordSuggestion("Z", "Z"));
                } else {
                    s.add(new MultiWordSuggestion("M", "M"));
                    s.add(new MultiWordSuggestion("F", "F"));
                }
                callback.onSuccess(new Response(s));
            }

            @Override
            public void fireSuggest(SuggestRequest request,
                    AsyncCallback<Response> callback) {
                Collection<Suggestion> s = new ArrayList<Suggestion>();

                s.add(new MultiWordSuggestion("Lancashire", "Lancashire"));
                s.add(new MultiWordSuggestion("Bedfordshire", "Bedfordshire"));
                s.add(new MultiWordSuggestion("Oxfordshire", "Oxfordshire"));
                callback.onSuccess(new Response(s));
            }
        };
        return config;
    }
View Full Code Here

                JsSuggestion jss = raw.get(i);
                Suggestion s = new MultiWordSuggestion(jss.getValue(), jss.getLabel());
                suggestions.add(s);
            }

            Response response = new Response(suggestions);
            callback.onSuccess(response);
        }
View Full Code Here

                        }
                        NamedModelSuggestion<Activity> suggestion = new NamedModelSuggestion<Activity>(activity,
                                activity.getName(), highlighter.highlight(displayString.toString()));
                        suggestions.add(suggestion);
                    }
                    callback.onSuggestionsReady(request, new Response(suggestions));
                }
            }


            @Override
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.SuggestOracle.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.