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

Added start/stop time constants

parent 45757593
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,11 @@ public final class Constants {
// Today's date
public static final String TODAYS_DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
// Start- & end time
public static String START_TIME = "";
public static String STOP_TIME = "";
// User inputs
public static String TREE_SPECIES = "";
public static String DIMENSIONS = "";
......
......@@ -26,18 +26,7 @@ import static com.application.GUI.LineChartFunctionality.loadSingleSeries;
*/
public class InputPopUpWindow {
private static Thread dataThread;
public static Thread getDataThread(){
return dataThread;
}
public static void setDataThread(Thread dataThread) {
InputPopUpWindow.dataThread = dataThread;
}
public static void exitDataThread(){
InputPopUpWindow.dataThread.interrupt();
Platform.exit();
System.exit(0);
}
......@@ -125,6 +114,11 @@ public class InputPopUpWindow {
startButton.setId("inputButtonStart");
startButton.setOnAction(e -> {
// Sets the start time
START_TIME = TODAYS_DATE;
// Retrieves the user inputs
TREE_SPECIES = treeSpeciesList.getValue();
DIMENSIONS = dimensionsList.getValue();
......@@ -227,8 +221,9 @@ public class InputPopUpWindow {
*/
// Fungerende ny thread!!@@@@@
// Gather data
try{
setDataThread(new Thread(() -> {
Thread thread = new Thread(() -> {
try {
// Henter her data fra databasen
......@@ -244,14 +239,16 @@ public class InputPopUpWindow {
ex.printStackTrace();
}
}
));
InputPopUpWindow.dataThread.interrupt();
getDataThread().setDaemon(true);
getDataThread().start();
);
thread.setDaemon(true);
thread.start();
} catch (Exception ex) {
ex.printStackTrace();
}
}
);
......
......@@ -6,11 +6,12 @@ import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import static com.application.DB.Constants.*;
public class OutputPopUpWindow {
public static void displayOutputWindow(){
......@@ -41,6 +42,7 @@ public class OutputPopUpWindow {
finishButton.setAlignment(Pos.BOTTOM_CENTER);
finishButton.setOnAction(e -> {
try {
STOP_TIME = TODAYS_DATE;
DB.pushManMoisture(moistureCheckTextField.getCharacters().toString());
} catch (Exception ex) {
ex.printStackTrace();
......
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