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