diff --git a/.gitignore b/.gitignore index e4505922d167594db040bc20237867ba55e3970b..4f1c281a045810e9d046565410e379ec764e6415 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ /doc/ /contacts.log /addressbook.dat -/src/main/resources/com.application/sf-drying-optimization-1e234ad2b0f4.json +/src/main/resources/com.application/sf-drying-optimization-8a2e1b7ffc14.json diff --git a/src/main/java/com/application/DB/Constants.java b/src/main/java/com/application/DB/Constants.java index 8c2539329faf3562e65f204a3527fc30451f7e10..0f20451d45a5d26cae76f50eea137175808c79bb 100644 --- a/src/main/java/com/application/DB/Constants.java +++ b/src/main/java/com/application/DB/Constants.java @@ -1,6 +1,9 @@ package com.application.DB; public class Constants { + + public static String KEY_FILE_NAME = "sf-drying-optimization-8a2e1b7ffc14.json"; + // Start- & end time public static String START_TIME = ""; public static String STOP_TIME = ""; diff --git a/src/main/java/com/application/DB/HelpingFunctions.java b/src/main/java/com/application/DB/HelpingFunctions.java index e30182e02f9734447647e81ff99148950ef040be..cdeeafa3bb95313fe9289e3b84df3a3d89e94db1 100644 --- a/src/main/java/com/application/DB/HelpingFunctions.java +++ b/src/main/java/com/application/DB/HelpingFunctions.java @@ -11,6 +11,7 @@ import java.util.HashMap; import java.util.Map; import java.util.TimeZone; +import static com.application.DB.Constants.KEY_FILE_NAME; import static com.application.DB.Settings.*; public class HelpingFunctions { @@ -36,7 +37,7 @@ public class HelpingFunctions { * @throws Exception for potential errors */ private static GoogleCredentials getCredentials() throws Exception { - File credentialsPath = new File("./src/main/resources/com.application/sf-drying-optimization-1e234ad2b0f4.json"); + File credentialsPath = new File("./src/main/resources/com.application/"+KEY_FILE_NAME); // Load credentials from JSON key file. If you can't set the GOOGLE_APPLICATION_CREDENTIALS // environment variable, you can explicitly load the credentials file to construct the diff --git a/src/main/java/com/application/GUI/Panes/BottomBar.java b/src/main/java/com/application/GUI/Panes/BottomBar.java new file mode 100644 index 0000000000000000000000000000000000000000..d7023b0dd4857862cd3789edb7e8537b9e41fbfb --- /dev/null +++ b/src/main/java/com/application/GUI/Panes/BottomBar.java @@ -0,0 +1,82 @@ +package com.application.GUI.Panes; + +import com.application.DB.Constants; +import com.application.GUI.LineChartFunctionality; +import com.application.Main; +import javafx.geometry.Pos; +import javafx.scene.control.CheckBox; +import javafx.scene.control.Label; +import javafx.scene.layout.HBox; + +public class BottomBar { + private final Main main; + + public BottomBar(Main main) { + this.main = main; + } + + public HBox createBottomBar() { + HBox hBox = new HBox(); + + Label liveDataText = new Label("View Live Data"); + main.setLiveDataBox(new CheckBox()); + Main.getLiveDataBox().setSelected(Constants.DEFAULT_IS_SELECTED_LIVE_DATA); + Main.getLiveDataBox().setOnAction(event -> { + if (Main.getLiveDataBox().isSelected()) { + LineChartFunctionality.setPrintLiveData(true); + LineChartFunctionality.printGraphs(); + + } else { + LineChartFunctionality.setPrintLiveData(false); + LineChartFunctionality.printGraphs(); + } + }); + + Label regressionText = new Label("View Regression"); + main.setRegressionBox(new CheckBox()); + Main.getRegressionBox().setSelected(Constants.DEFAULT_IS_SELECTED_REGRESSION); + Main.getRegressionBox().setOnAction(event -> { + if (Main.getRegressionBox().isSelected()) { + LineChartFunctionality.setPrintRegression(true); + LineChartFunctionality.printGraphs(); + + } else { + LineChartFunctionality.setPrintRegression(false); + LineChartFunctionality.printGraphs(); + } + }); + + Label regressionConfidenceIntervalText = new Label("View Regression Shadow"); + main.setRegressionConfidenceIntervalBox(new CheckBox()); + Main.getRegressionConfidenceIntervalBox().setSelected(Constants.DEFAULT_IS_SELECTED_REGRESSION_SHADOW); + Main.getRegressionConfidenceIntervalBox().setOnAction(event -> { + if (Main.getRegressionConfidenceIntervalBox().isSelected()) { + LineChartFunctionality.setPrintRegressionConfidenceInterval(true); + LineChartFunctionality.printGraphs(); + } else { + LineChartFunctionality.setPrintRegressionConfidenceInterval(false); + LineChartFunctionality.printGraphs(); + } + }); + + Label previousText = new Label("View Previous Data"); + main.setPreviousBox(new CheckBox()); + Main.getPreviousBox().setSelected(Constants.DEFAULT_IS_SELECTED_PREVIOUS_DATA); + Main.getPreviousBox().setOnAction(event -> { + if (Main.getPreviousBox().isSelected()) { + LineChartFunctionality.setPrintPreviousData(true); + LineChartFunctionality.printGraphs(); + } else { + LineChartFunctionality.setPrintPreviousData(false); + LineChartFunctionality.printGraphs(); + } + }); + + + hBox.getChildren().addAll(liveDataText, Main.getLiveDataBox(), regressionText, Main.getRegressionBox(), regressionConfidenceIntervalText, Main.getRegressionConfidenceIntervalBox(), previousText, Main.getPreviousBox()); + hBox.setAlignment(Pos.CENTER_RIGHT); + hBox.setSpacing(5); + + return hBox; + } +} \ No newline at end of file diff --git a/src/main/java/com/application/GUI/Panes/LogoBar.java b/src/main/java/com/application/GUI/Panes/LogoBar.java new file mode 100644 index 0000000000000000000000000000000000000000..f819c95c7aef5dbde8ebbfe29e487adf19edfe89 --- /dev/null +++ b/src/main/java/com/application/GUI/Panes/LogoBar.java @@ -0,0 +1,46 @@ +package com.application.GUI.Panes; + +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Priority; +import javafx.scene.layout.Region; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; + +public class LogoBar { + public LogoBar() { + } + + /** + * This function imports the logos and defines the alignments + * + * @return a logoBar containing the logos in proper alignments + * @throws FileNotFoundException + */ + public HBox createLogoBar() throws FileNotFoundException { + // Defining the image paths + Image moelvenLogoM = new Image(new FileInputStream("src/main/resources/com.application/GUI/moelven_logo_m.png")); + Image moelvenLogoTitle = new Image(new FileInputStream("src/main/resources/com.application/GUI/moelven_logo_title.png")); + + // Creating imageview objects + ImageView imageViewM = new ImageView(moelvenLogoM); + ImageView imageViewTitle = new ImageView(moelvenLogoTitle); + + // Defining resolution and aspect ratio + imageViewM.setFitHeight(100); + imageViewM.setPreserveRatio(true); + imageViewTitle.setFitHeight(100); + imageViewTitle.setPreserveRatio(true); + + // Defining alignments + Region region1 = new Region(); + HBox.setHgrow(region1, Priority.ALWAYS); + + Region region2 = new Region(); + HBox.setHgrow(region2, Priority.ALWAYS); + + return new HBox(imageViewM, region1, imageViewTitle, region2); + } +} \ No newline at end of file diff --git a/src/main/java/com/application/GUI/Panes/MenuBar.java b/src/main/java/com/application/GUI/Panes/MenuBar.java new file mode 100644 index 0000000000000000000000000000000000000000..77550ca4e30f12affd285b75b6ec402b2729df60 --- /dev/null +++ b/src/main/java/com/application/GUI/Panes/MenuBar.java @@ -0,0 +1,97 @@ +package com.application.GUI.Panes; + +import com.application.DB.Constants; +import com.application.GUI.LineChartFunctionality; +import com.application.Main; +import javafx.scene.control.CheckMenuItem; +import javafx.scene.control.Menu; +import javafx.scene.control.MenuItem; + +public class MenuBar { + private final Main main; + + public MenuBar(Main main) { + this.main = main; + } + + /** + * Creates the menubar with buttons. + * Defines each action when button is clicked. + * + * @return MenuBar as a HBox + */ + public javafx.scene.control.MenuBar createMenuBar() { + + // Creating a menubar + javafx.scene.control.MenuBar menuBar = new javafx.scene.control.MenuBar(); + + // Defining the individual menus + Menu menuFile = new Menu("File"); + Menu menuView = new Menu("View"); + Menu menuHelp = new Menu("Help"); + + MenuItem menuFileExit = new MenuItem("Exit"); + menuFileExit.setOnAction(event -> Main.exitApplication()); + + Main.setMenuViewLiveData(new CheckMenuItem("Live Data")); + main.setMenuViewRegression(new CheckMenuItem("Regression")); + main.setMenuViewRegressionShadow(new CheckMenuItem("Regression Shadow")); + main.setMenuViewPreviousData(new CheckMenuItem("Previous Data")); + + Main.getMenuViewLiveData().setSelected(Constants.DEFAULT_IS_SELECTED_LIVE_DATA); + Main.getMenuViewRegression().setSelected(Constants.DEFAULT_IS_SELECTED_REGRESSION); + Main.getMenuViewRegressionShadow().setSelected(Constants.DEFAULT_IS_SELECTED_REGRESSION_SHADOW); + Main.getMenuViewPreviousData().setSelected(Constants.DEFAULT_IS_SELECTED_PREVIOUS_DATA); + + Main.getMenuViewLiveData().setOnAction(event -> { + if (Main.getMenuViewLiveData().isSelected()) { + LineChartFunctionality.setPrintLiveData(true); + LineChartFunctionality.printGraphs(); + } else { + LineChartFunctionality.setPrintLiveData(false); + LineChartFunctionality.printGraphs(); + } + }); + Main.getMenuViewRegression().setOnAction(event -> { + if (Main.getMenuViewRegression().isSelected()) { + LineChartFunctionality.setPrintRegression(true); + LineChartFunctionality.printGraphs(); + } else { + LineChartFunctionality.setPrintRegression(false); + LineChartFunctionality.printGraphs(); + } + }); + Main.getMenuViewRegressionShadow().setOnAction(event -> { + if (Main.getMenuViewRegressionShadow().isSelected()) { + LineChartFunctionality.setPrintRegressionConfidenceInterval(true); + LineChartFunctionality.printGraphs(); + } else { + LineChartFunctionality.setPrintRegressionConfidenceInterval(false); + LineChartFunctionality.printGraphs(); + } + }); + Main.getMenuViewPreviousData().setOnAction(event -> { + if (Main.getMenuViewPreviousData().isSelected()) { + LineChartFunctionality.setPrintPreviousData(true); + LineChartFunctionality.printGraphs(); + } else { + LineChartFunctionality.setPrintPreviousData(false); + LineChartFunctionality.printGraphs(); + } + }); + + MenuItem aboutUs = new MenuItem("About Us"); + MenuItem help = new MenuItem("Help"); + + + menuFile.getItems().addAll(menuFileExit); + menuView.getItems().addAll(Main.getMenuViewLiveData(), Main.getMenuViewRegression(), Main.getMenuViewRegressionShadow(), Main.getMenuViewPreviousData()); + menuHelp.getItems().addAll(aboutUs, help); + + // Adding the menus to the menubar + menuBar.getMenus().addAll(menuFile, menuView, menuHelp); + + // Returns the menubar + return menuBar; + } +} \ No newline at end of file diff --git a/src/main/java/com/application/GUI/Panes/SideBar.java b/src/main/java/com/application/GUI/Panes/SideBar.java new file mode 100644 index 0000000000000000000000000000000000000000..ac1de60476abae06046578f9a397a5e33c861a74 --- /dev/null +++ b/src/main/java/com/application/GUI/Panes/SideBar.java @@ -0,0 +1,143 @@ +package com.application.GUI.Panes; + +import com.application.DB.Constants; +import com.application.DB.HelpingFunctions; +import com.application.DB.Settings; +import com.application.GUI.InputPopUpWindow; +import com.application.GUI.LineChartFunctionality; +import com.application.GUI.OutputPopUpWindow; +import com.application.GUI.ProgressBar.RingProgressIndicator; +import com.application.Main; +import javafx.application.Platform; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.Priority; +import javafx.scene.layout.VBox; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import static com.application.DB.HelpingFunctions.isLoadedData; +import static com.application.DB.Settings.NUMBER_OF_SECONDS_LIVE_DATA; +import static com.application.GUI.LineChartFunctionality.getDataPointsXAxis; +import static com.application.GUI.LineChartFunctionality.getLiveData; +import static java.util.logging.Level.SEVERE; + +public class SideBar { + + public SideBar(Main main) { + } + + public VBox createSideBar() { + + // Creating a vbox + VBox sideBarVBox = new VBox(); + + Label treeSpeciesLabel = new Label("Tree Species"); + treeSpeciesLabel.setId("sideBarLabelText"); + Main.setTreeSpeciesText(new TextField()); + Main.getTreeSpeciesText().setId("sideBarLabelText"); + Main.getTreeSpeciesText().setPromptText("No Input"); + Main.getTreeSpeciesText().setText(Constants.TREE_SPECIES); + Main.getTreeSpeciesText().setEditable(false); + + Label dimensionsLabel = new Label("Width x Height"); + dimensionsLabel.setId("sideBarLabelText"); + Main.setDimensionsText(new TextField()); + Main.getDimensionsText().setId("sideBarLabelText"); + Main.getDimensionsText().setPromptText("No Input"); + Main.getDimensionsText().setText(Constants.DIMENSIONS); + Main.getDimensionsText().setEditable(false); + + Label sawsetLabel = new Label("Sawset"); + sawsetLabel.setId("sideBarLabelText"); + Main.setSawsetText(new TextField()); + Main.getSawsetText().setId("sideBarLabelText"); + Main.getSawsetText().setPromptText("No Input"); + Main.getSawsetText().setText(Constants.SAWSET); + Main.getSawsetText().setEditable(false); + + Label moistureGoalLabel = new Label("Moisture Goal"); + moistureGoalLabel.setId("sideBarLabelText"); + Main.setMoistureGoalText(new TextField()); + Main.getMoistureGoalText().setId("sideBarLabelText"); + Main.getMoistureGoalText().setPromptText("No Input"); + Main.getMoistureGoalText().setText(Constants.MOISTURE_GOAL); + Main.getMoistureGoalText().setEditable(false); + + Label timeLeftLabel = new Label("Time Left"); + timeLeftLabel.setId("sideBarLabelText"); + Main.setTimeLeftText(new TextField()); + Main.getTimeLeftText().setId("sideBarLabelText"); + Main.getTimeLeftText().setPromptText("Calculating..."); + Main.getTimeLeftText().setText(Constants.TIME_LEFT); + Main.getTimeLeftText().setEditable(false); + + Button inputParametersButton = new Button("Input Parameters"); + inputParametersButton.setId("sideBarButtonInputParameters"); + inputParametersButton.setOnAction(e -> InputPopUpWindow.display()); + + Button finishButton = new Button("Finish"); + finishButton.setId("sideBarButtonFinish"); + finishButton.setOnAction(e -> OutputPopUpWindow.displayOutputWindow()); + + Button exitButton = new Button("Exit"); + exitButton.setId("sideBarButtonExit"); + exitButton.setOnAction(e -> Main.exitApplication()); + + + // Creating the circular progressbar + RingProgressIndicator ringProgressIndicator = new RingProgressIndicator(); + ringProgressIndicator.setRingWidth(100); + ringProgressIndicator.makeIndeterminate(); + + class WorkerThread extends Thread{ + RingProgressIndicator rpi; + int progress = 0; + + public WorkerThread(RingProgressIndicator rpi){ + this.rpi = rpi; + } + + @Override + public void run() { + while (!Constants.IS_FINISHED) { + + try { + ringProgressIndicator.makeIndeterminate(); + Thread.sleep(500L * NUMBER_OF_SECONDS_LIVE_DATA); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + while (isLoadedData()) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + Logger.getLogger(getClass().getName()).log(SEVERE, null, e); + } + Platform.runLater(() -> rpi.setProgress(progress)); + + progress = getLiveData().size()/ getDataPointsXAxis()*100; + + if (progress > 100) { + break; + } + } + } + } + } + + new WorkerThread(ringProgressIndicator).start(); + + + sideBarVBox.getChildren().addAll(ringProgressIndicator, treeSpeciesLabel, Main.getTreeSpeciesText(), dimensionsLabel, Main.getDimensionsText(), + sawsetLabel, Main.getSawsetText(), moistureGoalLabel, Main.getMoistureGoalText(), timeLeftLabel, Main.getTimeLeftText(), inputParametersButton, finishButton, exitButton); + + VBox.setVgrow(sideBarVBox, Priority.ALWAYS); + + return sideBarVBox; + } +} \ No newline at end of file diff --git a/src/main/java/com/application/Main.java b/src/main/java/com/application/Main.java index 8fe99e18339a33cff94b3518fe093cec1bee44a9..761e4f516f6d52ae9373243fc6f4ddebb19d2e8e 100644 --- a/src/main/java/com/application/Main.java +++ b/src/main/java/com/application/Main.java @@ -1,33 +1,21 @@ package com.application; -import com.application.DB.Constants; import com.application.GUI.InputPopUpWindow; -import com.application.GUI.OutputPopUpWindow; -import com.application.GUI.ProgressBar.RingProgressIndicator; +import com.application.GUI.Panes.BottomBar; +import com.application.GUI.Panes.LogoBar; +import com.application.GUI.Panes.SideBar; import com.application.GUI.LineChartFunctionality; import javafx.application.Application; import javafx.application.Platform; -import javafx.geometry.Pos; import javafx.scene.chart.LineChart; import javafx.scene.control.*; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; import javafx.scene.layout.*; import javafx.scene.Scene; import javafx.stage.Stage; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; -import java.util.logging.Logger; - -import static com.application.DB.Constants.*; -import static com.application.DB.Settings.*; -import static com.application.DB.HelpingFunctions.isLoadedData; -import static com.application.GUI.LineChartFunctionality.getDataPointsXAxis; -import static com.application.GUI.LineChartFunctionality.getLiveData; -import static java.util.logging.Level.SEVERE; /** * This class launches the application @@ -37,7 +25,10 @@ import static java.util.logging.Level.SEVERE; */ public class Main extends Application { - private LineChartFunctionality lineChartFunctionality; + private final BottomBar bottomBar1 = new BottomBar(this); + private final com.application.GUI.Panes.MenuBar menuBar1 = new com.application.GUI.Panes.MenuBar(this); + private final SideBar sideBar1 = new SideBar(this); + private final LogoBar logoBar1 = new LogoBar(); private BorderPane topBar; private HBox logoBar; @@ -86,7 +77,7 @@ public class Main extends Application { super.init(); // Initializing variables - this.lineChartFunctionality = new LineChartFunctionality(); + LineChartFunctionality lineChartFunctionality = new LineChartFunctionality(); this.topBar = new BorderPane(); this.logoBar = new HBox(); this.sideBar = new VBox(); @@ -105,9 +96,9 @@ public class Main extends Application { // Create panes for root BorderPane root = new BorderPane(); - this.menuBar = createMenuBar(); - this.sideBar = createSideBar(); - this.logoBar = createLogoBar(); + this.menuBar = menuBar1.createMenuBar(); + this.sideBar = sideBar1.createSideBar(); + this.logoBar = logoBar1.createLogoBar(); LineChart<String, Number> lineChart = LineChartFunctionality.getLineChart(); @@ -117,7 +108,7 @@ public class Main extends Application { this.logoBar.setId("logoBar"); this.menuBar.setId("menuBar"); this.sideBar.setId("sideBar"); - this.bottomBar = createBottomBar(); + this.bottomBar = bottomBar1.createBottomBar(); this.bottomBar.setId("bottomBar"); lineChart.setId("lineChart"); @@ -152,306 +143,6 @@ public class Main extends Application { InputPopUpWindow.display(); } - /** - * Creates the menubar with buttons. - * Defines each action when button is clicked. - * - * @return MenuBar as a HBox - */ - private MenuBar createMenuBar() { - - // Creating a menubar - MenuBar menuBar = new MenuBar(); - - // Defining the individual menus - Menu menuFile = new Menu("File"); - Menu menuView = new Menu("View"); - Menu menuHelp = new Menu("Help"); - - MenuItem menuFileExit = new MenuItem("Exit"); - menuFileExit.setOnAction(event -> exitApplication()); - - setMenuViewLiveData(new CheckMenuItem ("Live Data")); - setMenuViewRegression(new CheckMenuItem ("Regression")); - setMenuViewRegressionShadow(new CheckMenuItem ("Regression Shadow")); - setMenuViewPreviousData(new CheckMenuItem ("Previous Data")); - - getMenuViewLiveData().setSelected(DEFAULT_IS_SELECTED_LIVE_DATA); - getMenuViewRegression().setSelected(DEFAULT_IS_SELECTED_REGRESSION); - getMenuViewRegressionShadow().setSelected(DEFAULT_IS_SELECTED_REGRESSION_SHADOW); - getMenuViewPreviousData().setSelected(DEFAULT_IS_SELECTED_PREVIOUS_DATA); - - getMenuViewLiveData().setOnAction(event -> { - if(getMenuViewLiveData().isSelected()){ - LineChartFunctionality.setPrintLiveData(true); - LineChartFunctionality.printGraphs(); - } else { - LineChartFunctionality.setPrintLiveData(false); - LineChartFunctionality.printGraphs(); - } - }); - getMenuViewRegression().setOnAction(event -> { - if(getMenuViewRegression().isSelected()){ - LineChartFunctionality.setPrintRegression(true); - LineChartFunctionality.printGraphs(); - } else { - LineChartFunctionality.setPrintRegression(false); - LineChartFunctionality.printGraphs(); - } - }); - getMenuViewRegressionShadow().setOnAction(event -> { - if(getMenuViewRegressionShadow().isSelected()){ - LineChartFunctionality.setPrintRegressionConfidenceInterval(true); - LineChartFunctionality.printGraphs(); - } else { - LineChartFunctionality.setPrintRegressionConfidenceInterval(false); - LineChartFunctionality.printGraphs(); - } - }); - getMenuViewPreviousData().setOnAction(event -> { - if(getMenuViewPreviousData().isSelected()){ - LineChartFunctionality.setPrintPreviousData(true); - LineChartFunctionality.printGraphs(); - } else { - LineChartFunctionality.setPrintPreviousData(false); - LineChartFunctionality.printGraphs(); - } - }); - - MenuItem aboutUs = new MenuItem("About Us"); - MenuItem help = new MenuItem("Help"); - - - - menuFile.getItems().addAll(menuFileExit); - menuView.getItems().addAll(getMenuViewLiveData(), getMenuViewRegression(), getMenuViewRegressionShadow(), getMenuViewPreviousData()); - menuHelp.getItems().addAll(aboutUs, help); - - // Adding the menus to the menubar - menuBar.getMenus().addAll(menuFile, menuView, menuHelp); - - // Returns the menubar - return menuBar; - } - - - - private VBox createSideBar(){ - - // Creating a vbox - VBox sideBarVBox = new VBox(); - - Label treeSpeciesLabel = new Label("Tree Species"); - treeSpeciesLabel.setId("sideBarLabelText"); - treeSpeciesText = new TextField(); - treeSpeciesText.setId("sideBarLabelText"); - treeSpeciesText.setPromptText("No Input"); - treeSpeciesText.setText(Constants.TREE_SPECIES); - treeSpeciesText.setEditable(false); - - Label dimensionsLabel = new Label("Width x Height"); - dimensionsLabel.setId("sideBarLabelText"); - dimensionsText = new TextField(); - dimensionsText.setId("sideBarLabelText"); - dimensionsText.setPromptText("No Input"); - dimensionsText.setText(Constants.DIMENSIONS); - dimensionsText.setEditable(false); - - Label sawsetLabel = new Label("Sawset"); - sawsetLabel.setId("sideBarLabelText"); - sawsetText = new TextField(); - sawsetText.setId("sideBarLabelText"); - sawsetText.setPromptText("No Input"); - sawsetText.setText(Constants.SAWSET); - sawsetText.setEditable(false); - - Label moistureGoalLabel = new Label("Moisture Goal"); - moistureGoalLabel.setId("sideBarLabelText"); - moistureGoalText = new TextField(); - moistureGoalText.setId("sideBarLabelText"); - moistureGoalText.setPromptText("No Input"); - moistureGoalText.setText(Constants.MOISTURE_GOAL); - moistureGoalText.setEditable(false); - - Label timeLeftLabel = new Label("Time Left"); - timeLeftLabel.setId("sideBarLabelText"); - timeLeftText = new TextField(); - timeLeftText.setId("sideBarLabelText"); - timeLeftText.setPromptText("Calculating..."); - timeLeftText.setText(Constants.TIME_LEFT); - timeLeftText.setEditable(false); - - Button inputParametersButton = new Button("Input Parameters"); - inputParametersButton.setId("sideBarButtonInputParameters"); - inputParametersButton.setOnAction(e -> InputPopUpWindow.display()); - - Button finishButton = new Button("Finish"); - finishButton.setId("sideBarButtonFinish"); - finishButton.setOnAction(e -> OutputPopUpWindow.displayOutputWindow()); - - Button exitButton = new Button("Exit"); - exitButton.setId("sideBarButtonExit"); - exitButton.setOnAction(e -> exitApplication()); - - - - // Creating the circular progressbar - RingProgressIndicator ringProgressIndicator = new RingProgressIndicator(); - ringProgressIndicator.setRingWidth(100); - ringProgressIndicator.makeIndeterminate(); - - class WorkerThread extends Thread{ - RingProgressIndicator rpi; - int progress = 0; - - public WorkerThread(RingProgressIndicator rpi){ - this.rpi = rpi; - } - - @Override - public void run() { - while (!Constants.IS_FINISHED) { - - try { - ringProgressIndicator.makeIndeterminate(); - Thread.sleep(500L * NUMBER_OF_SECONDS_LIVE_DATA); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - while (isLoadedData()) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - e.printStackTrace(); - Logger.getLogger(getClass().getName()).log(SEVERE, null, e); - } - Platform.runLater(() -> { - rpi.setProgress(progress); - }); - - progress = getLiveData().size()/ getDataPointsXAxis()*100; - - if (progress > 100) { - break; - } - } - } - } - } - - new WorkerThread(ringProgressIndicator).start(); - - - - sideBarVBox.getChildren().addAll(ringProgressIndicator, treeSpeciesLabel, treeSpeciesText, dimensionsLabel, dimensionsText, - sawsetLabel, sawsetText, moistureGoalLabel, moistureGoalText, timeLeftLabel, timeLeftText, inputParametersButton, finishButton, exitButton); - - VBox.setVgrow(sideBarVBox, Priority.ALWAYS); - - return sideBarVBox; - } - - - /** - * This function imports the logos and defines the alignments - * - * @return a logoBar containing the logos in proper alignments - * @throws FileNotFoundException - */ - private HBox createLogoBar() throws FileNotFoundException { - // Defining the image paths - Image moelvenLogoM = new Image(new FileInputStream("src/main/resources/com.application/GUI/moelven_logo_m.png")); - Image moelvenLogoTitle = new Image(new FileInputStream("src/main/resources/com.application/GUI/moelven_logo_title.png")); - - // Creating imageview objects - ImageView imageViewM = new ImageView(moelvenLogoM); - ImageView imageViewTitle = new ImageView(moelvenLogoTitle); - - // Defining resolution and aspect ratio - imageViewM.setFitHeight(100); - imageViewM.setPreserveRatio(true); - imageViewTitle.setFitHeight(100); - imageViewTitle.setPreserveRatio(true); - - // Defining alignments - Region region1 = new Region(); - HBox.setHgrow(region1, Priority.ALWAYS); - - Region region2 = new Region(); - HBox.setHgrow(region2, Priority.ALWAYS); - - return new HBox(imageViewM, region1, imageViewTitle, region2); - } - - private HBox createBottomBar(){ - HBox hBox = new HBox(); - - Label liveDataText = new Label("View Live Data"); - setLiveDataBox(new CheckBox()); - getLiveDataBox().setSelected(DEFAULT_IS_SELECTED_LIVE_DATA); - getLiveDataBox().setOnAction(event -> { - if(getLiveDataBox().isSelected()){ - LineChartFunctionality.setPrintLiveData(true); - LineChartFunctionality.printGraphs(); - - } else { - LineChartFunctionality.setPrintLiveData(false); - LineChartFunctionality.printGraphs(); - } - }); - - Label regressionText = new Label("View Regression"); - setRegressionBox(new CheckBox()); - getRegressionBox().setSelected(DEFAULT_IS_SELECTED_REGRESSION); - getRegressionBox().setOnAction(event -> { - if(getRegressionBox().isSelected()){ - LineChartFunctionality.setPrintRegression(true); - LineChartFunctionality.printGraphs(); - - } else { - LineChartFunctionality.setPrintRegression(false); - LineChartFunctionality.printGraphs(); - } - }); - - Label regressionConfidenceIntervalText = new Label("View Regression Shadow"); - setRegressionConfidenceIntervalBox(new CheckBox()); - getRegressionConfidenceIntervalBox().setSelected(DEFAULT_IS_SELECTED_REGRESSION_SHADOW); - getRegressionConfidenceIntervalBox().setOnAction(event -> { - if(getRegressionConfidenceIntervalBox().isSelected()){ - LineChartFunctionality.setPrintRegressionConfidenceInterval(true); - LineChartFunctionality.printGraphs(); - } else { - LineChartFunctionality.setPrintRegressionConfidenceInterval(false); - LineChartFunctionality.printGraphs(); - } - }); - - Label previousText = new Label("View Previous Data"); - setPreviousBox(new CheckBox()); - getPreviousBox().setSelected(DEFAULT_IS_SELECTED_PREVIOUS_DATA); - getPreviousBox().setOnAction(event -> { - if(getPreviousBox().isSelected()){ - LineChartFunctionality.setPrintPreviousData(true); - LineChartFunctionality.printGraphs(); - } else { - LineChartFunctionality.setPrintPreviousData(false); - LineChartFunctionality.printGraphs(); - } - }); - - - hBox.getChildren().addAll(liveDataText, liveDataBox, regressionText, regressionBox, regressionConfidenceIntervalText, regressionConfidenceIntervalBox, previousText, previousBox); - hBox.setAlignment(Pos.CENTER_RIGHT); - hBox.setSpacing(5); - - return hBox; - } - - - - public static void setTreeSpeciesText(String treeSpeciesText) { Main.treeSpeciesText.setText(treeSpeciesText); } @@ -472,10 +163,6 @@ public class Main extends Application { Main.timeLeftText.setText(moistureGoalText); } - public LineChartFunctionality getLineChartFunctionality() { - return lineChartFunctionality; - } - public static CheckMenuItem getMenuViewLiveData() { return menuViewLiveData; } @@ -497,7 +184,7 @@ public class Main extends Application { } public void setMenuViewRegressionShadow(CheckMenuItem menuViewRegressionShadow) { - this.menuViewRegressionShadow = menuViewRegressionShadow; + Main.menuViewRegressionShadow = menuViewRegressionShadow; } public static CheckMenuItem getMenuViewPreviousData() { @@ -539,6 +226,46 @@ public class Main extends Application { public void setPreviousBox(CheckBox previousBox) { Main.previousBox = previousBox; } + + public static TextField getTreeSpeciesText() { + return treeSpeciesText; + } + + public static void setTreeSpeciesText(TextField treeSpeciesText) { + Main.treeSpeciesText = treeSpeciesText; + } + + public static TextField getDimensionsText() { + return dimensionsText; + } + + public static void setDimensionsText(TextField dimensionsText) { + Main.dimensionsText = dimensionsText; + } + + public static TextField getSawsetText() { + return sawsetText; + } + + public static void setSawsetText(TextField sawsetText) { + Main.sawsetText = sawsetText; + } + + public static TextField getMoistureGoalText() { + return moistureGoalText; + } + + public static void setMoistureGoalText(TextField moistureGoalText) { + Main.moistureGoalText = moistureGoalText; + } + + public static TextField getTimeLeftText() { + return timeLeftText; + } + + public static void setTimeLeftText(TextField timeLeftText) { + Main.timeLeftText = timeLeftText; + } } diff --git a/target/classes/com.application/sf-drying-optimization-1e234ad2b0f4.json b/target/classes/com.application/sf-drying-optimization-1e234ad2b0f4.json deleted file mode 100644 index 944459294ab7f3712fa6454b5ad78b677bf2b191..0000000000000000000000000000000000000000 --- a/target/classes/com.application/sf-drying-optimization-1e234ad2b0f4.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "service_account", - "project_id": "sf-drying-optimization", - "private_key_id": "1e234ad2b0f42caff46c54993f72e6ed7a6e47f5", - "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC9uUivxQCvsUYW\nM2GCJaioM4/KdHIhkgbtGFKtYacQcvJaE1z9RsgTBThWAYXblkigptJ9pCOPIpFR\naqDGujua7+bEm37eQ8pEAPiiSHqNWaevzSjS9OZ8vLD+0AdDy17HuL1KjnR6vJi6\nBRfVfvu3DtzxJbsUutxTwjDTUIZqg6QLeRja0sfa5r1lbqJ6o/uK99fYi3cuW9XW\nbK5czMROw+lNeVU9S2B/5EfezeD+Qtt0hPL6IVdz5oCtbQY9Sj/C+N+tyjPYYXKG\neEZhfvVZOmilIyTupXH+5CJfezxYP6Weg0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OVKF\n0P1f6B2x0W6nJBoSpfqfD0IDj5iclJUzIYPjcK4eYwKBgFfUiZhVj4cWPb1k2MJf\nXC0LBmFgqiW9w4rXfyEXtRSRbO4661TvVHw66SF09hwzz/+MW2R7HLi1IWZNyRF3\nXw39WtI8bmUsLTJbH6gshanmu8cSPLBt82WlRd6gS+SMxyZ65wY/kt9adfIolefm\nICsfIETnkHRpwF3RurchKfjk\n-----END PRIVATE KEY-----\n", - "client_email": "svc-students-sf-drying-opt@sf-drying-optimization.iam.gserviceaccount.com", - "client_id": "106308201919438112497", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/svc-students-sf-drying-opt%40sf-drying-optimization.iam.gserviceaccount.com" -} diff --git a/target/classes/com.application/sf-drying-optimization-8a2e1b7ffc14.json b/target/classes/com.application/sf-drying-optimization-8a2e1b7ffc14.json new file mode 100644 index 0000000000000000000000000000000000000000..0f9622049477f3789f0e26da2f1039050d99a81a --- /dev/null +++ b/target/classes/com.application/sf-drying-optimization-8a2e1b7ffc14.json @@ -0,0 +1,12 @@ +{ + "type": "service_account", + "project_id": "sf-drying-optimization", + "private_key_id": "8a2e1b7ffc14999d4795f6986b032b390c7330cc", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCv7DxYcTWV+nEW\nE4q5ckKAu2oQ6z669IYTSzrR7SQ17BCEwaMzLGEDJL1xWjJnNUknu4VKuYu0rUIk\npvJPt/m/OZStCBAbP6uPRQDY+dF34+P50Tts6e3YTD7AiZ4mYFDTkmHn00lFtKCn\nQxOtcmIKonRmBJN3r5izpVN8rX9dyiqi8KwsQQ1dEWclsr6uSUZZbGTbqLHBxJRo\ninAwDlSQTp3B1sh7ujxW3x3osFyqRdpVB1Ba2zvA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qzRyF6y\nDVlcLKrUzpqtgsd4fShME1k41o0xYzp6dfVwIul8TV4VGLTkD+xfQYLww2Su57Lc\nbzWCt1SbUnRVWcejwaYPmw3h31o21sFc7ErS+80CgYEAlkJK/datMd2DjUl7xXSx\nN85xxs5mpKRvJXW7CA/eiBtbb4mg1WHMtWx78Er88Kb7+DVKpYailpyxHNsCwfJi\nGv4GCzNPUA7xcBfL/oDt5dj1z6TPyjLfyuLGP6nyCl8jhfNLbYPpzW0jE16ivGOQ\np6zpS3AFMThDcIdV35MMQ9M=\n-----END PRIVATE KEY-----\n", + "client_email": "svc-students-sf-drying-opt@sf-drying-optimization.iam.gserviceaccount.com", + "client_id": "106308201919438112497", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/svc-students-sf-drying-opt%40sf-drying-optimization.iam.gserviceaccount.com" +} diff --git a/target/classes/com/application/DB/Constants.class b/target/classes/com/application/DB/Constants.class index 501917412f2c4c5a9a647aa4b881d3dfe95fca6c..26210281ae400661b01ed5042905c7a853142fb2 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/HelpingFunctions.class b/target/classes/com/application/DB/HelpingFunctions.class index 41894bfa944331ce4e1a3bf49468d8b843ca897e..7166717be98c08b21717c8005665d8fe9bd7c817 100644 Binary files a/target/classes/com/application/DB/HelpingFunctions.class and b/target/classes/com/application/DB/HelpingFunctions.class differ diff --git a/target/classes/com/application/GUI/Panes/BottomBar.class b/target/classes/com/application/GUI/Panes/BottomBar.class new file mode 100644 index 0000000000000000000000000000000000000000..12ce86ef6278f3b1a3a17d788f51dd8d0ac0ae24 Binary files /dev/null and b/target/classes/com/application/GUI/Panes/BottomBar.class differ diff --git a/target/classes/com/application/GUI/Panes/LogoBar.class b/target/classes/com/application/GUI/Panes/LogoBar.class new file mode 100644 index 0000000000000000000000000000000000000000..cb180a3b27155aecbea2709a056ca51aa590cb8e Binary files /dev/null and b/target/classes/com/application/GUI/Panes/LogoBar.class differ diff --git a/target/classes/com/application/GUI/Panes/MenuBar.class b/target/classes/com/application/GUI/Panes/MenuBar.class new file mode 100644 index 0000000000000000000000000000000000000000..f0739d79edee37306f75f45a673629ca1af4f02c Binary files /dev/null and b/target/classes/com/application/GUI/Panes/MenuBar.class differ diff --git a/target/classes/com/application/GUI/Panes/SideBar$1WorkerThread.class b/target/classes/com/application/GUI/Panes/SideBar$1WorkerThread.class new file mode 100644 index 0000000000000000000000000000000000000000..450d307b1d6f8b2a24b00f5799befaf2063a31bd Binary files /dev/null and b/target/classes/com/application/GUI/Panes/SideBar$1WorkerThread.class differ diff --git a/target/classes/com/application/GUI/Panes/SideBar.class b/target/classes/com/application/GUI/Panes/SideBar.class new file mode 100644 index 0000000000000000000000000000000000000000..f7ae4740731e37590f720ae00bef3fe68a0ffe60 Binary files /dev/null and b/target/classes/com/application/GUI/Panes/SideBar.class differ diff --git a/target/classes/com/application/Main$1WorkerThread.class b/target/classes/com/application/Main$1WorkerThread.class deleted file mode 100644 index e8a9cd2292906aca53dcf7b6dd6e26aeed5ad998..0000000000000000000000000000000000000000 Binary files a/target/classes/com/application/Main$1WorkerThread.class and /dev/null differ diff --git a/target/classes/com/application/Main.class b/target/classes/com/application/Main.class index 0e74a2edc3fd289b455a1b7f5b90599afb638e2a..ee3d701f0d6550698d1ac30cfa88421ea7d442ce 100644 Binary files a/target/classes/com/application/Main.class and b/target/classes/com/application/Main.class differ