Class MainFormController
java.lang.Object
com.xavierloeraflores.inventorymanagement.MainFormController
- All Implemented Interfaces:
javafx.fxml.Initializable
Controller class for the Main.fmxl form.
Implements Initializable
- Author:
- xavierloeraflores
-
Field Summary
Modifier and TypeFieldDescriptionThe [columnPartId] which displays Inventory Parts' Id.The [columnPartName] which displays Inventory Parts' Name.The [columnPartPrice] which displays Inventory Parts' Price.The [columnPartStock] which displays Inventory Parts' Stock.The [columnProductId] which displays Inventory Products' Id.The [columnProductName] which displays Inventory Products' Name.The [columnProductPrice] which displays Inventory Products' Price.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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Utility function that is used to switch between pages
-
Field Details
-
tablePart
The [tablePart] which displays Inventory Parts. -
columnPartId
The [columnPartId] which displays Inventory Parts' Id. -
columnPartName
The [columnPartName] which displays Inventory Parts' Name. -
columnPartStock
The [columnPartStock] which displays Inventory Parts' Stock. -
columnPartPrice
The [columnPartPrice] which displays Inventory Parts' Price. -
fieldSearchPart
private javafx.scene.control.TextField fieldSearchPartThe [fieldSearchPart] takes in input from the user for searching for parts. -
tableProduct
The [columnProductId] which displays Inventory Products' Id. -
columnProductId
The [columnProductId] which displays Inventory Products' Id. -
columnProductName
The [columnProductName] which displays Inventory Products' Name. -
columnProductStock
The [columnProductStock] which displays Inventory Products' Stock. -
columnProductPrice
The [columnProductPrice] which displays Inventory Products' Price. -
fieldSearchProduct
private javafx.scene.control.TextField fieldSearchProductThe [fieldSearchProduct] takes in input from the user for searching for products. -
selectedPart
The [selectedPart] which will be modified by the user. -
selectedProduct
The [selectedProduct] which will be modified by the user.
-
-
Constructor Details
-
MainFormController
public MainFormController()
-
-
Method Details
-
getSelectedPart
Returns the selectedPart, so it can be accessed on the modification screen.- Returns:
- [Product] the selectedPart to be modified
-
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
Utility function that is used to switch between pages- Parameters:
actionEvent
- JavaFX action event- Throws:
IOException
-
addPart
Sends the user back to the add Part screen.- Parameters:
actionEvent
- JavaFX action event- Throws:
IOException
-
modifyPart
Sends the user back to the modifyPart screen. This function also sets the selectedPart.- Parameters:
actionEvent
- JavaFX action event- Throws:
IOException
-
handleSearchPart
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
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
Sends the user back to the add Product screen.- Parameters:
actionEvent
- JavaFX action event- Throws:
IOException
-
modifyProduct
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
Initializes the FXML Screen and sets the selectedPart and selectedProduct to null.- Specified by:
initialize
in interfacejavafx.fxml.Initializable
- Parameters:
url
- parameter for the FXML ScreenresourceBundle
- parameter for the FXML Screen
-