com.google.gwt.user.client.ui.SuggestBox Java Examples

The following examples show how to use com.google.gwt.user.client.ui.SuggestBox. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EditorHarness.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
void initContentOracle() {
  contentOracle = new MultiWordSuggestOracle();

  contentSuggestBox = new SuggestBox(contentOracle);
  contentSuggestBox.getElement().setId("content-box");

  // Some initial content xml strings
  contentOracle.add("");
  contentOracle.add("abcd");

  contentSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
    @Override public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
      setFromContentBox();
    }
  });

  String[] extra = extendSampleContent();
  if (extra != null) {
    for (String content : extra) {
      contentOracle.add(content);
    }
  }
}
 
Example #2
Source File: EditorHarness.java    From swellrt with Apache License 2.0 6 votes vote down vote up
void initContentOracle() {
  contentOracle = new MultiWordSuggestOracle();

  contentSuggestBox = new SuggestBox(contentOracle);
  contentSuggestBox.getElement().setId("content-box");

  // Some initial content xml strings
  contentOracle.add("");
  contentOracle.add("abcd");

  contentSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
    @Override public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
      setFromContentBox();
    }
  });

  String[] extra = extendSampleContent();
  if (extra != null) {
    for (String content : extra) {
      contentOracle.add(content);
    }
  }
}
 
Example #3
Source File: MaterialAutocompleteTest.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
@Override
public void testTabIndex() {
    // UiBinder
    // given
    MaterialAutoComplete autoComplete = getWidget(false);
    SuggestBox widget = autoComplete.getSuggestBox();

    // when / then
    checkTabIndex(widget);

    // Standard
    // given
    attachWidget();

    // when / then
    checkTabIndex(widget);
}
 
Example #4
Source File: RBACContextView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Widget asWidget() {
    VerticalPanel container = new VerticalPanel();
    container.setStyleName("fill-layout");

    HorizontalPanel menu = new HorizontalPanel();
    menu.setStyleName("fill-layout-width");
    final TextBox nameBox = new TextBox();
    nameBox.setText(securityFramework.resolveToken());

    MultiWordSuggestOracle oracle = new  MultiWordSuggestOracle();
    oracle.addAll(Console.MODULES.getRequiredResourcesRegistry().getTokens());

    SuggestBox suggestBox = new SuggestBox(oracle, nameBox);

    Button btn = new Button("Show", new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            container.clear();

            try {
                container.add(createContent(nameBox.getText()));
            } catch (Throwable e) {
                HTML msg = new HTML(e.getMessage());
                msg.getElement().getStyle().setColor("red");
                container.add(msg);
            }
        }
    });
    menu.add(new HTML("Token: "));
    menu.add(suggestBox);
    menu.add(btn);


    VerticalPanel p = new VerticalPanel();
    p.setStyleName("fill-layout-width");
    p.add(menu);
    p.add(container);
    return p;
}
 
Example #5
Source File: StringMaxLengthValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public StringMaxLengthValidator(SuggestBox suggest, int min, int max, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new IllegalArgumentException("suggest must not be null");
	this.suggest = suggest;
	setMax(max);
	this.setCustomMsgKey(customMsgKey);
}
 
Example #6
Source File: StringMaxLengthValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public StringMaxLengthValidator(SuggestBox suggest, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new IllegalArgumentException("suggest must not be null");
	this.suggest = suggest;
	this.setCustomMsgKey(customMsgKey);
}
 
Example #7
Source File: IntegerMinValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public IntegerMinValidator(SuggestBox suggest, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new RuntimeException("suggest must not be null");
	this.suggest = suggest;
	this.setCustomMsgKey(customMsgKey);
}
 
Example #8
Source File: IntegerMaxValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public IntegerMaxValidator(SuggestBox suggest, int min, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new RuntimeException("suggest must not be null");
	this.suggest = suggest;
	this.max = min;
	this.setCustomMsgKey(customMsgKey);
}
 
Example #9
Source File: IntegerMaxValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public IntegerMaxValidator(SuggestBox suggest, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new RuntimeException("suggest must not be null");
	this.suggest = suggest;
	this.setCustomMsgKey(customMsgKey);
}
 
Example #10
Source File: IntegerMinValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public IntegerMinValidator(SuggestBox suggest, int min, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new RuntimeException("suggest must not be null");
	this.suggest = suggest;
	this.min = min;
	this.setCustomMsgKey(customMsgKey);
}
 
Example #11
Source File: StringLtValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public StringLtValidator(SuggestBox suggest, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new IllegalArgumentException("suggest must not be null");
	this.suggest = suggest;
	this.setCustomMsgKey(customMsgKey);
}
 
Example #12
Source File: MaterialAutocompleteTest.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
protected void checkTabIndex(SuggestBox widget) {
    final int INITIAL_TAB_INDEX = 0;
    final int FINAL_TAB_INDEX = 1;

    // when / then
    widget.setTabIndex(INITIAL_TAB_INDEX);
    assertEquals(INITIAL_TAB_INDEX, widget.getTabIndex());
    assertEquals(String.valueOf(INITIAL_TAB_INDEX), widget.getElement().getPropertyString("tabIndex"));
    widget.setTabIndex(FINAL_TAB_INDEX);
    assertEquals(FINAL_TAB_INDEX, widget.getTabIndex());
    assertEquals(String.valueOf(FINAL_TAB_INDEX), widget.getElement().getPropertyString("tabIndex"));
}
 
Example #13
Source File: PlaygroundUI.java    From caja with Apache License 2.0 5 votes vote down vote up
public PlaygroundUI(MultiWordSuggestOracle sourceSuggestions,
    MultiWordSuggestOracle policySuggestions) {
  addressField = new SuggestBox(sourceSuggestions);
  policyAddressField = new SuggestBox(policySuggestions);

  initWidget(UI_BINDER.createAndBindUi(this));
}
 
Example #14
Source File: StringGtValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public StringGtValidator(SuggestBox suggest, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new IllegalArgumentException("suggest must not be null");
	this.suggest = suggest;
	this.setCustomMsgKey(customMsgKey);
}
 
Example #15
Source File: StringMinLengthValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public StringMinLengthValidator(SuggestBox suggest, boolean preventsPropagationOfValidationChain, String customMsgKey) {
	super();
	this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
	if (suggest == null)
		throw new IllegalArgumentException("suggest must not be null");
	this.suggest = suggest;
	this.setCustomMsgKey(customMsgKey);
}
 
Example #16
Source File: DecimalValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public DecimalValidator(SuggestBox suggest) {
	this.suggestBox = suggest;
}
 
Example #17
Source File: RegularExpressionValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public RegularExpressionValidator(SuggestBox suggest, String regexPattern) {
	this.suggestBox = suggest;
	this.regexPattern = regexPattern;
}
 
Example #18
Source File: IntegerMinValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public IntegerMinValidator(SuggestBox suggest, int min, boolean preventsPropagationOfValidationChain) {
	this(suggest, min, preventsPropagationOfValidationChain, null);
}
 
Example #19
Source File: IntegerMinValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public IntegerMinValidator(SuggestBox suggest, boolean preventsPropagationOfValidationChain) {
	this(suggest, preventsPropagationOfValidationChain, null);
}
 
Example #20
Source File: IntegerMinValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public IntegerMinValidator(SuggestBox suggest, int min) {
	this(suggest, min, false);
}
 
Example #21
Source File: IntegerMinValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public IntegerMinValidator(SuggestBox suggest, String customMsgKey) {
	this(suggest, false);
	this.setCustomMsgKey(customMsgKey);
}
 
Example #22
Source File: IntegerMinValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public IntegerMinValidator(SuggestBox suggest) {
	this(suggest, null);
}
 
Example #23
Source File: StringMaxLengthValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public StringMaxLengthValidator(SuggestBox suggest, boolean preventsPropagationOfValidationChain) {
	this(suggest, preventsPropagationOfValidationChain, null);
}
 
Example #24
Source File: NumericValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public NumericValidator(SuggestBox suggest) {
	this.suggestBox = suggest;
}
 
Example #25
Source File: StringMaxLengthValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public StringMaxLengthValidator(SuggestBox suggest, int min, int max, boolean preventsPropagationOfValidationChain) {
	this(suggest, min, max, preventsPropagationOfValidationChain, null);
}
 
Example #26
Source File: StringMinLengthValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public StringMinLengthValidator(SuggestBox suggest) {
	this(suggest, false);
}
 
Example #27
Source File: StringMaxLengthValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public StringMaxLengthValidator(SuggestBox suggest) {
	this(suggest, false);
}
 
Example #28
Source File: AlphaNumericValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public AlphaNumericValidator(SuggestBox suggest) {
	this.suggestBox = suggest;
}
 
Example #29
Source File: URLValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public URLValidator(SuggestBox suggest) {
	this.suggestBox = suggest;
	this.setCustomMsgKey(null);
}
 
Example #30
Source File: IntegerMaxValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public IntegerMaxValidator(SuggestBox suggest, int min, boolean preventsPropagationOfValidationChain) {
	this(suggest, min, preventsPropagationOfValidationChain, null);
}