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

Added output window and updated the main window with the input parameters given

parent 7ddfe973
No related branches found
No related tags found
No related merge requests found
Showing
with 132 additions and 40 deletions
......@@ -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);
......
......@@ -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();
......
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();
}
}
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);
}
}
......@@ -110,6 +110,7 @@
-fx-font-family: Arial;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-text-fill: white;
-fx-alignment: bottom-center;
}
......
......@@ -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;
}
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
File added
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