Class SearchProvider

java.lang.Object
net.lenni0451.imnbt.ui.SearchProvider

public class SearchProvider extends Object
A provider to search for tag names and content.
  • Constructor Details

    • SearchProvider

      public SearchProvider(ImNbtDrawer drawer)
  • Method Details

    • setSearch

      public void setSearch(String search)
      Set the current search string.
      This does not refresh the search, use refreshSearch() for that.
      Parameters:
      search - The search string
    • refreshSearch

      public void refreshSearch()
      Refresh the search with the last used tag.
    • buildSearchPaths

      public void buildSearchPaths(@Nullable net.lenni0451.mcstructs.nbt.INbtTag tag)
      Refresh the search with the given tag.
      Parameters:
      tag - The tag to search in
    • isSearched

      public boolean isSearched(String path)
      Check if the given path is searched.
      Parameters:
      path - The path to check
      Returns:
      If the path is searched
    • isTargeted

      public boolean isTargeted(String path)
      Check if the given path is targeted.
      The targeted path is the path which should be scrolled to.
      Parameters:
      path - The path to check
      Returns:
      If the path is targeted
    • isExpanded

      public boolean isExpanded(String path)
      Check if the given path is expanded.
      Parameters:
      path - The path to check
      Returns:
      If the path is expanded
    • setDoScroll

      public void setDoScroll(SearchProvider.SearchDirection direction)
      Set the scroll position to the next or previous searched path.
      Parameters:
      direction - The direction to scroll
    • shouldDoScroll

      public boolean shouldDoScroll(String path)
      Check if the given path should be scrolled to.
      Parameters:
      path - The path to check
      Returns:
      If the path should be scrolled to
    • getOpenedPage

      public int getOpenedPage(String path)
      Get the page which is required to show the scroll path.
      Parameters:
      path - The path to check
      Returns:
      The page