Java Code Examples for com.google.gwt.user.client.ui.MultiWordSuggestOracle

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.MultiWordSuggestOracle. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Wiab.pro   File: EditorHarness.java   Source Code and License 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
Project: caja   File: PlaygroundView.java   Source Code and License 6 votes vote down vote up
public PlaygroundView(Playground controller) {
  this.controller = controller;
  this.sourceExamples = new MultiWordSuggestOracle();
  this.policyExamples = new MultiWordSuggestOracle();

  this.playgroundUI =
    new com.google.caja.demos.playground.client.ui.PlaygroundUI(
        sourceExamples, policyExamples);
  RootLayoutPanel.get().add(playgroundUI);
  initSourcePanel();
  initPolicyPanel();
  initFeedbackPanel();
  initExamples();
  initEditor();
  initCaja(true);
  initPlusOne();
  initUnsafe();
}
 
Example 3
Project: google-apis-explorer   File: EnumEditor.java   Source Code and License 6 votes vote down vote up
EnumEditorViewImpl(final List<String> enumValues, final List<String> enumDescriptions) {
  // Sets up a SuggestOracle that, when the textbox has focus, displays the
  // valid enum values and their descriptions.
  MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
  List<Suggestion> suggestions = Lists.newArrayList();
  for (int i = 0; i < enumValues.size(); i++) {
    suggestions.add(new EnumSuggestion(
        enumValues.get(i), enumDescriptions == null ? "" : enumDescriptions.get(i)));
  }
  oracle.setDefaultSuggestions(suggestions);
  this.suggestBox = new SuggestBox(oracle);
  suggestBox.getTextBox().addFocusHandler(new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      suggestBox.showSuggestionList();
    }
  });
  add(suggestBox);

  this.errorMessage = new Label("This parameter is invalid.");
  errorMessage.setVisible(false);
  add(errorMessage);
}
 
Example 4
Project: incubator-wave   File: EditorHarness.java   Source Code and License 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 5
Project: Peergos   File: CwSuggestBox.java   Source Code and License 6 votes vote down vote up
/**
 * Initialize this example.
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
  // Define the oracle that finds suggestions
  MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
  String[] words = constants.cwSuggestBoxWords();
  for (int i = 0; i < words.length; ++i) {
    oracle.add(words[i]);
  }

  // Create the suggest box
  final SuggestBox suggestBox = new SuggestBox(oracle);
  suggestBox.ensureDebugId("cwSuggestBox");
  VerticalPanel suggestPanel = new VerticalPanel();
  suggestPanel.add(new HTML(constants.cwSuggestBoxLabel()));
  suggestPanel.add(suggestBox);

  // Return the panel
  return suggestPanel;
}
 
Example 6
Project: swarm   File: CwSuggestBox.java   Source Code and License 6 votes vote down vote up
/**
 * Initialize this example.
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
  // Define the oracle that finds suggestions
  MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
  String[] words = constants.cwSuggestBoxWords();
  for (int i = 0; i < words.length; ++i) {
    oracle.add(words[i]);
  }

  // Create the suggest box
  final SuggestBox suggestBox = new SuggestBox(oracle);
  suggestBox.ensureDebugId("cwSuggestBox");
  VerticalPanel suggestPanel = new VerticalPanel();
  suggestPanel.add(new HTML(constants.cwSuggestBoxLabel()));
  suggestPanel.add(suggestBox);

  // Return the panel
  return suggestPanel;
}
 
Example 7
Project: ephesoft   File: TableExtractionView.java   Source Code and License 5 votes vote down vote up
private MultiWordSuggestOracle setMultiWordOracle(final String value, final List<String> alternateValues) {
	MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
	String actualvalue = null == value ? "" : value;
	oracle.add(actualvalue);
	for (String altValue : alternateValues) {
		oracle.add(altValue);
	}
	return oracle;
}
 
Example 8
Project: 285_02_FA15G4   File: SearchWidget.java   Source Code and License 5 votes vote down vote up
public SearchWidget(MainWidget master) {
	this.master = master;
	panel = new VerticalPanel();
	searchbar = new HorizontalPanel();
	searchbar.setHeight("100px");
	scrollable = new ScrollPanel();
	scrollable.setHeight("400px");
	oracle = new MultiWordSuggestOracle();
	box = new SuggestBox(oracle);
	b = new Button("Search");
	box.setWidth("200px");
	lbl = new Label("Enter Search Criteria");
	
	BuildUI();
}
 
Example 9
Project: caja   File: PlaygroundUI.java   Source Code and License 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 10
Project: gwtutil   File: TypeaheadWrapper.java   Source Code and License 5 votes vote down vote up
public void fill(Collection<T> data) {
    MultiWordSuggestOracle suggestOracle = (MultiWordSuggestOracle) decorated.getSuggestOracle();
    suggestOracle.clear();
    objects.clear();
    for (T elem : data) {
        String title = elem.getListboxValue();
        suggestOracle.add(title);
        objects.put(title, elem);
    }
}
 
Example 11
Project: gwtutil   File: TypeaheadBox.java   Source Code and License 4 votes vote down vote up
public MultiWordSuggestOracle getSuggestOracle() {
    return (MultiWordSuggestOracle) typeahead.getSuggestOracle();
}
 
Example 12
Project: dtgov   File: WorkflowQueryPropertiesTable.java   Source Code and License 4 votes vote down vote up
/**
 * Constructor.
 */
public WorkflowQueryPropertiesTable() {
    keyDefaultValues = new MultiWordSuggestOracle();
    properties = new ArrayList<WorkflowQueryProperty>();
}
 
Example 13
Project: gwtbootstrap3   File: SuggestBox.java   Source Code and License 2 votes vote down vote up
/**
 * Constructor for {@link SuggestBox}. Creates a {@link MultiWordSuggestOracle} and {@link TextBox} to use
 * with this {@link SuggestBox}.
 */
public SuggestBox() {
    this(new MultiWordSuggestOracle());
}
 
Example 14
Project: dtgov   File: WorkflowQueryPropertiesTable.java   Source Code and License 2 votes vote down vote up
/**
 * Gets the key default values.
 * 
 * @return the key default values
 */
public MultiWordSuggestOracle getKeyDefaultValues() {
    return keyDefaultValues;
}
 
Example 15
Project: dtgov   File: WorkflowQueryPropertiesTable.java   Source Code and License 2 votes vote down vote up
/**
 * Sets the key default values.
 * 
 * @param keyDefaultValues
 *            the new key default values
 */
public void setKeyDefaultValues(MultiWordSuggestOracle keyDefaultValues) {
    this.keyDefaultValues = keyDefaultValues;
}