Class AdvancedSearch

java.lang.Object
com.levigo.jadice.web.client.search.AdvancedSearch
All Implemented Interfaces:
com.google.gwt.user.client.ui.IsWidget, com.levigo.jadice.web.client.search.internal.GeneralSearch

public class AdvancedSearch extends Object implements com.google.gwt.user.client.ui.IsWidget, com.levigo.jadice.web.client.search.internal.GeneralSearch
This class is responsible for sending the search string to the server and handle the asynchronously received results on the client side. Actions include highlighting the found occurrences, highlighting the currently selected result in a different color compared to the other results or aborting the search if too many results were found.

In contrast to the rollout search this search should be included in a bigger panel. It contains a result panel listing all results containing text before and after the search result. It can also be configured via check boxes whether it should be a case sensitive search or it should be searched for whole words.

The Search can store search results for multiple pageViews. When switching between the the pageViews the search results will be stored and restored accordingly. Switching PageViews can be done manually or when initialized with a context the search will automatically switch its PageView when the PageView in the context is changed.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an AdvancedSearch instance for a given PageView.
    Constructs an AdvancedSearch instance with automatic PageView detection.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.gwt.user.client.ui.Widget
     
    void
     
    void
    onSearchFinish(com.levigo.jadice.web.shared.service.internal.textsearch.TextSearchAnswer result)
     
    void
    onSearchResult(com.levigo.jadice.web.shared.service.internal.textsearch.TextSearchAnswer result, int searchIndex, Document document)
     
    void
    search(String searchString)
     
    int
    Gets the number of results, if any, from the last search on the current PageView.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.levigo.jadice.web.client.search.internal.GeneralSearch

    performSearch
  • Constructor Details

    • AdvancedSearch

      public AdvancedSearch(Context context)
      Constructs an AdvancedSearch instance with automatic PageView detection. This instance will listen for PageView Changes in the context and switch its associated PageView accordingly.
      Parameters:
      context - containing a PageView to search in.
    • AdvancedSearch

      public AdvancedSearch(PageView pageView)
      Constructs an AdvancedSearch instance for a given PageView.
      Parameters:
      pageView - to search in.
  • Method Details

    • search

      public void search(String searchString)
    • searchResultCount

      public int searchResultCount()
      Gets the number of results, if any, from the last search on the current PageView.
      Returns:
      the number of results or if this method is called before the search action was called on this PageView: -1
    • asWidget

      public com.google.gwt.user.client.ui.Widget asWidget()
      Specified by:
      asWidget in interface com.google.gwt.user.client.ui.IsWidget
    • onSearchAbort

      public void onSearchAbort(Throwable caught)
      Specified by:
      onSearchAbort in interface com.levigo.jadice.web.client.search.internal.GeneralSearch
    • onSearchResult

      public void onSearchResult(com.levigo.jadice.web.shared.service.internal.textsearch.TextSearchAnswer result, int searchIndex, Document document)
      Specified by:
      onSearchResult in interface com.levigo.jadice.web.client.search.internal.GeneralSearch
    • onSearchFinish

      public void onSearchFinish(com.levigo.jadice.web.shared.service.internal.textsearch.TextSearchAnswer result)
      Specified by:
      onSearchFinish in interface com.levigo.jadice.web.client.search.internal.GeneralSearch