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

Merge branch 'Eilerts_branch' into 'master'

Updated css stylesheet and converted date from numbers to date format

See merge request mesji/bacheloroppgave_2022!23
parents 5150adbf 278fe7bc
No related branches found
No related tags found
No related merge requests found
<component name="libraryTable">
<library name="Maven: org.controlsfx:controlsfx:8.40.14">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/controlsfx/controlsfx/8.40.14/controlsfx-8.40.14.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/controlsfx/controlsfx/8.40.14/controlsfx-8.40.14-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/controlsfx/controlsfx/8.40.14/controlsfx-8.40.14-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.jfxtras:jmetro:8.6.9">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jfxtras/jmetro/8.6.9/jmetro-8.6.9.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jfxtras/jmetro/8.6.9/jmetro-8.6.9-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jfxtras/jmetro/8.6.9/jmetro-8.6.9-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
......@@ -52,7 +52,5 @@
<orderEntry type="library" name="Maven: com.google.cloud:google-cloud-storage:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.google.apis:google-api-services-storage:v1-rev20211201-1.32.1" level="project" />
<orderEntry type="library" name="Maven: com.google.auto.value:auto-value-annotations:1.9" level="project" />
<orderEntry type="library" name="Maven: org.jfxtras:jmetro:8.6.9" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.controlsfx:controlsfx:8.40.14" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -10,9 +10,17 @@ import com.google.cloud.bigquery.JobInfo;
import com.google.cloud.bigquery.QueryJobConfiguration;
import com.google.cloud.bigquery.TableResult;
import com.sun.media.jfxmedia.AudioClip;
import org.apache.commons.codec.binary.Hex;
import java.io.File;
import java.io.FileInputStream;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.TimeZone;
public class DB {
......@@ -42,12 +50,15 @@ public class DB {
public static void getFromExistingTable() throws Exception {
//ArrayList<String, Integer> results = new ArrayList<>();
// Step 2: Prepare query job
// A "QueryJob" is a type of job that executes SQL queries
// we create a new job configuration from our SQL query and
final String GET_WORD_COUNT = "SELECT VariantValue, TimeStamp FROM sf-drying-optimization.124.int_sd_winccsensordata WHERE treeSpecies LIKE AND TimeStamp BETWEEN \"2020-06-09\" AND \"2020-06-29\" ORDER BY TimeStamp";
final String GET_WORD_COUNT = "SELECT InTidTork, UtTidTork " +
"FROM sf-drying-optimization.124.int_gs_ds_sipalpackages " +
"WHERE Tork LIKE \"%5%\" AND InTidTork BETWEEN \"2020-05-14 12:51:03\" " +
"AND \"2022-03-03 16:10:09\" ORDER BY InTidTork";
QueryJobConfiguration queryConfig =
QueryJobConfiguration.newBuilder(GET_WORD_COUNT).build();
......@@ -70,14 +81,21 @@ public class DB {
// Step 4: Display results
// Print out a header line, and iterate through the
// query results to print each result in a new line
System.out.println("Timestamp\tVarient value");
System.out.println("InTidTork \t UtTidTork");
TableResult result = queryJob.getQueryResults();
for (FieldValueList row : result.iterateAll()) {
// We can use the `get` method along with the column
// name to get the corresponding row entry
int variantValue = row.get("VariantValue").getNumericValue().intValue();
String timeStamp = row.get("TimeStamp").getStringValue();
System.out.printf("%s\t%d\n", timeStamp, variantValue);
SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
newFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
long inTidTork = row.get("InTidTork").getTimestampValue()/1000;
long utTidTork = row.get("UtTidTork").getTimestampValue()/1000;
String formatedInTidTork = newFormat.format(inTidTork);
String formatedUtTidTork = newFormat.format(utTidTork);
System.out.printf("%s\t\t\t\t\t%s\n", formatedInTidTork, formatedUtTidTork);
}
}
}
\ No newline at end of file
package com.application;
import com.application.DB.DB;
import javafx.application.Application;
import javafx.scene.chart.LineChart;
import javafx.scene.control.MenuBar;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.image.Image;
......@@ -37,6 +39,7 @@ public class Main extends Application {
private HBox logoBar;
private VBox sideBar;
private LineChart lineChart;
private MenuBar menubar2;
/**
* Starts the application
......@@ -61,6 +64,7 @@ public class Main extends Application {
this.menuBar = new HBox();
this.logoBar = new HBox();
this.sideBar = new VBox();
this.menubar2 = new MenuBar();
}
/**
......@@ -77,26 +81,30 @@ public class Main extends Application {
this.logoBar = createLogoBar();
this.lineChart = createLineChart();
//Set id's to connect to css stylesheet
root.setId("root");
this.logoBar.setId("logoBar");
this.menuBar.setId("menuBar");
this.sideBar.setId("sideBar");
this.lineChart.setId("lineChart");
// Sets alignment for the topBar
this.topBar.setTop(menuBar);
this.topBar.setCenter(logoBar);
this.sideBar.setMinWidth(300);
//Set id for panes
root.setId("root");
this.menuBar.setId("menuBar");
// Sets alignment for the panes to the parent root
root.setTop(this.topBar);
root.setLeft(this.sideBar);
root.setCenter(this.lineChart);
VBox.setVgrow(this.logoBar, Priority.ALWAYS);
DB.getFromExistingTable();
// Sets the scene and defines boundaries
//Scene scene = new Scene(root, 1200, 600);
Scene scene = new Scene(root, 1200, 600);
scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("/com.application/styleSheet.css")).toExternalForm());
scene.getStylesheets().add(getClass().getResource("/com.application/styleSheet.css").toExternalForm());
primaryStage.setTitle("Moelven Drying Application");
//primaryStage.setMaximized(true);
......@@ -148,22 +156,27 @@ public class Main extends Application {
}
/**
* This function imports the logos and defines the alignments
* @return a logoBar containing the logos in proper alignments
* @throws FileNotFoundException
*/
private HBox createLogoBar() throws FileNotFoundException {
//Creating an image
// Defining the image paths
Image moelvenLogoM = new Image(new FileInputStream("src/main/resources/com.application/GUI/moelven_logo_m.jpg"));
Image moelvenLogoTitle = new Image(new FileInputStream("src/main/resources/com.application/GUI/moelven_logo_title.jpg"));
//Setting the image view
// Creating imageview objects
ImageView imageViewM = new ImageView(moelvenLogoM);
ImageView imageViewTitle = new ImageView(moelvenLogoTitle);
// Defining resolution and aspect ratio
imageViewM.setFitHeight(100);
imageViewM.setPreserveRatio(true);
imageViewTitle.setFitHeight(100);
imageViewTitle.setPreserveRatio(true);
// Defining alignments
Region region1 = new Region();
HBox.setHgrow(region1, Priority.ALWAYS);
......
......@@ -9,4 +9,17 @@
-fx-font-size: 14;
}
#logoBar {
-fx-pref-height: 100;
-fx-max-width: infinity;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-alignment: center;
}
#sideBar {
-fx-pref-width: 300;
}
......@@ -9,4 +9,17 @@
-fx-font-size: 14;
}
#logoBar {
-fx-pref-height: 100;
-fx-max-width: infinity;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-alignment: center;
}
#sideBar {
-fx-pref-width: 300;
}
No preview for this file type
File deleted
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