diff --git a/src/main/java/com/application/DB/Settings.java b/src/main/java/com/application/DB/Settings.java index 97335ce6fba319be2035a4659b4fde2977d4f7dd..2ffbc38fe480b2ce6e3a5cef9990ea93c821ae42 100644 --- a/src/main/java/com/application/DB/Settings.java +++ b/src/main/java/com/application/DB/Settings.java @@ -5,7 +5,10 @@ import java.util.Arrays; import java.util.HashMap; /** - * This class contains constants to be used related to database activities + * This class contains changeable settings for the application + * + * @author Eilert Tunheim, Karin Pettersen, Mads Arnesen + * @version 1.0.0 */ public final class Settings { diff --git a/src/main/java/com/application/GUI/Panes/CreateBottomBar.java b/src/main/java/com/application/GUI/Panes/CreateBottomBar.java index 70fd9122dc4f2062e39c19bb8fecce2277fc599a..3cc701701c9bb56dd60e76bfb9698ba7c1404587 100644 --- a/src/main/java/com/application/GUI/Panes/CreateBottomBar.java +++ b/src/main/java/com/application/GUI/Panes/CreateBottomBar.java @@ -8,6 +8,12 @@ import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.layout.HBox; +/** + * This class creates the bottombar + * + * @author Eilert Tunheim, Karin Pettersen, Mads Arnesen + * @version 1.0.0 + */ public class CreateBottomBar { private final Main main; @@ -15,6 +21,11 @@ public class CreateBottomBar { this.main = main; } + /** + * This function create the bottombar + * + * @return the finished bottombar + */ public HBox createBottomBar() { HBox hBox = new HBox(); @@ -72,7 +83,7 @@ public class CreateBottomBar { } }); - + // Adds all the components to the HBox hBox.getChildren().addAll(liveDataText, Main.getLiveDataBox(), regressionText, Main.getRegressionBox(), regressionConfidenceIntervalText, Main.getRegressionConfidenceIntervalBox(), previousText, Main.getPreviousBox()); hBox.setAlignment(Pos.CENTER_RIGHT); hBox.setSpacing(5); diff --git a/src/main/java/com/application/GUI/Panes/CreateLogoBar.java b/src/main/java/com/application/GUI/Panes/CreateLogoBar.java index 62f71ec777d0fbe4bfcbc3b07af9d87436d7448e..bf91fd121391e9ab02f1c37a073f007acf3d055f 100644 --- a/src/main/java/com/application/GUI/Panes/CreateLogoBar.java +++ b/src/main/java/com/application/GUI/Panes/CreateLogoBar.java @@ -13,15 +13,22 @@ import java.io.FileNotFoundException; import static com.application.DB.HelpingFunctions.isIsAdmin; +/** + * This class creates the logobar + * + * @author Eilert Tunheim, Karin Pettersen, Mads Arnesen + * @version 1.0.0 + */ public class CreateLogoBar { + // The login button private static Button login = new Button("Login"); /** * This function imports the logos and defines the alignments * * @return a logoBar containing the logos in proper alignments - * @throws FileNotFoundException + * @throws FileNotFoundException throws exception if an error occurs */ public HBox createLogoBar() throws FileNotFoundException { // Defining the image paths diff --git a/src/main/java/com/application/GUI/Panes/CreateMenuBar.java b/src/main/java/com/application/GUI/Panes/CreateMenuBar.java index b5467ef0cacc5f60b8cb5d244ce817a642038622..4e27791d2015ec01a1cea9ff89335c4b27a7c187 100644 --- a/src/main/java/com/application/GUI/Panes/CreateMenuBar.java +++ b/src/main/java/com/application/GUI/Panes/CreateMenuBar.java @@ -8,6 +8,12 @@ import javafx.scene.control.CheckMenuItem; import javafx.scene.control.Menu; import javafx.scene.control.MenuItem; +/** + * This class creates the menubar + * + * @author Eilert Tunheim, Karin Pettersen, Mads Arnesen + * @version 1.0.0 + */ public class CreateMenuBar { private final Main main; @@ -19,7 +25,7 @@ public class CreateMenuBar { * Creates the menubar with buttons. * Defines each action when button is clicked. * - * @return MenuBar as a HBox + * @return MenuBar as a menubar */ public javafx.scene.control.MenuBar createMenuBar() { @@ -31,19 +37,23 @@ public class CreateMenuBar { Menu menuView = new Menu("View"); Menu menuHelp = new Menu("Help"); + // Adds menu item for file MenuItem menuFileExit = new MenuItem("Exit"); menuFileExit.setOnAction(event -> Main.exitApplication()); + // Adds menu item for view Main.setMenuViewLiveData(new CheckMenuItem("Live Data")); main.setMenuViewRegression(new CheckMenuItem("Regression")); main.setMenuViewRegressionShadow(new CheckMenuItem("Regression Shadow")); main.setMenuViewPreviousData(new CheckMenuItem("Previous Data")); + // Sets the default values 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); + // Sets the updated value when the box is checked or unchecked Main.getMenuViewLiveData().setOnAction(event -> { if (Main.getMenuViewLiveData().isSelected()) { LineChartFunctionality.setPrintLiveData(true); @@ -53,6 +63,8 @@ public class CreateMenuBar { LineChartFunctionality.printGraphs(); } }); + + // Sets the updated value when the box is checked or unchecked Main.getMenuViewRegression().setOnAction(event -> { if (Main.getMenuViewRegression().isSelected()) { LineChartFunctionality.setPrintRegression(true); @@ -62,6 +74,8 @@ public class CreateMenuBar { LineChartFunctionality.printGraphs(); } }); + + // Sets the updated value when the box is checked or unchecked Main.getMenuViewRegressionShadow().setOnAction(event -> { if (Main.getMenuViewRegressionShadow().isSelected()) { LineChartFunctionality.setPrintRegressionConfidenceInterval(true); @@ -71,6 +85,8 @@ public class CreateMenuBar { LineChartFunctionality.printGraphs(); } }); + + // Sets the updated value when the box is checked or unchecked Main.getMenuViewPreviousData().setOnAction(event -> { if (Main.getMenuViewPreviousData().isSelected()) { LineChartFunctionality.setPrintPreviousData(true); @@ -81,12 +97,13 @@ public class CreateMenuBar { } }); + // Adds menu item for Help MenuItem aboutUs = new MenuItem("About Us"); aboutUs.setOnAction(event -> getAboutUs()); MenuItem help = new MenuItem("Help"); help.setOnAction(event -> getHelp()); - + // Adds all components to the menus menuFile.getItems().addAll(menuFileExit); menuView.getItems().addAll(Main.getMenuViewLiveData(), Main.getMenuViewRegression(), Main.getMenuViewRegressionShadow(), Main.getMenuViewPreviousData()); menuHelp.getItems().addAll(aboutUs, help); diff --git a/src/main/java/com/application/GUI/Panes/CreateSideBar.java b/src/main/java/com/application/GUI/Panes/CreateSideBar.java index e163cf760fdec168e9e18e749c4b0ecc46040ba6..88b4770c33165259af15ec1fa891997d9b1ab2f8 100644 --- a/src/main/java/com/application/GUI/Panes/CreateSideBar.java +++ b/src/main/java/com/application/GUI/Panes/CreateSideBar.java @@ -20,16 +20,28 @@ import static com.application.GUI.LineChartFunctionality.getDataPointsXAxis; import static com.application.GUI.LineChartFunctionality.getLiveData; import static java.util.logging.Level.SEVERE; +/** + * This class creates the sidebar + * + * @author Eilert Tunheim, Karin Pettersen, Mads Arnesen + * @version 1.0.0 + */ public class CreateSideBar { public CreateSideBar(Main main) { } + /** + * This function creates the sidebar + * + * @return the finished sidebar + */ public VBox createSideBar() { // Creating a vbox VBox sideBarVBox = new VBox(); + // Defining label and text-field for tree species Label treeSpeciesLabel = new Label("Tree Species"); treeSpeciesLabel.setId("sideBarLabelText"); Main.setTreeSpeciesText(new TextField()); @@ -38,6 +50,7 @@ public class CreateSideBar { Main.getTreeSpeciesText().setText(Constants.TREE_SPECIES); Main.getTreeSpeciesText().setEditable(false); + // Defining label and text-field for dimensions Label dimensionsLabel = new Label("Width x Height"); dimensionsLabel.setId("sideBarLabelText"); Main.setDimensionsText(new TextField()); @@ -46,6 +59,7 @@ public class CreateSideBar { Main.getDimensionsText().setText(Constants.DIMENSIONS); Main.getDimensionsText().setEditable(false); + // Defining label and text-field for sawset Label sawsetLabel = new Label("Sawset"); sawsetLabel.setId("sideBarLabelText"); Main.setSawsetText(new TextField()); @@ -54,6 +68,7 @@ public class CreateSideBar { Main.getSawsetText().setText(Constants.SAWSET); Main.getSawsetText().setEditable(false); + // Defining label and text-field for moisture goal Label moistureGoalLabel = new Label("Moisture Goal"); moistureGoalLabel.setId("sideBarLabelText"); Main.setMoistureGoalText(new TextField()); @@ -62,6 +77,7 @@ public class CreateSideBar { Main.getMoistureGoalText().setText(Constants.MOISTURE_GOAL); Main.getMoistureGoalText().setEditable(false); + // Defining label and text-field timeleft Label timeLeftLabel = new Label("Time Left"); timeLeftLabel.setId("sideBarLabelText"); Main.setTimeLeftText(new TextField()); @@ -70,6 +86,7 @@ public class CreateSideBar { Main.getTimeLeftText().setText(Constants.TIME_LEFT); Main.getTimeLeftText().setEditable(false); + // Define buttons Button inputParametersButton = new Button("Input Parameters"); inputParametersButton.setId("sideBarButtonInputParameters"); inputParametersButton.setOnAction(e -> InputPopup.display()); @@ -89,6 +106,7 @@ public class CreateSideBar { ringProgressIndicator.makeIndeterminate(); ringProgressIndicator.setId("progressBar"); + // Defines thread for updating the circular progressbar class WorkerThread extends Thread{ RingProgressIndicator rpi; int progress = 0; @@ -126,10 +144,9 @@ public class CreateSideBar { } } } - new WorkerThread(ringProgressIndicator).start(); - + // Adds all the components to the VBox sideBarVBox.getChildren().addAll(ringProgressIndicator, treeSpeciesLabel, Main.getTreeSpeciesText(), dimensionsLabel, Main.getDimensionsText(), sawsetLabel, Main.getSawsetText(), moistureGoalLabel, Main.getMoistureGoalText(), timeLeftLabel, Main.getTimeLeftText(), inputParametersButton, finishButton, exitButton);