Package org.sgx.yuigwt.yui.widget.autocomplete

Examples of org.sgx.yuigwt.yui.widget.autocomplete.AutoComplete


          testNames.push(test.getName());
        }

        // an autocomplete and button search box
        final Node byNameInput = parent.appendChild("<input type=\"\"></input>");
        AutoComplete ac = Y
            .newAutoComplete(AutoCompleteConfig.create().resultHighlighter("phraseMatch").resultFilters("phraseMatch").inputNode(byNameInput).source(testNames))
            .render(parent).cast();

        Y.newButton(ButtonConfig.create().label("search").render(parent).on("click", new EventCallback<ButtonEvent>() {
          @Override
View Full Code Here


    }
    getNavContent().append("<span>Filter by name: </span><br/>");
    final Node inputEl = getNavContent().appendChild("<input type=\"text\"></input>");

    inputEl.setStyles(Style.create().width("90%"));
    AutoComplete ac = Y.newAutoComplete(AutoCompleteConfig.create().resultHighlighter("phraseMatch").resultFilters("phraseMatch").inputNode(inputEl).source(allTestNames)
        .render(true));
    ac.after(AutoComplete.EVENT_SELECT, new EventCallback<AutoCompleteEvent>() {
      @Override
      public void call(AutoCompleteEvent e) {
        Test test = util.getTestByName(inputEl.get("value"));
        setCurrentTest(test);
      }
View Full Code Here

 
  //search by name:
  final ByNameSearcher byNameSearcher = new ByNameSearcher(util, "");
  final Node byNameInput = byName.appendChild("<input type=\"text\" value=\"\"></input>");
 
  AutoComplete ac = Y.newAutoComplete(AutoCompleteConfig.create().
    resultHighlighter("phraseMatch").
    inputNode(byNameInput).
    source(byNameSearcher.autocompleteData()).
    render(true)
  );  
  Y.newButton(ButtonConfig.create().label("Search").
    on("click", new EventCallback<ButtonEvent>() {
    @Override
    public void call(ButtonEvent e) {
      String keyword = byNameInput.get("value");
      byNameSearcher.setName(keyword);
      JsArray<Module> results = SearchUtil.search(util.getModules(), byNameSearcher);
      console.log("search by name keyword: "+keyword+", results: "+results.length());
      resultTable.data(results);
      resultTable.render();
    }
  })).render(byName);
 
  //search by tags
  final ByTagsSearcher byTagsSearcher = new ByTagsSearcher(util, "");
  final Node byTagsInput = byTag.appendChild("<input type=\"text\" value=\"\"></input>");
 
  AutoComplete acTags = Y.newAutoComplete(AutoCompleteConfig.create().
    resultHighlighter("phraseMatch").
    inputNode(byTagsInput).
    source(byTagsSearcher.autocompleteData()).
    render(true)
  );  
  Y.newButton(ButtonConfig.create().label("Search").
    on("click", new EventCallback<ButtonEvent>() {
    @Override
    public void call(ButtonEvent e) {
      String keyword = byTagsInput.get("value");
      byTagsSearcher.setTag(keyword);
      JsArray<Module> results = SearchUtil.search(util.getModules(), byTagsSearcher);
      console.log("search by tag keyword: "+keyword+", results: "+results.length());
      resultTable.data(results);
      resultTable.render();
    }
  })).render(byTag);
 
  //search by requires
  final ByRequiresSearcher byRequiresSearcher = new ByRequiresSearcher(util, "");
  final Node byRequiresInput = byRequires.appendChild("<input type=\"text\" value=\"\"></input>");
 
  AutoComplete acRequires = Y.newAutoComplete(AutoCompleteConfig.create().
    resultHighlighter("phraseMatch").
    inputNode(byRequiresInput).
    source(byRequiresSearcher.autocompleteData()).
    render(true)
  );  
View Full Code Here

      public void call(ButtonEvent e) {
        tabView.selectChild(1);
      }
    });
   
    AutoComplete ac1 = binderUtil.getWidget(ac1El).cast();
    ac1.source(new String[]{"ab", "abc", "abcd", "abc dfgh", "abcdfg"});
  }
View Full Code Here

    super(y);
  }

  @Override
  public void yuiBinded() {
    AutoComplete ac1 = getYUIBinder().getWidget(acEl1).cast();
    String[] source = new String[30];
    for (int i = 0; i < 30; i++) {
      source[i]=TestUtil.getInstance().randomLetters(TestUtil.getInstance().randomBetween(5, 12));
    }
    ac1.source(source);
//    ac1.render();
  }
View Full Code Here

  for (int i = 0; i < allModules.length(); i++) {
    YuiGalleryAllModule module = allModules.get(i);
    owners.push(module.owner().username());
  }     
 
  AutoComplete ac = Y.newAutoComplete(AutoCompleteConfig.create().
    resultHighlighter("phraseMatch").resultFilters("phraseMatch").
    inputNode(ownerInput)
    .source(owners)
    .render(true)
  );
  ac.render();
//  console.log("AC: "+owners.length()+" - "+Y.dump(owners.get(0)));
  Y.newButton(ButtonConfig.create().label("describe table!").render(ownerlist).
    on("click", new EventCallback<ButtonEvent>() {       
      @Override
      public void call(ButtonEvent e) {
View Full Code Here

  for (int i = 0; i < tables.length(); i++) {
    TableShow table = tables.get(i);
    tableNames.push(table.content());
  }
  console.log("doTableAutocomplete: "+tables.length()+" - "+tableNames.length());
  AutoComplete ac = Y.newAutoComplete(AutoCompleteConfig.create().
    resultHighlighter("phraseMatch").resultFilters("phraseMatch").
    inputNode(input)
    .source(tableNames)
    .render(true)
  );  
  ac.render();
}
View Full Code Here

    inputEl.plug(Y.Plugin().AutoComplete(), AutoCompleteConfig.create().
      resultHighlighter("phraseMatch").resultFilters("phraseMatch").
      source(new String[]{"ab", "abc", "abcd", "abc dfgh", "abcdfg"}).render(true));
   
    AutoComplete ac = Y.newAutoComplete(AutoCompleteConfig.create().
      resultHighlighter("phraseMatch").resultFilters("phraseMatch").
      inputNode(inputEl).
      source(source1).render(true)
    );    
   
    ac.on(AutoComplete.EVENT_SELECT, new EventCallback<AutoCompleteEvent>() {
      @Override
      public void call(AutoCompleteEvent e) {
        Window.alert("selected "+e.itemNode().get("innerHTML"));
      }
    });
   
    ac.on(AutoComplete.EVENT_RESULTS, new EventCallback<AutoCompleteEvent>() {
      @Override
      public void call(AutoCompleteEvent e) {       
        Window.alert("results: "+e.results().length());
      }
    });
View Full Code Here

TOP

Related Classes of org.sgx.yuigwt.yui.widget.autocomplete.AutoComplete

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.