java.lang.Object
com.xavierloeraflores.inventorymanagement.MainFormController
All Implemented Interfaces:
javafx.fxml.Initializable

public class MainFormController extends Object implements javafx.fxml.Initializable
Controller class for the Main.fmxl form. Implements Initializable
Author:
xavierloeraflores
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private javafx.scene.control.TableColumn<Part,Integer>
    The [columnPartId] which displays Inventory Parts' Id.
    private javafx.scene.control.TableColumn<Part,String>
    The [columnPartName] which displays Inventory Parts' Name.
    private javafx.scene.control.TableColumn<Part,Double>
    The [columnPartPrice] which displays Inventory Parts' Price.
    private javafx.scene.control.TableColumn<Part,Integer>
    The [columnPartStock] which displays Inventory Parts' Stock.
    private javafx.scene.control.TableColumn<Part,Integer>
    The [columnProductId] which displays Inventory Products' Id.
    private javafx.scene.control.TableColumn<Part,String>
    The [columnProductName] which displays Inventory Products' Name.
    private javafx.scene.control.TableColumn<Part,Double>
    The [columnProductPrice] which displays Inventory Products' Price.
    private javafx.scene.control.TableColumn<Part,Integer>
    The [columnProductStock] which displays Inventory Products' Stock.
    private javafx.scene.control.TextField
    The [fieldSearchPart] takes in input from the user for searching for parts.
    private javafx.scene.control.TextField
    The [fieldSearchProduct] takes in input from the user for searching for products.
    private static Part
    The [selectedPart] which will be modified by the user.
    private static Product
    The [selectedProduct] which will be modified by the user.
    private javafx.scene.control.TableView<Part>
    The [tablePart] which displays Inventory Parts.
    private javafx.scene.control.TableView<Product>
    The [columnProductId] which displays Inventory Products' Id.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addPart(javafx.event.ActionEvent actionEvent)
    Sends the user back to the add Part screen.
    void
    addProduct(javafx.event.ActionEvent actionEvent)
    Sends the user back to the add Product screen.
    private void
    deletePart(javafx.event.ActionEvent actionEvent)
    Handles the delete Part functionality when a user presses the delete button.
    private void
    deleteProduct(javafx.event.ActionEvent actionEvent)
    Handles the delete Product functionality when a user presses the delete button.
    private void
    exit(javafx.event.ActionEvent actionEvent)
    Exits the program when the user presses the exit button.
    static Part
    Returns the selectedPart, so it can be accessed on the modification screen.
    static Product
    Returns the selectedProduct, so it can be accessed on the modification screen.
    private void
    handleSearchPart(javafx.event.ActionEvent actionEvent)
    Handles the search part functionality when the user enters a search query.
    private void
    handleSearchProduct(javafx.event.ActionEvent actionEvent)
    Handles the search part functionality when the user enters a search query.
    void
    initialize(URL url, ResourceBundle resourceBundle)
    Initializes the FXML Screen and sets the selectedPart and selectedProduct to null.
    void
    Handles setting up all the tables and populates them with the data.
    void
    modifyPart(javafx.event.ActionEvent actionEvent)
    Sends the user back to the modifyPart screen.
    void
    modifyProduct(javafx.event.ActionEvent actionEvent)
    Sends the user back to the modifyProduct screen.
    void
    openPage(javafx.event.ActionEvent actionEvent, String form)
    Utility function that is used to switch between pages

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • tablePart

      private javafx.scene.control.TableView<Part> tablePart
      The [tablePart] which displays Inventory Parts.
    • columnPartId

      private javafx.scene.control.TableColumn<Part,Integer> columnPartId
      The [columnPartId] which displays Inventory Parts' Id.
    • columnPartName

      private javafx.scene.control.TableColumn<Part,String> columnPartName
      The [columnPartName] which displays Inventory Parts' Name.
    • columnPartStock

      private javafx.scene.control.TableColumn<Part,Integer> columnPartStock
      The [columnPartStock] which displays Inventory Parts' Stock.
    • columnPartPrice

      private javafx.scene.control.TableColumn<Part,Double> columnPartPrice
      The [columnPartPrice] which displays Inventory Parts' Price.
    • fieldSearchPart

      private javafx.scene.control.TextField fieldSearchPart
      The [fieldSearchPart] takes in input from the user for searching for parts.
    • tableProduct

      private javafx.scene.control.TableView<Product> tableProduct
      The [columnProductId] which displays Inventory Products' Id.
    • columnProductId

      private javafx.scene.control.TableColumn<Part,Integer> columnProductId
      The [columnProductId] which displays Inventory Products' Id.
    • columnProductName

      private javafx.scene.control.TableColumn<Part,String> columnProductName
      The [columnProductName] which displays Inventory Products' Name.
    • columnProductStock

      private javafx.scene.control.TableColumn<Part,Integer> columnProductStock
      The [columnProductStock] which displays Inventory Products' Stock.
    • columnProductPrice

      private javafx.scene.control.TableColumn<Part,Double> columnProductPrice
      The [columnProductPrice] which displays Inventory Products' Price.
    • fieldSearchProduct

      private javafx.scene.control.TextField fieldSearchProduct
      The [fieldSearchProduct] takes in input from the user for searching for products.
    • selectedPart

      private static Part selectedPart
      The [selectedPart] which will be modified by the user.
    • selectedProduct

      private static Product selectedProduct
      The [selectedProduct] which will be modified by the user.
  • Constructor Details

    • MainFormController

      public MainFormController()
  • Method Details

    • getSelectedPart

      public static Part getSelectedPart()
      Returns the selectedPart, so it can be accessed on the modification screen.
      Returns:
      [Product] the selectedPart to be modified
    • getSelectedProduct

      public static Product getSelectedProduct()
      Returns the selectedProduct, so it can be accessed on the modification screen.
      Returns:
      [Product] the selectedProduct to be modified
    • deletePart

      private void deletePart(javafx.event.ActionEvent actionEvent)
      Handles the delete Part functionality when a user presses the delete button. It will delete the part if the user confirms deletion
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException - FUTURE ENHANCEMENT : Automatically remove references to this part from all Product associated parts
    • deleteProduct

      private void deleteProduct(javafx.event.ActionEvent actionEvent)
      Handles the delete Product functionality when a user presses the delete button. It will delete the product if the user confirms deletion
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • exit

      private void exit(javafx.event.ActionEvent actionEvent)
      Exits the program when the user presses the exit button. Will exit upon confirmation for exiting.
      Parameters:
      actionEvent - JavaFX action event
    • openPage

      public void openPage(javafx.event.ActionEvent actionEvent, String form) throws IOException
      Utility function that is used to switch between pages
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • addPart

      public void addPart(javafx.event.ActionEvent actionEvent) throws IOException
      Sends the user back to the add Part screen.
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • modifyPart

      public void modifyPart(javafx.event.ActionEvent actionEvent) throws IOException
      Sends the user back to the modifyPart screen. This function also sets the selectedPart.
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • handleSearchPart

      private void handleSearchPart(javafx.event.ActionEvent actionEvent) throws IOException
      Handles the search part functionality when the user enters a search query. It will populate the table with the search results or bring up a dialog box if no searches found
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • handleSearchProduct

      private void handleSearchProduct(javafx.event.ActionEvent actionEvent) throws IOException
      Handles the search part functionality when the user enters a search query. It will populate the table with the search results or bring up a dialog box if no searches found
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • addProduct

      public void addProduct(javafx.event.ActionEvent actionEvent) throws IOException
      Sends the user back to the add Product screen.
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • modifyProduct

      public void modifyProduct(javafx.event.ActionEvent actionEvent) throws IOException
      Sends the user back to the modifyProduct screen. This function also sets the selectedProduct.
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • mapTables

      public void mapTables()
      Handles setting up all the tables and populates them with the data. This function also maps all the columns with properties from the Part and Product class.
    • initialize

      public void initialize(URL url, ResourceBundle resourceBundle)
      Initializes the FXML Screen and sets the selectedPart and selectedProduct to null.
      Specified by:
      initialize in interface javafx.fxml.Initializable
      Parameters:
      url - parameter for the FXML Screen
      resourceBundle - parameter for the FXML Screen