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

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

    Fields
    Modifier and Type
    Field
    Description
    private javafx.scene.control.TableColumn<Part,Integer>
    The [columnAssociatedId] which displays Associated Parts' Id.
    private javafx.scene.control.TableColumn<Part,String>
    The [columnAssociatedName] which displays Associated Parts' Name.
    private javafx.scene.control.TableColumn<Part,Double>
    The [columnAssociatedPrice] which displays Associated Parts' Price.
    private javafx.scene.control.TableColumn<Part,Integer>
    The [columnAssociatedStock] which displays Associated Parts' Stock.
    private javafx.scene.control.TableColumn<Part,Integer>
    The [columnInventoryId] which displays Inventory Parts' Id.
    private javafx.scene.control.TableColumn<Part,String>
    The [columnInventoryName] which displays Inventory Parts' Name.
    private javafx.scene.control.TableColumn<Part,Double>
    The [columnInventoryPrice] which displays Inventory Parts' Price.
    private javafx.scene.control.TableColumn<Part,Integer>
    The [columnInventoryStock] which displays Inventory Parts' Stock.
    private String
    The [errorMessage] which will be displayed in case of an error when validating.
    private javafx.scene.control.TextField
    The [fieldID] which displays the id for the Part .
    private javafx.scene.control.TextField
    The [fieldMax] takes in input from the user for the partMax.
    private javafx.scene.control.TextField
    The [fieldMin] takes in input from the user for the partMin.
    private javafx.scene.control.TextField
    The [fieldName] takes in input from the user for the partName.
    private javafx.scene.control.TextField
    The [fieldPrice] takes in input from the user for the partPrice.
    private javafx.scene.control.TextField
    The [fieldSearch] takes in input from the user for searching for parts.
    private javafx.scene.control.TextField
    The [fieldStock] takes in input from the user for the Part inventory or partStock.
    private Product
    The [oldProduct] to be referenced.
    private int
    The autogenerated [productId] of the Product to be added.
    private Product
    The [selectedProduct] to be modified.
    private javafx.scene.control.TableView<Part>
    The [TableAssociated] which displays Associated Parts.
    private javafx.scene.control.TableView<Part>
    The [tableInventoryPart] which displays Inventory Parts.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    handleAdd(javafx.event.ActionEvent actionEvent)
    Handles the add associated part functionality when a user presses the add button.
    private void
    handleCancel(javafx.event.ActionEvent actionEvent)
    Handles the canceling functionality when a user presses the cancel button.
    private void
    handleRemove(javafx.event.ActionEvent actionEvent)
    Handles the remove associated part functionality when a user presses the remove button.
    private void
    handleSave(javafx.event.ActionEvent actionEvent)
    Handles the saving functionality when a user presses the save button.
    private void
    handleSearch(javafx.event.ActionEvent actionEvent)
    Handles the search part functionality when the user enters a search query.
    void
    Initializes the FXML Screen, creates a newProduct object, & generates a productId.
    private void
    mainScreen(javafx.event.ActionEvent actionEvent)
    Returns the user back to the main screen.
    void
    Handles setting up all the tables and populates them with the data.
    private boolean
    validate(String name, String priceString, String stockString, String minString, String maxString)
    Validates whether the inputs the user has provided are valid for creating a new product.

    Methods inherited from class java.lang.Object

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

    • fieldId

      private javafx.scene.control.TextField fieldId
      The [fieldID] which displays the id for the Part .
    • fieldName

      private javafx.scene.control.TextField fieldName
      The [fieldName] takes in input from the user for the partName.
    • fieldStock

      private javafx.scene.control.TextField fieldStock
      The [fieldStock] takes in input from the user for the Part inventory or partStock.
    • fieldPrice

      private javafx.scene.control.TextField fieldPrice
      The [fieldPrice] takes in input from the user for the partPrice.
    • fieldMin

      private javafx.scene.control.TextField fieldMin
      The [fieldMin] takes in input from the user for the partMin.
    • fieldMax

      private javafx.scene.control.TextField fieldMax
      The [fieldMax] takes in input from the user for the partMax.
    • fieldSearch

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

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

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

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

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

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

      private javafx.scene.control.TableView<Part> tableAssociatedPart
      The [TableAssociated] which displays Associated Parts.
    • columnAssociatedPartId

      private javafx.scene.control.TableColumn<Part,Integer> columnAssociatedPartId
      The [columnAssociatedId] which displays Associated Parts' Id.
    • columnAssociatedPartName

      private javafx.scene.control.TableColumn<Part,String> columnAssociatedPartName
      The [columnAssociatedName] which displays Associated Parts' Name.
    • columnAssociatedPartStock

      private javafx.scene.control.TableColumn<Part,Integer> columnAssociatedPartStock
      The [columnAssociatedStock] which displays Associated Parts' Stock.
    • columnAssociatedPartPrice

      private javafx.scene.control.TableColumn<Part,Double> columnAssociatedPartPrice
      The [columnAssociatedPrice] which displays Associated Parts' Price.
    • errorMessage

      private String errorMessage
      The [errorMessage] which will be displayed in case of an error when validating.
    • productId

      private int productId
      The autogenerated [productId] of the Product to be added.
    • selectedProduct

      private Product selectedProduct
      The [selectedProduct] to be modified.
    • oldProduct

      private Product oldProduct
      The [oldProduct] to be referenced.
  • Constructor Details

    • ModifyProductController

      public ModifyProductController()
  • Method Details

    • mainScreen

      private void mainScreen(javafx.event.ActionEvent actionEvent) throws IOException
      Returns the user back to the main screen.
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • validate

      private boolean validate(String name, String priceString, String stockString, String minString, String maxString)
      Validates whether the inputs the user has provided are valid for creating a new product. RUNTIME ERROR: errorMessage was not updating with the concat function.
      Parameters:
      name - [String] name value from the name field
      priceString - [String] price value from the price field
      stockString - [String] stock value from the inventory/stock field
      minString - [String] min value from the min field
      maxString - [String] max value from the max field
      Returns:
      [Boolean] true if the inputs are valid, false if any of the inputs are not valid
    • handleSave

      private void handleSave(javafx.event.ActionEvent actionEvent) throws IOException
      Handles the saving functionality when a user presses the save button. If the inputs are valid, the Part is added to the Inventory.
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • handleCancel

      private void handleCancel(javafx.event.ActionEvent actionEvent) throws IOException
      Handles the canceling functionality when a user presses the cancel button. It will return the user the Main screen if the user confirms cancellation
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • handleRemove

      private void handleRemove(javafx.event.ActionEvent actionEvent) throws IOException
      Handles the remove associated part functionality when a user presses the remove button. It will remove the associated part if the user confirms removal
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException
    • handleSearch

      private void handleSearch(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
    • handleAdd

      private void handleAdd(javafx.event.ActionEvent actionEvent) throws IOException
      Handles the add associated part functionality when a user presses the add button. It will add the associated part if the user has selected a part
      Parameters:
      actionEvent - JavaFX action event
      Throws:
      IOException - FUTURE ENHANCEMENT : Adds checks to prevent adding duplicate parts to associated parts.
    • 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 class.
    • initialize

      public void initialize(URL url, ResourceBundle rb)
      Initializes the FXML Screen, creates a newProduct object, & generates a productId.
      Specified by:
      initialize in interface javafx.fxml.Initializable
      Parameters:
      url - parameter for the FXML Screen
      rb - parameter for the FXML Screen