Newer
Older
package com.application;
import com.application.GUI.PopUpWindows.InputPopup;
Eilert Tunheim
committed
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.scene.chart.LineChart;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* This class launches the application
*
* @author Eilert Tunheim, Karin Pettersen, Mads Arnesen
* @version 1.0.0
*/
public class Main extends Application {
Eilert Tunheim
committed
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;
private VBox sideBar;
private MenuBar menuBar;
private HBox bottomBar;
Eilert Tunheim
committed
private static TextField treeSpeciesText;
private static TextField dimensionsText;
private static TextField sawsetText;
private static TextField moistureGoalText;
Eilert Tunheim
committed
private static CheckMenuItem menuViewLiveData;
private static CheckMenuItem menuViewRegression;
private static CheckMenuItem menuViewRegressionShadow;
private static CheckMenuItem menuViewPreviousData;
private static CheckBox liveDataBox;
private static CheckBox regressionBox;
private static CheckBox regressionConfidenceIntervalBox;
private static CheckBox previousBox;
/**
* Starts the application
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
launch(args);
}
public static void exitApplication(){
Platform.exit();
System.exit(0);
}
/**
* Initializes the application with all the different panes.
*
* @throws Exception Exception in super.
*/
@Override
public void init() throws Exception {
super.init();
// Initializing variables
Eilert Tunheim
committed
LineChartFunctionality lineChartFunctionality = new LineChartFunctionality();
this.topBar = new BorderPane();
this.logoBar = new HBox();
this.sideBar = new VBox();
this.menuBar = new MenuBar();
this.bottomBar = new HBox();
}
* Sets the primaryStage and sets the scene for the window.
* @param primaryStage
* @throws Exception
*/
@Override
public void start(Stage primaryStage) throws Exception {
// Create panes for root
BorderPane root = new BorderPane();
Eilert Tunheim
committed
this.menuBar = menuBar1.createMenuBar();
this.sideBar = sideBar1.createSideBar();
this.logoBar = logoBar1.createLogoBar();
LineChart<String, Number> lineChart = LineChartFunctionality.getLineChart();
//Set id's to connect to css stylesheet
root.setId("root");
this.logoBar.setId("logoBar");
this.menuBar.setId("menuBar");
this.sideBar.setId("sideBar");
Eilert Tunheim
committed
this.bottomBar = bottomBar1.createBottomBar();
this.bottomBar.setId("bottomBar");
lineChart.setId("lineChart");
// Sett the menubar in a vbox inorder to stretch over the whole screen
VBox vBox = new VBox(this.menuBar);
// Sets alignment for the topBar
this.topBar.setTop(vBox);
this.topBar.setCenter(logoBar);
// Sets alignment for the panes to the parent root
root.setTop(this.topBar);
root.setLeft(this.sideBar);
root.setCenter(lineChart);
root.setBottom(this.bottomBar);
VBox.setVgrow(this.logoBar, Priority.ALWAYS);
// Sets the scene and defines boundaries
Scene scene = new Scene(root, 1200, 600);
scene.getStylesheets().add(getClass().getResource("/com.application/CSS/styleSheet.css").toExternalForm());
primaryStage.setTitle("Moelven Drying Application");
primaryStage.setMaximized(true);
primaryStage.setMinHeight(600);
primaryStage.setMinWidth(1200);
primaryStage.setScene(scene);
primaryStage.show();
// Displays the input parameters popup window
InputPopup.display();
Eilert Tunheim
committed
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);
}
public static void setTimeLeftText(String moistureGoalText) {
Main.timeLeftText.setText(moistureGoalText);
}
public static CheckMenuItem getMenuViewLiveData() {
return menuViewLiveData;
}
public static void setMenuViewLiveData(CheckMenuItem menuViewLiveData) {
Main.menuViewLiveData = menuViewLiveData;
}
public static CheckMenuItem getMenuViewRegression() {
return menuViewRegression;
}
public void setMenuViewRegression(CheckMenuItem menuViewRegression) {
Main.menuViewRegression = menuViewRegression;
}
public static CheckMenuItem getMenuViewRegressionShadow() {
return menuViewRegressionShadow;
}
public void setMenuViewRegressionShadow(CheckMenuItem menuViewRegressionShadow) {
Eilert Tunheim
committed
Main.menuViewRegressionShadow = menuViewRegressionShadow;
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
}
public static CheckMenuItem getMenuViewPreviousData() {
return menuViewPreviousData;
}
public void setMenuViewPreviousData(CheckMenuItem menuViewPreviousData) {
Main.menuViewPreviousData = menuViewPreviousData;
}
public static CheckBox getLiveDataBox() {
return liveDataBox;
}
public void setLiveDataBox(CheckBox liveDataBox) {
Main.liveDataBox = liveDataBox;
}
public static CheckBox getRegressionBox() {
return regressionBox;
}
public void setRegressionBox(CheckBox regressionBox) {
Main.regressionBox = regressionBox;
}
public static CheckBox getRegressionConfidenceIntervalBox() {
return regressionConfidenceIntervalBox;
}
public void setRegressionConfidenceIntervalBox(CheckBox regressionConfidenceIntervalBox) {
Main.regressionConfidenceIntervalBox = regressionConfidenceIntervalBox;
}
public static CheckBox getPreviousBox() {
return previousBox;
}
public void setPreviousBox(CheckBox previousBox) {
Main.previousBox = previousBox;
}
Eilert Tunheim
committed
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
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;
}