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

Redesigned the menubar and added labels and textfields to the sidebar

parent 83574509
No related branches found
No related tags found
No related merge requests found
...@@ -114,7 +114,7 @@ public class DB { ...@@ -114,7 +114,7 @@ public class DB {
final String sqlStatement = "SELECT TimeStamp, VariantValue " + final String sqlStatement = "SELECT TimeStamp, VariantValue " +
"FROM sf-drying-optimization.124.int_sd_winccsensordata " + "FROM sf-drying-optimization.124.int_sd_winccsensordata " +
"WHERE TimeStamp BETWEEN \"2021-01-25 08:51:03\" " + "WHERE TimeStamp BETWEEN \"2021-01-25 08:51:03\" " +
"AND \"2021-03-08 11:10:09\" ORDER BY TimeStamp ASC"; "AND \"2021-02-08 11:10:09\" ORDER BY TimeStamp ASC";
// Creates a job configuration // Creates a job configuration
queryJob = getJob(QueryJobConfiguration.newBuilder(sqlStatement).build()); queryJob = getJob(QueryJobConfiguration.newBuilder(sqlStatement).build());
...@@ -140,7 +140,7 @@ public class DB { ...@@ -140,7 +140,7 @@ public class DB {
data.put(formatedTimeStamp, variantValue); data.put(formatedTimeStamp, variantValue);
} }
/*
NavigableMap<String, Number> sortedData = new TreeMap<>(data); NavigableMap<String, Number> sortedData = new TreeMap<>(data);
for (Map.Entry<String, Number> entry : sortedData.entrySet()) { for (Map.Entry<String, Number> entry : sortedData.entrySet()) {
...@@ -151,6 +151,8 @@ public class DB { ...@@ -151,6 +151,8 @@ public class DB {
System.out.println("Neste: "+next); System.out.println("Neste: "+next);
} }
*/
return data; return data;
} }
...@@ -197,7 +199,7 @@ public class DB { ...@@ -197,7 +199,7 @@ public class DB {
String formattedCalculatedStop = dateFormat.format(calculatedStop); String formattedCalculatedStop = dateFormat.format(calculatedStop);
java.sql.Timestamp timestamp = new Timestamp(calculatedStart); java.sql.Timestamp timestamp = new Timestamp(calculatedStart);
System.out.println(timestamp); //System.out.println(timestamp);
//System.out.printf("%s\t\t\t%s\t\t\t%s\n",name, formattedCalculatedStart, formattedCalculatedStop); //System.out.printf("%s\t\t\t%s\t\t\t%s\n",name, formattedCalculatedStart, formattedCalculatedStop);
......
...@@ -3,10 +3,9 @@ package com.application; ...@@ -3,10 +3,9 @@ package com.application;
import com.application.DB.DB; import com.application.DB.DB;
import javafx.application.Application; import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.chart.LineChart; import javafx.scene.chart.LineChart;
import javafx.scene.control.MenuBar; import javafx.scene.control.*;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.*; import javafx.scene.layout.*;
...@@ -30,11 +29,10 @@ import java.util.*; ...@@ -30,11 +29,10 @@ import java.util.*;
public class Main extends Application { public class Main extends Application {
private BorderPane topBar; private BorderPane topBar;
private HBox menuBar;
private HBox logoBar; private HBox logoBar;
private VBox sideBar; private VBox sideBar;
private LineChart<String, Number> lineChart; private LineChart<String, Number> lineChart;
private MenuBar menubar2; private MenuBar menuBar;
/** /**
* Starts the application * Starts the application
...@@ -56,10 +54,9 @@ public class Main extends Application { ...@@ -56,10 +54,9 @@ public class Main extends Application {
// Initializing variables // Initializing variables
this.topBar = new BorderPane(); this.topBar = new BorderPane();
this.menuBar = new HBox();
this.logoBar = new HBox(); this.logoBar = new HBox();
this.sideBar = new VBox(); this.sideBar = new VBox();
this.menubar2 = new MenuBar(); this.menuBar = new MenuBar();
} }
/** /**
...@@ -74,6 +71,7 @@ public class Main extends Application { ...@@ -74,6 +71,7 @@ public class Main extends Application {
// Create panes for root // Create panes for root
BorderPane root = new BorderPane(); BorderPane root = new BorderPane();
this.menuBar = createMenuBar(); this.menuBar = createMenuBar();
this.sideBar = createSideBar();
this.logoBar = createLogoBar(); this.logoBar = createLogoBar();
this.lineChart = createLineChart(); this.lineChart = createLineChart();
...@@ -84,8 +82,11 @@ public class Main extends Application { ...@@ -84,8 +82,11 @@ public class Main extends Application {
this.sideBar.setId("sideBar"); this.sideBar.setId("sideBar");
this.lineChart.setId("lineChart"); this.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 // Sets alignment for the topBar
this.topBar.setTop(menuBar); this.topBar.setTop(vBox);
this.topBar.setCenter(logoBar); this.topBar.setCenter(logoBar);
// Sets alignment for the panes to the parent root // Sets alignment for the panes to the parent root
...@@ -95,8 +96,8 @@ public class Main extends Application { ...@@ -95,8 +96,8 @@ public class Main extends Application {
VBox.setVgrow(this.logoBar, Priority.ALWAYS); VBox.setVgrow(this.logoBar, Priority.ALWAYS);
DB.getName(); //DB.getName();
System.out.println(DB.getKwh()); //System.out.println(DB.getKwh());
// Sets the scene and defines boundaries // Sets the scene and defines boundaries
//Scene scene = new Scene(root, 1200, 600); //Scene scene = new Scene(root, 1200, 600);
...@@ -117,42 +118,71 @@ public class Main extends Application { ...@@ -117,42 +118,71 @@ public class Main extends Application {
* *
* @return MenuBar as a HBox * @return MenuBar as a HBox
*/ */
private HBox createMenuBar() { private MenuBar createMenuBar() {
// Creating buttons for menubar
ToggleGroup btnMenuGroup = new ToggleGroup(); // Creating a menubar
ToggleButton btnMenuHome = new ToggleButton("Home"); MenuBar menuBar = new MenuBar();
ToggleButton btnMenuInput = new ToggleButton("Input");
ToggleButton btnMenuFinish = new ToggleButton("Finish"); // Defining the individual menus
ToggleButton btnMenuHelp = new ToggleButton("Help"); Menu menuFile = new Menu("File");
Menu menuEdit = new Menu("Edit");
Menu menuHelp = new Menu("Help");
// Set the buttons toggleable
btnMenuHome.setToggleGroup(btnMenuGroup); // Adding the menus to the menubar
btnMenuInput.setToggleGroup(btnMenuGroup); menuBar.getMenus().add(menuFile);
btnMenuFinish.setToggleGroup(btnMenuGroup); menuBar.getMenus().add(menuEdit);
btnMenuHelp.setToggleGroup(btnMenuGroup); menuBar.getMenus().add(menuHelp);
// Set the home button as default selected // Returns the menubar
btnMenuHome.setSelected(true);
//Make sure always one button is selected
btnMenuGroup.selectedToggleProperty().addListener((obsVal, oldVal, newVal) -> {
if (newVal == null)
oldVal.setSelected(true);
});
/*
btnMenuMetaImage.setOnAction(e -> featurePane.loadMetaImage());
btnMenuImport.setOnAction(e -> featurePane.loadImport());
btnMenuCreate.setOnAction(e -> featurePane.loadCreate());
btnMenuSearch.setOnAction(e -> featurePane.loadSearch());
*/
menuBar.getChildren().addAll(btnMenuHome, btnMenuInput, btnMenuFinish, btnMenuHelp);
return menuBar; return menuBar;
} }
private VBox createSideBar(){
// Creating a vbox
VBox sideBarVBox = new VBox();
//sideBarVBox.prefHeight(500);
Label treeSpeciesLabel = new Label("Tree Species");
treeSpeciesLabel.setId("sideBarLabelText");
TextField treeSpeciesText = new TextField();
treeSpeciesText.setId("sideBarLabelText");
treeSpeciesText.setPromptText("Bjørk");
Label dimensionsLabel = new Label("Width x Height");
dimensionsLabel.setId("sideBarLabelText");
TextField dimensionsText = new TextField();
dimensionsText.setId("sideBarLabelText");
dimensionsText.setPromptText("47 x 150");
Label sawsetLabel = new Label("Sawset");
sawsetLabel.setId("sideBarLabelText");
TextField sawsetText = new TextField();
sawsetText.setId("sideBarLabelText");
sawsetText.setPromptText("4x");
Label moistureGoalLabel = new Label("Moisture Goal");
moistureGoalLabel.setId("sideBarLabelText");
TextField moistureGoalText = new TextField();
moistureGoalText.setId("sideBarLabelText");
moistureGoalText.setPromptText("12%");
Button finish = new Button("Finish");
finish.setTranslateX(5);
sideBarVBox.getChildren().addAll(treeSpeciesLabel, treeSpeciesText, dimensionsLabel, dimensionsText, sawsetLabel, sawsetText, moistureGoalLabel, moistureGoalText, finish);
VBox.setVgrow(sideBarVBox, Priority.ALWAYS);
return sideBarVBox;
}
/** /**
* This function imports the logos and defines the alignments * This function imports the logos and defines the alignments
* *
......
...@@ -17,7 +17,26 @@ ...@@ -17,7 +17,26 @@
} }
#sideBar { #sideBar {
-fx-pref-width: 300; -fx-pref-width: 250;
}
#sideBarLabel {
-fx-pref-height: 17;
-fx-translate-x: 10;
-fx-max-height: infinity;
-fx-max-width: infinity;
/*-fx-alignment: center;*/
-fx-font-family: Arial;
}
#sideBarLabelText {
-fx-pref-height: 17;
-fx-translate-x: 5;
-fx-max-height: infinity;
-fx-max-width: infinity;
-fx-font-family: Arial;
/*-fx-alignment: center;*/
-fx-font-style: normal;
} }
......
...@@ -17,7 +17,26 @@ ...@@ -17,7 +17,26 @@
} }
#sideBar { #sideBar {
-fx-pref-width: 300; -fx-pref-width: 250;
}
#sideBarLabel {
-fx-pref-height: 17;
-fx-translate-x: 10;
-fx-max-height: infinity;
-fx-max-width: infinity;
/*-fx-alignment: center;*/
-fx-font-family: Arial;
}
#sideBarLabelText {
-fx-pref-height: 17;
-fx-translate-x: 5;
-fx-max-height: infinity;
-fx-max-width: infinity;
-fx-font-family: Arial;
/*-fx-alignment: center;*/
-fx-font-style: normal;
} }
......
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment