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
FieldsModifier 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.TextFieldThe [fieldSearchPart] takes in input from the user for searching for parts.private javafx.scene.control.TextFieldThe [fieldSearchProduct] takes in input from the user for searching for products.private static PartThe [selectedPart] which will be modified by the user.private static ProductThe [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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPart(javafx.event.ActionEvent actionEvent) Sends the user back to the add Part screen.voidaddProduct(javafx.event.ActionEvent actionEvent) Sends the user back to the add Product screen.private voiddeletePart(javafx.event.ActionEvent actionEvent) Handles the delete Part functionality when a user presses the delete button.private voiddeleteProduct(javafx.event.ActionEvent actionEvent) Handles the delete Product functionality when a user presses the delete button.private voidexit(javafx.event.ActionEvent actionEvent) Exits the program when the user presses the exit button.static PartReturns the selectedPart, so it can be accessed on the modification screen.static ProductReturns the selectedProduct, so it can be accessed on the modification screen.private voidhandleSearchPart(javafx.event.ActionEvent actionEvent) Handles the search part functionality when the user enters a search query.private voidhandleSearchProduct(javafx.event.ActionEvent actionEvent) Handles the search part functionality when the user enters a search query.voidinitialize(URL url, ResourceBundle resourceBundle) Initializes the FXML Screen and sets the selectedPart and selectedProduct to null.voidHandles setting up all the tables and populates them with the data.voidmodifyPart(javafx.event.ActionEvent actionEvent) Sends the user back to the modifyPart screen.voidmodifyProduct(javafx.event.ActionEvent actionEvent) Sends the user back to the modifyProduct screen.voidUtility 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:
initializein interfacejavafx.fxml.Initializable- Parameters:
url- parameter for the FXML ScreenresourceBundle- parameter for the FXML Screen
-