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

Examples of com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay


  private final SuggestBox suggestBox;

  private boolean submitOnSelection;

  public GroupReferenceBox() {
    suggestions = new DefaultSuggestionDisplay();
    textBox = new NpTextBox();
    oracle = new AccountGroupSuggestOracle();
    suggestBox = new SuggestBox( //
        new RPCSuggestOracle(oracle), //
        textBox, //
View Full Code Here


   *   tty-GenericLabelRemoveLabelImage
   * @param text the textual representation for this label.
   * @param isAddWidget true if this is a "new label..." widget, false if not.
   */
  public LabelWidget(String text, final boolean isAddWidget) {
    DefaultSuggestionDisplay suggestionDisplay =
      (DefaultSuggestionDisplay) inputBox.getSuggestionDisplay();
    suggestionDisplay.setPopupStyleName("tty-SuggestBoxPopup");
    contentPanel.addStyleName("tty-RemovableLabel");

    if (isAddWidget) {
      // Craft a little plus image.
      image.setStyleName("tty-RemovableLabelAddImage");
View Full Code Here

*/
public class DefaultSuggestionDisplayTest extends SuggestionDisplayTestBase {

  public void testAccessors() {
    SuggestBox box = createSuggestBox();
    DefaultSuggestionDisplay display = (DefaultSuggestionDisplay) box.getSuggestionDisplay();
    PopupPanel popup = display.getPopupPanel();

    // isAnimationEnabled.
    assertFalse(display.isAnimationEnabled());
    assertFalse(popup.isAnimationEnabled());
    display.setAnimationEnabled(true);
    assertTrue(display.isAnimationEnabled());
    assertTrue(popup.isAnimationEnabled());

    // isSuggestListShowing.
    List<Suggestion> suggestions = createSuggestions("test0", "test1", "test2");
    assertFalse(display.isSuggestionListShowing());
    assertFalse(popup.isShowing());
    display.showSuggestions(box, suggestions, false, false, NULL_CALLBACK);
    assertTrue(display.isSuggestionListShowing());
    assertTrue(popup.isShowing());
    display.hideSuggestions();
    assertFalse(display.isSuggestionListShowing());
    assertFalse(popup.isShowing());
  }
View Full Code Here

    assertFalse(popup.isShowing());
  }

  public void testGetCurrentSelectionWhenHidden() {
    SuggestBox box = createSuggestBox();
    DefaultSuggestionDisplay display = (DefaultSuggestionDisplay) box.getSuggestionDisplay();

    // Show the suggestions and select the first item.
    List<Suggestion> suggestions = createSuggestions("test0", "test1", "test2");
    display.showSuggestions(box, suggestions, false, true, NULL_CALLBACK);
    assertTrue(display.isSuggestionListShowing());
    assertEquals(suggestions.get(0), display.getCurrentSelection());

    // Hide the list and ensure that nothing is selected.
    display.hideSuggestions();
    assertNull(display.getCurrentSelection());
  }
View Full Code Here

    assertNull(display.getCurrentSelection());
  }

  public void testShowSuggestionsEmpty() {
    SuggestBox box = createSuggestBox();
    DefaultSuggestionDisplay display = (DefaultSuggestionDisplay) box.getSuggestionDisplay();

    // Show null suggestions.
    display.showSuggestions(box, null, false, true, NULL_CALLBACK);
    assertFalse(display.isSuggestionListShowing());

    // Show empty suggestions.
    List<Suggestion> suggestions = createSuggestions();
    display.showSuggestions(box, suggestions, false, true, NULL_CALLBACK);
    assertFalse(display.isSuggestionListShowing());
  }
View Full Code Here

    assertFalse(display.isSuggestionListShowing());
  }

  @Override
  protected DefaultSuggestionDisplay createSuggestionDisplay() {
    return new DefaultSuggestionDisplay();
  }
View Full Code Here

      // factory, so we're left with this type safety check and broken functionality if GWT changes.
      Preconditions.checkState(suggestionDisplay instanceof DefaultSuggestionDisplay);

      // At this point this should always be true.
      if (suggestionDisplay instanceof DefaultSuggestionDisplay) {
        DefaultSuggestionDisplay suggestions = (DefaultSuggestionDisplay) suggestionDisplay;
        if (!suggestions.isSuggestionListShowing()) {
          presenter.handleSearch(searchBox.getValue());
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay

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.