Skip to content
Snippets Groups Projects
Commit ff6faac5 authored by Eilert Tunheim's avatar Eilert Tunheim
Browse files

commented output window

parent 01b3a66e
No related branches found
No related tags found
No related merge requests found
......@@ -10,19 +10,32 @@ import javafx.scene.text.TextAlignment;
import javafx.stage.Modality;
import javafx.stage.Stage;
/**
* This class handles functionality regarding a notification window
*
* @author Eilert Tunheim, Karin Pettersen, Mads Arnesen
* @version 1.0.0
*/
public class NotificationPopUp {
/**
* This function displays the notification window
*
* @param message input parameter for what to display in the window
*/
public static void displayNotificationWindow(String message){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Notification window");
// Defines label
Label messageLabel = new Label();
messageLabel.setText(message);
messageLabel.setWrapText(true);
messageLabel.setTextAlignment(TextAlignment.CENTER);
// Define buttons and handles functionality
Button close = new Button("Close");
close.setOnAction(event -> window.close());
......@@ -32,6 +45,7 @@ public class NotificationPopUp {
}
});
// Adds the components to the VBox
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(messageLabel,close);
......
......@@ -19,8 +19,17 @@ import static com.application.DB.Constants.IS_FINISHED;
import static com.application.DB.Settings.MAX_USER_INPUT_CHARACTERS;
import static com.application.DB.HelpingFunctions.isValidInput;
/**
* This class handles the output window for sending the resulted manual moisture levels
*
* @author Eilert Tunheim, Karin Pettersen, Mads Arnesen
* @version 1.0.0
*/
public class OutputPopup {
/**
* This function handles the output window and it's functionality
*/
public static void displayOutputWindow(){
Stage window = new Stage();
......@@ -54,6 +63,7 @@ public class OutputPopup {
err = true;
}
// Checks if there is an error
if(!err){
if(!moistureCheckTextField.getCharacters().toString().isEmpty() &&
!moistureCheckTextField.getCharacters().toString().equals("Please enter a value")) {
......@@ -66,7 +76,6 @@ public class OutputPopup {
moistureCheckTextField.setPromptText("Please enter a value");
}
} else {
NotificationPopUp.displayNotificationWindow("A maximum of "+MAX_USER_INPUT_CHARACTERS+" characters is allowed!");
moistureCheckTextField.setText("");
moistureCheckTextField.setPromptText("Please enter a value");
}
......@@ -90,6 +99,7 @@ public class OutputPopup {
err = true;
}
// Checks if there is an error
if(!err) {
if (!moistureCheckTextField.getCharacters().toString().isEmpty() &&
!moistureCheckTextField.getCharacters().toString().equals("Please enter a value")) {
......@@ -102,7 +112,6 @@ public class OutputPopup {
moistureCheckTextField.setPromptText("Please enter a value");
}
} else {
NotificationPopUp.displayNotificationWindow("A maximum of "+MAX_USER_INPUT_CHARACTERS+" characters is allowed!");
moistureCheckTextField.setText("");
moistureCheckTextField.setPromptText("Please enter a value");
}
......@@ -111,7 +120,7 @@ public class OutputPopup {
}
});
// Adds the components to the VBox
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.setSpacing(10);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment