Package model

Class ErrorHandling


  • public class ErrorHandling
    extends java.lang.Object
    A class to manage confirmation and alert dialogue boxes Also provides error checking for Product and Part types to meet program requirements
    • Constructor Detail

      • ErrorHandling

        public ErrorHandling()
    • Method Detail

      • errorHandling

        public void errorHandling​(errorCode error)
        Displays an error alert to the user. The message shown in the dialogue box is based on the valid enumerated value passed in by the calling method.
        Parameters:
        Error - - enum value that corresponds to the type of error checking that needs to be done. Valid values:
      • confirmationDialogue

        public boolean confirmationDialogue​(confirmationCodes code)
        Displays a confirmation dialogue with an ok button that checks if the user wants to proceed. The text of the dialogue is a string that reflects the value of the enumerated value that is passed in by the calling method.
        Parameters:
        code - -enum of confirmationCodes type - represents the possible confirmation dialogue messages.
        Returns:
        a boolean of true if the user presses the ok button. If cancel is pressed it returns false.
      • partValueValidation

        public boolean partValueValidation​(Part item)
        Performs part validation to check for the following: 1. Max, Min, Price or Stock cannot be negative numbers 2. Max must be greater than Min 3. Stock cannot be less than Min, or greater or equal to max Displays error dialogues if any of these conditions exist, else, it allows the user to continue with adding the record.
        Parameters:
        item - to validate
        Returns:
        true if item passes validation, false if it has an error
      • productValueValidation

        public boolean productValueValidation​(Product item)
        Performs product validation to check for the following: 1. Max, Min, Price or Stock cannot be negative numbers 2. Max must be greater than Min 3. Stock cannot be less than Min, or greater or equal to max Displays error dialogues if any of these conditions exist, else, it allows the user to continue with adding the record.
        Parameters:
        item - to validate
        Returns:
        true if item passes validation, false if it has an error