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 {
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);
......
......@@ -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
*
......
......@@ -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;
}
......
......@@ -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;
}
......
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.
Finish editing this message first!
Please register or to comment