Package scheduler.util
Class dialogueHandling
- java.lang.Object
-
- scheduler.util.dialogueHandling
-
public abstract class dialogueHandling extends java.lang.Object
Displays alert, error, and confirmation dialogues to the end user. Does some logical error checking.
-
-
Constructor Summary
Constructors Constructor Description dialogueHandling()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
appointmentSchedulingConflict(Appointment existing, Appointment proposed)
Dialogue to inform the user that they are attempting to schedule an appointment for a customer that conflicts with an appointment that is already existing.static void
appointmentWithinFifteen(Appointment upcomingAppointment)
Displays a dialogue to the user when there is another appointment starting within 15 minutes.static boolean
checkAuthentication(java.lang.String username, java.lang.String password)
Does rudimentary authentication for login.static void
confirmAppointmentAdded(Appointment A)
Displays a dialogue that confirms that an appointment has been added successfullystatic boolean
confirmAppointmentDeletion(Appointment A)
Dialogue to confirm whether the user would like to proceed with deleting an appointment recordstatic boolean
confirmAppointmentModification(Appointment A)
Requests confirmation from the user that they would like to modify an appointmentstatic boolean
confirmationDialogue(java.lang.String feedback)
Solicits feedback from the customer on how to proceed.static boolean
confirmationDialogue(java.lang.String header, java.lang.String message)
Provides a confirmation dialogue to the user, with a header.static void
confirmCustomerAdded(Customer C)
Prints a dialogue that confirms that a customer has been addedstatic void
confirmCustomerUpdated(Customer C)
Prints a dialogue that confirms that a customer has been updatedstatic boolean
confirmDeletionCustomer(Customer C)
Prints a dialogue that confirms whether or not the user truly wants to delete a customer record.static boolean
displayDialogue(boolean error, dialogueReturnValues code)
Used to display basic alert and confirmation dialogues to the user.static boolean
informationDialogue(dialogueReturnValues header, dialogueReturnValues content)
Displays an Information dialogue.static boolean
validateAppointment(java.lang.String title, java.lang.String description, java.lang.String location)
Runs validation on appointment fields to make sure they are not empty.static boolean
validateCustomer(java.lang.String name, java.lang.String address, java.lang.String postal, java.lang.String phone)
Provides validation that information entered for a customer meets business standards (not null)static void
validationDialogue(java.lang.String errorList)
Displays an error dialogue that requires the user to acknowledge the message before continuing.
-
-
-
Method Detail
-
displayDialogue
public static boolean displayDialogue(boolean error, dialogueReturnValues code)
Used to display basic alert and confirmation dialogues to the user. Errors and confirmation messages are displayed in the type of dialogue indicated by the boolean parameter. This function assumes that the message is a single string, that does not require formatting.- Parameters:
error
- a true value will display an "Error" dialogue. A false value will result in a "Confirmation" dialogue being displayed.code
- an enum value that will be used to display the correct feedback in the dialogue box. It is used to insert the appropriate string. Parameter must be from dialogueReturnValues.- Returns:
- boolean is set to true if the user responded with "Ok" in the confirmation dialogue. A true value indicates that the user was passed a confirmation dialogue, and pressed the button to proceed. Both error dialogue and cancel responses for a confirmation dialogue will return a false boolean.
-
informationDialogue
public static boolean informationDialogue(dialogueReturnValues header, dialogueReturnValues content)
Displays an Information dialogue. The pop-up dialogue uses a descriptive header in combination with the actual end user response.- Parameters:
header
- reflects the overall subject of the dialogue. Accepts a dialogueReturnValues enum value.content
- informational dialogue content. Accepts a dialogueReturnValues enum value.- Returns:
-
confirmationDialogue
public static boolean confirmationDialogue(java.lang.String header, java.lang.String message)
Provides a confirmation dialogue to the user, with a header.- Parameters:
header
- is a String that is topical to the confirmationmessage
- is a String that queries the user as to whether the operation should be continued.- Returns:
- true if the user confirms, false if they click cancel
-
checkAuthentication
public static boolean checkAuthentication(java.lang.String username, java.lang.String password) throws java.io.IOException
Does rudimentary authentication for login. Checks to make sure neither user name or password are null. Calls the logLoginAttempt function to log the login attempt in the persistent log.- Parameters:
username
- String, user name entered by the user.password
- String, password entered by the user.- Returns:
- true if the user name and password pass initial validity checks. False if they do not.
- Throws:
java.io.IOException
-
confirmationDialogue
public static boolean confirmationDialogue(java.lang.String feedback)
Solicits feedback from the customer on how to proceed. See: confirmationDialogue if a header is needed.- Parameters:
feedback
- is a String provided by the calling function- Returns:
- a boolean true value if the user clicks "Ok" false if they click cancel
-
validationDialogue
public static void validationDialogue(java.lang.String errorList)
Displays an error dialogue that requires the user to acknowledge the message before continuing. This is used specifically for issues were errors are more complex, and built strings need to provide additional information back to the user.- Parameters:
errorList
- is a string that is presented to the user.
-
validateCustomer
public static boolean validateCustomer(java.lang.String name, java.lang.String address, java.lang.String postal, java.lang.String phone)
Provides validation that information entered for a customer meets business standards (not null)- Parameters:
name
- String, name of the customeraddress
- String, addresspostal
- String, postal codephone
- String, phone number- Returns:
- true if the values entered are valid, false if they do not pass validation
-
confirmCustomerAdded
public static void confirmCustomerAdded(Customer C)
Prints a dialogue that confirms that a customer has been added- Parameters:
C
- Represents a new customer record
-
confirmCustomerUpdated
public static void confirmCustomerUpdated(Customer C)
Prints a dialogue that confirms that a customer has been updated- Parameters:
C
- Updated customer object
-
confirmDeletionCustomer
public static boolean confirmDeletionCustomer(Customer C)
Prints a dialogue that confirms whether or not the user truly wants to delete a customer record.- Parameters:
C
- The customer object that is ready to be deleted- Returns:
- true, if the end user confirmed the deletion. False if these chose "Cancel".
-
validateAppointment
public static boolean validateAppointment(java.lang.String title, java.lang.String description, java.lang.String location)
Runs validation on appointment fields to make sure they are not empty. If they are, a custom error message is returned to the user, including the specifics of what needs to be updated- Parameters:
title
- String, title of the appointmentdescription
- String, description of the appointmentlocation
- String, location of the appointment- Returns:
-
confirmAppointmentAdded
public static void confirmAppointmentAdded(Appointment A)
Displays a dialogue that confirms that an appointment has been added successfully- Parameters:
A
- , The appointment that has been added.
-
confirmAppointmentModification
public static boolean confirmAppointmentModification(Appointment A)
Requests confirmation from the user that they would like to modify an appointment- Parameters:
A
- an appointment- Returns:
- true if the user chooses to proceed, false, if they choose to cancel
-
confirmAppointmentDeletion
public static boolean confirmAppointmentDeletion(Appointment A)
Dialogue to confirm whether the user would like to proceed with deleting an appointment record- Parameters:
A
- Appointment object to delete- Returns:
- boolean true if the user clicks "Ok", false, if they click on "Cancel"
-
appointmentSchedulingConflict
public static void appointmentSchedulingConflict(Appointment existing, Appointment proposed)
Dialogue to inform the user that they are attempting to schedule an appointment for a customer that conflicts with an appointment that is already existing.- Parameters:
existing
- Details of current appointmentproposed
- Details of the new proposed appointment
-
appointmentWithinFifteen
public static void appointmentWithinFifteen(Appointment upcomingAppointment)
Displays a dialogue to the user when there is another appointment starting within 15 minutes.- Parameters:
upcomingAppointment
- Appointment object, upcoming appointment
-
-