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); } } }
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(); }
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); }
/** * 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; }
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; }
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(); }
public PlaygroundUI(MultiWordSuggestOracle sourceSuggestions, MultiWordSuggestOracle policySuggestions) { addressField = new SuggestBox(sourceSuggestions); policyAddressField = new SuggestBox(policySuggestions); initWidget(UI_BINDER.createAndBindUi(this)); }
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); } }
public MultiWordSuggestOracle getSuggestOracle() { return (MultiWordSuggestOracle) typeahead.getSuggestOracle(); }
/** * Constructor. */ public WorkflowQueryPropertiesTable() { keyDefaultValues = new MultiWordSuggestOracle(); properties = new ArrayList<WorkflowQueryProperty>(); }
/** * Constructor for {@link SuggestBox}. Creates a {@link MultiWordSuggestOracle} and {@link TextBox} to use * with this {@link SuggestBox}. */ public SuggestBox() { this(new MultiWordSuggestOracle()); }
/** * Gets the key default values. * * @return the key default values */ public MultiWordSuggestOracle getKeyDefaultValues() { return keyDefaultValues; }
/** * Sets the key default values. * * @param keyDefaultValues * the new key default values */ public void setKeyDefaultValues(MultiWordSuggestOracle keyDefaultValues) { this.keyDefaultValues = keyDefaultValues; }