diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java index 670782dfc726919e504465964010cf9a3c1cc8ad..f0d3e4eea06e27efc4fdaf9a34013bfa30cecea9 100644 --- a/src/main/java/com/application/DB/DB.java +++ b/src/main/java/com/application/DB/DB.java @@ -185,7 +185,6 @@ public class DB { } else break; } - return getKwh(results); } @@ -376,12 +375,15 @@ public class DB { //System.out.println("Must be a string!!@@@@"); - // stores the value - String value = (String) row.get("DryingStarted").getValue(); - // Splits the string based on 'T' - String[] splitValue = value.split("T"); - // Combines the values into a new format - formatedInTidTork = splitValue[0]+" "+splitValue[1]; + if(row.get("DryingStarted").getValue().toString().contains("T")){ + // stores the value + String value = (String) row.get("DryingStarted").getValue(); + // Splits the string based on 'T' + String[] splitValue = value.split("T"); + // Combines the values into a new format + formatedInTidTork = splitValue[0]+" "+splitValue[1]; + } + else formatedInTidTork = row.get("DryingStarted").getValue().toString(); } // Checks if response is given in a string date format @@ -401,12 +403,16 @@ public class DB { } catch(NumberFormatException e) { //not long value, must be of type string - // stores the value - String value = (String) row.get("DryingCompleted").getValue(); - // Splits the string based on 'T' - String[] splitValue = value.split("T"); - // Combines the values into a new format - formatedUtTidTork = splitValue[0] + " " + splitValue[1]; + if(row.get("DryingCompleted").getValue().toString().contains("T")){ + // stores the value + String value = (String) row.get("DryingCompleted").getValue(); + // Splits the string based on 'T' + String[] splitValue = value.split("T"); + // Combines the values into a new format + formatedUtTidTork = splitValue[0] + " " + splitValue[1]; + } + else formatedUtTidTork = row.get("DryingCompleted").getValue().toString(); + } //System.out.println("Inn formated: "+formatedInTidTork); diff --git a/src/main/java/com/application/GUI/InputPopUpWindow.java b/src/main/java/com/application/GUI/InputPopUpWindow.java index 0595c67b0da229f87cd43aec0f87325954b62926..3477f8003049cd3901e0ba08dcbf3f9b65b190f4 100644 --- a/src/main/java/com/application/GUI/InputPopUpWindow.java +++ b/src/main/java/com/application/GUI/InputPopUpWindow.java @@ -8,12 +8,9 @@ import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.*; -import java.util.Map; -import java.util.concurrent.*; - import static com.application.DB.Constants.*; +import static com.application.Main.*; import static com.application.DB.DB.setInputParameters; -import static com.application.GUI.LineChartFunctionality.loadMultipleSeries; import static com.application.GUI.LineChartFunctionality.loadSingleSeries; @@ -25,12 +22,6 @@ import static com.application.GUI.LineChartFunctionality.loadSingleSeries; */ public class InputPopUpWindow { - private static final Integer SLEEP_MILLS = 3000; - private static final Integer RUN_SLEEP_MILLS = 1000; - private static int afterSeconds = SLEEP_MILLS / RUN_SLEEP_MILLS; - - - public static void display() { Stage window = new Stage(); @@ -58,10 +49,16 @@ public class InputPopUpWindow { Label dimensionsInputLabel = new Label("Dimensions"); dimensionsInputLabel.setId("inputLabel"); ObservableList<String> dimensions = FXCollections.observableArrayList( - "47x150", - "47x200", - "50x150", - "50x200" + "47x150", + "47x175", + "47x200", + "47x225", + "47x250", + "50x150", + "50x175", + "50x200", + "50x225", + "50x250" ); ComboBox<String> dimensionsList = new ComboBox<String>(dimensions); dimensionsList.setPromptText("Select Dimensions"); @@ -112,13 +109,16 @@ public class InputPopUpWindow { SAWSET = sawsetList.getValue(); MOISTURE_GOAL = moistureList.getValue(); - // If the input is null, sets the corresponding value to be empty + // If the input is null, sets the value to be empty if(treeSpeciesList.getValue() == null){TREE_SPECIES = "";} if(dimensionsList.getValue() == null){DIMENSIONS = "";} if(sawsetList.getValue() == null){SAWSET = "";} if(moistureList.getValue() == null){MOISTURE_GOAL = "";} - + setTreeSpeciesText(TREE_SPECIES); + setDimensionsText(DIMENSIONS); + setSawsetText(SAWSET); + setMoistureGoalText(MOISTURE_GOAL); window.close(); diff --git a/src/main/java/com/application/GUI/OutputPopUpWindow.java b/src/main/java/com/application/GUI/OutputPopUpWindow.java new file mode 100644 index 0000000000000000000000000000000000000000..7b651c7d1c8a567d32b66e0d3a6f61f55b6f6d63 --- /dev/null +++ b/src/main/java/com/application/GUI/OutputPopUpWindow.java @@ -0,0 +1,53 @@ +package com.application.GUI; + +import javafx.geometry.Pos; +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; + +public class OutputPopUpWindow { + + public static void displayOutputWindow(){ + + Stage window = new Stage(); + window.initModality(Modality.APPLICATION_MODAL); + window.setTitle("Moisture Check"); + + // Top + Label moistureCheckLabelHuge = new Label("Moisture Check"); + moistureCheckLabelHuge.setId("inputTop"); + moistureCheckLabelHuge.setAlignment(Pos.TOP_CENTER); + + // Center - Output field + Label moistureCheckLabelSmall = new Label("Moisture Check:"); + moistureCheckLabelSmall.setId("inputLabel"); + moistureCheckLabelSmall.setAlignment(Pos.CENTER); + TextField moistureCheckTextField = new TextField(); + moistureCheckTextField.setId("inputLabel"); + moistureCheckTextField.setAlignment(Pos.CENTER); + + // Bottom - Buttons + Button countinueButton = new Button("Continue"); + countinueButton.setId("inputButtonStart"); + countinueButton.setAlignment(Pos.BOTTOM_CENTER); + Button finishButton = new Button("Finish"); + finishButton.setId("inputButtonStart"); + finishButton.setAlignment(Pos.BOTTOM_CENTER); + + + VBox layout = new VBox(10); + layout.setAlignment(Pos.CENTER); + layout.getChildren().addAll(moistureCheckLabelHuge,moistureCheckLabelSmall,moistureCheckTextField,countinueButton,finishButton); + + Scene scene = new Scene(layout, 600, 500); + scene.getStylesheets().add(InputPopUpWindow.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm()); + window.setScene(scene); + window.showAndWait(); + } + +} diff --git a/src/main/java/com/application/Main.java b/src/main/java/com/application/Main.java index e8b5541349f698c0d8e9d0636523e83cb035bd96..bd571fe7ed226785fe5ae08b069605b8059a6b79 100644 --- a/src/main/java/com/application/Main.java +++ b/src/main/java/com/application/Main.java @@ -1,6 +1,7 @@ package com.application; import com.application.GUI.InputPopUpWindow; +import com.application.GUI.OutputPopUpWindow; import com.application.GUI.RingProgressIndicator; import com.application.GUI.LineChartFunctionality; @@ -19,6 +20,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.logging.Logger; +import static com.application.DB.Constants.*; import static java.util.logging.Level.SEVERE; /** @@ -35,6 +37,11 @@ public class Main extends Application { private MenuBar menuBar; private LineChartFunctionality lineChartFunctionality; + private static TextField treeSpeciesText; + private static TextField dimensionsText; + private static TextField sawsetText; + private static TextField moistureGoalText; + /** * Starts the application * @@ -151,28 +158,35 @@ public class Main extends Application { Label treeSpeciesLabel = new Label("Tree Species"); treeSpeciesLabel.setId("sideBarLabelText"); - TextField treeSpeciesText = new TextField(); + treeSpeciesText = new TextField(); treeSpeciesText.setId("sideBarLabelText"); - treeSpeciesText.setPromptText("Bjørk"); - treeSpeciesText.getText(); + treeSpeciesText.setPromptText("Gran"); + treeSpeciesText.setText(TREE_SPECIES); + treeSpeciesText.setEditable(false); Label dimensionsLabel = new Label("Width x Height"); dimensionsLabel.setId("sideBarLabelText"); - TextField dimensionsText = new TextField(); + dimensionsText = new TextField(); dimensionsText.setId("sideBarLabelText"); dimensionsText.setPromptText("47 x 150"); + dimensionsText.setText(DIMENSIONS); + dimensionsText.setEditable(false); Label sawsetLabel = new Label("Sawset"); sawsetLabel.setId("sideBarLabelText"); - TextField sawsetText = new TextField(); + sawsetText = new TextField(); sawsetText.setId("sideBarLabelText"); sawsetText.setPromptText("4x"); + sawsetText.setText(SAWSET); + sawsetText.setEditable(false); Label moistureGoalLabel = new Label("Moisture Goal"); moistureGoalLabel.setId("sideBarLabelText"); - TextField moistureGoalText = new TextField(); + moistureGoalText = new TextField(); moistureGoalText.setId("sideBarLabelText"); - moistureGoalText.setPromptText("12%"); + moistureGoalText.setPromptText("16%"); + moistureGoalText.setText(MOISTURE_GOAL); + moistureGoalText.setEditable(false); Button inputParametersButton = new Button("Input Parameters"); inputParametersButton.setId("sideBarButtonInputParameters"); @@ -180,6 +194,7 @@ public class Main extends Application { Button finishButton = new Button("Finish"); finishButton.setId("sideBarButtonFinish"); + finishButton.setOnAction(e -> OutputPopUpWindow.displayOutputWindow()); @@ -230,9 +245,6 @@ public class Main extends Application { VBox.setVgrow(sideBarVBox, Priority.ALWAYS); return sideBarVBox; - - - } @@ -266,6 +278,25 @@ public class Main extends Application { return new HBox(imageViewM, region1, imageViewTitle, region2); } + + + + + public static void setTreeSpeciesText(String treeSpeciesText) { + Main.treeSpeciesText.setText(treeSpeciesText); + } + + public static void setDimensionsText(String dimensionsText) { + Main.dimensionsText.setText(dimensionsText); + } + + public static void setSawsetText(String sawsetText) { + Main.sawsetText.setText(sawsetText); + } + + public static void setMoistureGoalText(String moistureGoalText) { + Main.moistureGoalText.setText(moistureGoalText); + } } diff --git a/src/main/resources/com.application/CSS/styleSheet.css b/src/main/resources/com.application/CSS/styleSheet.css index dcd1a78c1b47dc12787d9e7ad5a46a8a7802d9fd..9eacafe326bf12e982307459cdd56333a28c319f 100644 --- a/src/main/resources/com.application/CSS/styleSheet.css +++ b/src/main/resources/com.application/CSS/styleSheet.css @@ -110,6 +110,7 @@ -fx-font-family: Arial; -fx-background-color: rgba(12, 76, 81, 1); -fx-text-fill: white; + -fx-alignment: bottom-center; } diff --git a/target/classes/com.application/CSS/styleSheet.css b/target/classes/com.application/CSS/styleSheet.css index 9669a07744aad57b8c6008f9f4901770737b37ed..9eacafe326bf12e982307459cdd56333a28c319f 100644 --- a/target/classes/com.application/CSS/styleSheet.css +++ b/target/classes/com.application/CSS/styleSheet.css @@ -93,7 +93,7 @@ -fx-font-family: Arial; } -#inputLabelText { +#inputDropDownBox { -fx-pref-height: 17; -fx-translate-x: 5; -fx-max-height: infinity; @@ -110,6 +110,7 @@ -fx-font-family: Arial; -fx-background-color: rgba(12, 76, 81, 1); -fx-text-fill: white; + -fx-alignment: bottom-center; } diff --git a/target/classes/com/application/DB/Constants.class b/target/classes/com/application/DB/Constants.class index e9f7b13a7cc2894e84287aeae17f80c67373d3ee..a8e88ad82c3a058c24d18c8c9e69908098dfe753 100644 Binary files a/target/classes/com/application/DB/Constants.class and b/target/classes/com/application/DB/Constants.class differ diff --git a/target/classes/com/application/DB/DB.class b/target/classes/com/application/DB/DB.class index f6de3c037d0b46daa2274512d5f7e0109cf16b89..82478f7c1f0a59ad25689f282837d8015f388f7a 100644 Binary files a/target/classes/com/application/DB/DB.class and b/target/classes/com/application/DB/DB.class differ diff --git a/target/classes/com/application/GUI/InputPopUpWindow.class b/target/classes/com/application/GUI/InputPopUpWindow.class index 9ea2513d2c3ca6d86f03a8c1eccdbd16db02f761..c7a5a61caaaf14b86600a4d4bcf9d9e5cbb3e30b 100644 Binary files a/target/classes/com/application/GUI/InputPopUpWindow.class and b/target/classes/com/application/GUI/InputPopUpWindow.class differ diff --git a/target/classes/com/application/GUI/LineChartFunctionality.class b/target/classes/com/application/GUI/LineChartFunctionality.class index 91dc1af6a9f30bf19ccc6610890a96bfcee57fc4..6f28f534a0484a9e319c2585678a0b527fd50c78 100644 Binary files a/target/classes/com/application/GUI/LineChartFunctionality.class and b/target/classes/com/application/GUI/LineChartFunctionality.class differ diff --git a/target/classes/com/application/GUI/OutputPopUpWindow.class b/target/classes/com/application/GUI/OutputPopUpWindow.class new file mode 100644 index 0000000000000000000000000000000000000000..c8972540dd67702c1f8cd361d98d6357e1aedfda Binary files /dev/null and b/target/classes/com/application/GUI/OutputPopUpWindow.class differ