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

commented all bar classes

parent d2ebd07b
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
......@@ -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);
......
......@@ -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
......
......@@ -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);
......
......@@ -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);
......
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