Package com.google.collide.dto

Examples of com.google.collide.dto.SearchResult


  private void showResultsImpl(final int page, int pageCount, JsoArray<SearchResult> items) {
    Css css = getView().css;
    buildPager(page, pageCount, css);

    for (int i = 0; i < items.size(); i++) {
      SearchResult item = items.get(i);
      DivElement outer = Elements.createDivElement();
      if (i > 0) {
        outer.setClassName(css.second());
      }
      final PathUtil path = new PathUtil(item.getTitle());
      AnchorElement title = Elements.createAnchorElement(css.title());
      title.setTextContent(item.getTitle());
      if (item.getUrl() != null) {
        // this is unusual, but allows search results to point outside of this
        // workspace, e.g. to language API docs.
        title.setHref(item.getUrl());
      } else {
        // this is the common case; the title will be a path in this workspace
        // and clicking on the link should take us to its editor.
        title.setOnClick(new EventListener() {
          @Override
          public void handleEvent(Event evt) {
            currentPlace.fireChildPlaceNavigation(
                FileSelectedPlace.PLACE.createNavigationEvent(path));
          }
        });
      }
      outer.appendChild(title);
      JsoArray<Snippet> snippets = (JsoArray<Snippet>) item.getSnippets();
      for (int j = 0; j < snippets.size(); j++) {
        DivElement snippetDiv = Elements.createDivElement(css.snippet());
        final int lineNo = snippets.get(j).getLineNumber();
        snippetDiv.setTextContent(lineNo + ": " + snippets.get(j).getSnippetText());
        snippetDiv.setOnClick(new EventListener() {
View Full Code Here

TOP

Related Classes of com.google.collide.dto.SearchResult

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.