Class SearchedItemContainer

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class SearchedItemContainer extends ScrollPane
The SearchedItemContainer class represents a UI component that contains and displays the search results as a list of SearchedItemPanel instances. It is a scrollable container that allows users to view all search results, and it provides methods to add new search result panels to the container.
  • Field Details

    • itemContainer

      private final VBox itemContainer
      The container for all searched item panels
    • interactors

      private final List<SearchedItemPanelInteractor> interactors
      List of interactors to handle interactions with the item panels in the search results.
  • Constructor Details

    • SearchedItemContainer

      private SearchedItemContainer()
      Creates a SearchedItemContainer with a vertical box layout for displaying search result panels.
  • Method Details

    • create

      public static SearchedItemContainer create(List<Item> items)
      Factory method to create a SearchedItemContainer with the given list of items.
      Parameters:
      items - The list of items to display in the container.
      Returns:
      A new instance of SearchedItemContainer populated with the given items.
    • addItemPanel

      private void addItemPanel(SearchedItemPanel itemPanel)
      Adds a new SearchedItemPanel to the container.
      Parameters:
      itemPanel - The SearchedItemPanel to add.
      Preconditions:
      itemPanel is not null and is properly initialized with the data to display for a search result.
      Postconditions:
      If itemPanel is not null, it is added to the itemContainer and becomes visible in the UI.
    • addSearchedItemPanelInteractor

      public void addSearchedItemPanelInteractor(SearchedItemPanelInteractor interactor)
      Adds a SearchedItemPanelInteractor to the SearchedItemContainer to allow for interaction with the item panels in the search results.
      Parameters:
      interactor - The SearchedItemPanelInteractor to add to the SearchedItemContainer for handling interactions with the item panels in the search results.
      Preconditions:
      interactor should be properly implemented to handle interactions with the item panels, and the SearchedItemContainer should be properly initialized to allow for adding interactors.
      Postconditions:
      The provided interactor is added to the SearchedItemContainer, allowing it to receive interaction events from the item panels in the search results.
    • updateItems

      public final void updateItems(List<Item> items)
      Updates the items displayed in the container with a new list of items.
      Parameters:
      items - The new list of Item objects to display in the container.
      Preconditions:
      items should be a valid list of Item objects to display in the container. The SearchedItemContainer should be properly initialized to allow for updating the displayed items.
      Postconditions:
      The itemContainer is cleared and repopulated with new SearchedItemPanel instances corresponding to the provided list of items. If the list is null or empty, a message indicating that no items were found is displayed instead.
    • stopAllImagesLoading

      public void stopAllImagesLoading()
      Stops all image loading tasks from running
      Postconditions:
      All asynchronous image loading tasks for the SearchedItemPanel instances currently displayed in the container are stopped, preventing any further loading of images that are not being displayed.