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

updated notification class for time left

parent 866ef627
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,6 @@ public class LineChartFunctionality {
private static boolean printLiveData;
private static boolean printPreviousData;
public LineChartFunctionality() {
xAxis = new CategoryAxis();
yAxis = new NumberAxis();
......@@ -448,23 +447,24 @@ public class LineChartFunctionality {
}
public static void getTimeLeft(int liveData){
int time = 0;
int minutes = 0;
int hours = 0;
if(liveData == 0) {
time = getDataPointsXAxis()*10;
minutes = getDataPointsXAxis()*10;
} else {
time = (getDataPointsXAxis()/liveData)*10;
minutes = (getDataPointsXAxis()/liveData)*10;
}
if(time > 60){
time = time/60;
Main.setTimeLeftText(time + " h");
if(time == 3){NotificationPopUp.displayNotificationWindow("3 Hours Left!");}
if(minutes > 60){
hours = minutes/60;
Main.setTimeLeftText(hours + " h");
if(hours == 3){NotificationPopUp.displayNotificationWindow("3 Hours Left!");}
} else {
NotificationPopUp.displayNotificationWindow("1 Hour Left!");
Main.setTimeLeftText(time + " min");
if(minutes == 60){NotificationPopUp.displayNotificationWindow("1 Hours Left!");}
Main.setTimeLeftText(minutes + " min");
}
if(time == 0){
if(minutes == 0){
NotificationPopUp.displayNotificationWindow("Drying Process Finished!");
}
}
......
......@@ -10,11 +10,11 @@ import javafx.stage.Stage;
public class NotificationPopUp {
public static void displayNotificationWindow(String message){
public static void displayNotificationWindow(String message){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Moisture Check");
window.setTitle("Notification window");
Label messageLabel = new Label();
messageLabel.setText(message);
......
No preview for this file type
No preview for this file type
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