diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java index 9c4cbfa0893618f24058f3867a63b07537438c91..af9ca51e2a0756383755cfbb15d9b56c0574e871 100644 --- a/src/main/java/com/application/DB/DB.java +++ b/src/main/java/com/application/DB/DB.java @@ -114,7 +114,7 @@ public class DB { final String sqlStatement = "SELECT TimeStamp, VariantValue " + "FROM sf-drying-optimization.124.int_sd_winccsensordata " + "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 queryJob = getJob(QueryJobConfiguration.newBuilder(sqlStatement).build()); @@ -140,7 +140,7 @@ public class DB { data.put(formatedTimeStamp, variantValue); } - +/* NavigableMap<String, Number> sortedData = new TreeMap<>(data); for (Map.Entry<String, Number> entry : sortedData.entrySet()) { @@ -151,6 +151,8 @@ public class DB { System.out.println("Neste: "+next); } + */ + return data; } @@ -197,7 +199,7 @@ public class DB { String formattedCalculatedStop = dateFormat.format(calculatedStop); 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); diff --git a/src/main/java/com/application/Main.java b/src/main/java/com/application/Main.java index a21f7f238ffb2f20695577149bda8d2828a85bf7..f00bba9754b969be5a97e68cb58716a113ab5e05 100644 --- a/src/main/java/com/application/Main.java +++ b/src/main/java/com/application/Main.java @@ -3,10 +3,9 @@ package com.application; import com.application.DB.DB; import javafx.application.Application; +import javafx.geometry.Pos; import javafx.scene.chart.LineChart; -import javafx.scene.control.MenuBar; -import javafx.scene.control.ToggleButton; -import javafx.scene.control.ToggleGroup; +import javafx.scene.control.*; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.*; @@ -30,11 +29,10 @@ import java.util.*; public class Main extends Application { private BorderPane topBar; - private HBox menuBar; private HBox logoBar; private VBox sideBar; private LineChart<String, Number> lineChart; - private MenuBar menubar2; + private MenuBar menuBar; /** * Starts the application @@ -56,10 +54,9 @@ public class Main extends Application { // Initializing variables this.topBar = new BorderPane(); - this.menuBar = new HBox(); this.logoBar = new HBox(); this.sideBar = new VBox(); - this.menubar2 = new MenuBar(); + this.menuBar = new MenuBar(); } /** @@ -74,6 +71,7 @@ public class Main extends Application { // Create panes for root BorderPane root = new BorderPane(); this.menuBar = createMenuBar(); + this.sideBar = createSideBar(); this.logoBar = createLogoBar(); this.lineChart = createLineChart(); @@ -84,8 +82,11 @@ public class Main extends Application { this.sideBar.setId("sideBar"); 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 - this.topBar.setTop(menuBar); + this.topBar.setTop(vBox); this.topBar.setCenter(logoBar); // Sets alignment for the panes to the parent root @@ -95,8 +96,8 @@ public class Main extends Application { VBox.setVgrow(this.logoBar, Priority.ALWAYS); - DB.getName(); - System.out.println(DB.getKwh()); + //DB.getName(); + //System.out.println(DB.getKwh()); // Sets the scene and defines boundaries //Scene scene = new Scene(root, 1200, 600); @@ -117,42 +118,71 @@ public class Main extends Application { * * @return MenuBar as a HBox */ - private HBox createMenuBar() { - // Creating buttons for menubar - ToggleGroup btnMenuGroup = new ToggleGroup(); - ToggleButton btnMenuHome = new ToggleButton("Home"); - ToggleButton btnMenuInput = new ToggleButton("Input"); - ToggleButton btnMenuFinish = new ToggleButton("Finish"); - ToggleButton btnMenuHelp = new ToggleButton("Help"); - - - // Set the buttons toggleable - btnMenuHome.setToggleGroup(btnMenuGroup); - btnMenuInput.setToggleGroup(btnMenuGroup); - btnMenuFinish.setToggleGroup(btnMenuGroup); - btnMenuHelp.setToggleGroup(btnMenuGroup); - - // Set the home button as default selected - 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); + private MenuBar createMenuBar() { + + // Creating a menubar + MenuBar menuBar = new MenuBar(); + + // Defining the individual menus + Menu menuFile = new Menu("File"); + Menu menuEdit = new Menu("Edit"); + Menu menuHelp = new Menu("Help"); + + // Adding the menus to the menubar + menuBar.getMenus().add(menuFile); + menuBar.getMenus().add(menuEdit); + menuBar.getMenus().add(menuHelp); + + // Returns the 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 * diff --git a/src/main/resources/com.application/styleSheet.css b/src/main/resources/com.application/styleSheet.css index f2f7ab00c320a24f5891b0f2a2e6a0595cb3cee8..5839eb7353584e40d90135d4f10d1a4076617884 100644 --- a/src/main/resources/com.application/styleSheet.css +++ b/src/main/resources/com.application/styleSheet.css @@ -17,7 +17,26 @@ } #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; } diff --git a/target/classes/com.application/styleSheet.css b/target/classes/com.application/styleSheet.css index f2f7ab00c320a24f5891b0f2a2e6a0595cb3cee8..5839eb7353584e40d90135d4f10d1a4076617884 100644 --- a/target/classes/com.application/styleSheet.css +++ b/target/classes/com.application/styleSheet.css @@ -17,7 +17,26 @@ } #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; } diff --git a/target/classes/com/application/DB/DB.class b/target/classes/com/application/DB/DB.class index 09e5c74d9286c746e9a1a46b2c1ffd7dcea1c4c9..ae3a9ac70f511fc26df8fe9fa898fc8061277dfd 100644 Binary files a/target/classes/com/application/DB/DB.class and b/target/classes/com/application/DB/DB.class differ diff --git a/target/classes/com/application/Main.class b/target/classes/com/application/Main.class index 2aba5bd4c21111477289f6aa05bc62773886010e..324b19675b65197d4779a15ad0a53250c89a9c3d 100644 Binary files a/target/classes/com/application/Main.class and b/target/classes/com/application/Main.class differ