Class Search

java.lang.Object
NTNU.IDATT1002.controllers.NavBarController
NTNU.IDATT1002.controllers.Search
All Implemented Interfaces:
javafx.fxml.Initializable

public class Search
extends NavBarController
implements javafx.fxml.Initializable
Controls the buttons and changeable elements on search.fxml, a page where you can search for images
Version:
1.0 22.03.2020
  • Field Details

  • Constructor Details

    • Search

      public Search()
      Tell DataExchange that search page was visited. Display search word.
  • Method Details

    • initialize

      public void initialize​(java.net.URL location, java.util.ResourceBundle resources)
      Generates content based on the search word. Searches both images and albums. When the tasks is done the content is displayed as well as the number of each result type.
      Specified by:
      initialize in interface javafx.fxml.Initializable
      Parameters:
      location -
      resources -
    • addTabListeners

      public void addTabListeners()
      Method that updates next and previous buttons disable-properties based on the active tab. If albums tab is active and it is not possible to go to next page due to too few search results, the button is disabled.
    • computeRootImagesContainerChildren

      public javafx.scene.layout.VBox computeRootImagesContainerChildren​(javafx.collections.ObservableList<Image> listOfImages, int start, int end)
      Create a VBox of image HBox children to add to a root container.
      Parameters:
      listOfImages - the images to add
      start - min index of image list to be added
      end - max index of images list to be added
      Returns:
      the VBox containing image containers
    • computeRootAlbumsContainerChildren

      public javafx.scene.layout.VBox computeRootAlbumsContainerChildren​(javafx.collections.ObservableList<Album> listOfAlbums, int start, int end)
      Create a VBox of album HBox children to add to a root container. Load each corresponding preview images in a separate background task and add them when ready.
      Parameters:
      listOfAlbums - the albums to add
      start - min index of albums list to be added
      end - max index of albums list to be added
      Returns:
      the VBox containing album containers
    • switchToPrevious

      public void switchToPrevious​(javafx.event.ActionEvent actionEvent) throws java.io.IOException
      It finds out witch is current selected tab and if it is possible to load previous content on that page. If yes it updates content to previous elements of the list.
      Parameters:
      actionEvent -
      Throws:
      java.io.IOException
    • switchToNext

      public void switchToNext​(javafx.event.ActionEvent actionEvent) throws java.io.IOException
      It finds out witch is current selected tab and if it is possible to load next content on that page. If yes it updates content to next elements of the list.
      Parameters:
      actionEvent -
      Throws:
      java.io.IOException
    • switchToViewImage

      public void switchToViewImage​(javafx.scene.input.MouseEvent mouseEvent) throws java.io.IOException
      Changes to view image page. It takes a clicked element within an image container and finds the fx:id of the main parent, and passes the value to DataExchange.
      Parameters:
      mouseEvent -
      Throws:
      java.io.IOException
    • switchToViewAlbum

      public void switchToViewAlbum​(javafx.scene.input.MouseEvent mouseEvent) throws java.io.IOException
      Changes to view album page. It takes a clicked element within an album container and finds the fx:id of the main parent, and passes the value to DataExchange.
      Parameters:
      mouseEvent -
      Throws:
      java.io.IOException
    • findId

      public long findId​(javafx.scene.input.MouseEvent mouseEvent)
      It takes a clicked element within an container and finds the fx:id of the main parent
      Parameters:
      mouseEvent -
      Returns:
      main containers id of clicked element