Class ModifyPartController
java.lang.Object
com.xavierloeraflores.inventorymanagement.ModifyPartController
- All Implemented Interfaces:
javafx.fxml.Initializable
Controller class for the ModifyPart.fmxl form.
Implements Initializable
- Author:
- xavierloeraflores
-
Field Summary
Modifier and TypeFieldDescriptionprivate 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 [fieldSpecial] takes in input from the user for both machineId and companyName.private javafx.scene.control.TextField
The [fieldStock] takes in input from the user for the Part inventory or partStock.private boolean
The [isOutsourced] boolean which indicates if the Part is Outsourced or In House.private javafx.scene.control.Label
The [labelSpecial] which displays whether the user should enter a machineId or companyName.private int
The autogenerated [partId] of the Part to be added.private javafx.scene.control.RadioButton
The [radioInHouse] which allows the user to select an In House Part.private javafx.scene.control.RadioButton
The [radioOutsourced] which allows the user to select an Outsourced Part.private Part
The [selectedPart] which will be modified by the user. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
handleCancel
(javafx.event.ActionEvent actionEvent) Handles the canceling functionality when a user presses the cancel button.private void
handleSave
(javafx.event.ActionEvent actionEvent) Handles the saving functionality when a user presses the save button.void
initialize
(URL url, ResourceBundle rb) Initializes the FXML Screen, sets the part to InHouse, & generates a partId.private void
mainScreen
(javafx.event.ActionEvent actionEvent) Returns the user back to the main screen.private void
setRadioInHouse
(javafx.event.ActionEvent actionEvent) When the user presses the In House radio button, the Part will convert to an InHouse Part typeprivate void
setRadioOutsourced
(javafx.event.ActionEvent actionEvent) When the user presses the Outsourced radio button, the Part will convert to an Outsourced Part typeprivate boolean
validate
(String name, String priceString, String stockString, String minString, String maxString, String special, boolean isOutsourced) Validates whether the inputs the user has provided are valid for creating a new part.
-
Field Details
-
selectedPart
The [selectedPart] which will be modified by the user. -
radioInHouse
private javafx.scene.control.RadioButton radioInHouseThe [radioInHouse] which allows the user to select an In House Part. -
radioOutsourced
private javafx.scene.control.RadioButton radioOutsourcedThe [radioOutsourced] which allows the user to select an Outsourced Part. -
fieldId
private javafx.scene.control.TextField fieldIdThe [fieldID] which displays the id for the Part . -
fieldName
private javafx.scene.control.TextField fieldNameThe [fieldName] takes in input from the user for the partName. -
fieldStock
private javafx.scene.control.TextField fieldStockThe [fieldStock] takes in input from the user for the Part inventory or partStock. -
fieldPrice
private javafx.scene.control.TextField fieldPriceThe [fieldPrice] takes in input from the user for the partPrice. -
fieldMin
private javafx.scene.control.TextField fieldMinThe [fieldMin] takes in input from the user for the partMin. -
fieldMax
private javafx.scene.control.TextField fieldMaxThe [fieldMax] takes in input from the user for the partMax. -
labelSpecial
private javafx.scene.control.Label labelSpecialThe [labelSpecial] which displays whether the user should enter a machineId or companyName. -
fieldSpecial
private javafx.scene.control.TextField fieldSpecialThe [fieldSpecial] takes in input from the user for both machineId and companyName. -
isOutsourced
private boolean isOutsourcedThe [isOutsourced] boolean which indicates if the Part is Outsourced or In House. -
errorMessage
The [errorMessage] which will be displayed in case of an error when validating. -
partId
private int partIdThe autogenerated [partId] of the Part to be added.
-
-
Constructor Details
-
ModifyPartController
public ModifyPartController()
-
-
Method Details
-
setRadioInHouse
private void setRadioInHouse(javafx.event.ActionEvent actionEvent) When the user presses the In House radio button, the Part will convert to an InHouse Part type- Parameters:
actionEvent
- JavaFX action event
-
setRadioOutsourced
private void setRadioOutsourced(javafx.event.ActionEvent actionEvent) When the user presses the Outsourced radio button, the Part will convert to an Outsourced Part type- Parameters:
actionEvent
- JavaFX action event
-
mainScreen
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, String special, boolean isOutsourced) Validates whether the inputs the user has provided are valid for creating a new part. RUNTIME ERROR: errorMessage was not updating with the concat function.- Parameters:
name
- [String] name value from the name fieldpriceString
- [String] price value from the price fieldstockString
- [String] stock value from the inventory/stock fieldminString
- [String] min value from the min fieldmaxString
- [String] max value from the max fieldspecial
- [String] special value from the special fieldisOutsourced
- [Boolean] values as a result of the radio buttons- Returns:
- [Boolean] true if the inputs are valid, false if any of the inputs are not valid
-
handleSave
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
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
- Java FX Action event- Throws:
IOException
-
initialize
Initializes the FXML Screen, sets the part to InHouse, & generates a partId.- Specified by:
initialize
in interfacejavafx.fxml.Initializable
- Parameters:
url
- parameter for the FXML Screenrb
- parameter for the FXML Screen
-