diff --git a/.idea/libraries/Maven__org_controlsfx_controlsfx_8_40_14.xml b/.idea/libraries/Maven__org_controlsfx_controlsfx_8_40_14.xml deleted file mode 100644 index 6958924699b78bf9fc0ac738e26728ea669201b2..0000000000000000000000000000000000000000 --- a/.idea/libraries/Maven__org_controlsfx_controlsfx_8_40_14.xml +++ /dev/null @@ -1,13 +0,0 @@ -<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 diff --git a/.idea/libraries/Maven__org_jfxtras_jmetro_8_6_9.xml b/.idea/libraries/Maven__org_jfxtras_jmetro_8_6_9.xml deleted file mode 100644 index aafb0724342dc2f9c6dfc357c5e001b63cb42e5d..0000000000000000000000000000000000000000 --- a/.idea/libraries/Maven__org_jfxtras_jmetro_8_6_9.xml +++ /dev/null @@ -1,13 +0,0 @@ -<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 diff --git a/Bachelor_application.iml b/Bachelor_application.iml index 989e66de81c62536f810c25a8694f7b5eb459ba1..bcd84db39f631518a3f8fc961e3ff70eb08138ab 100644 --- a/Bachelor_application.iml +++ b/Bachelor_application.iml @@ -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 diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java index b674e533e8c8fe2a03d9cff9fdc2f642aff021de..b46727f81cc712b9a651613a4b7cab36af7a6360 100644 --- a/src/main/java/com/application/DB/DB.java +++ b/src/main/java/com/application/DB/DB.java @@ -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 diff --git a/src/main/java/com/application/Main.java b/src/main/java/com/application/Main.java index e04a12ca8c75e9f041c49f4f2b3ee20ef36f7ee4..cceaf4d7d155638463a908367772f6cbef97033a 100644 --- a/src/main/java/com/application/Main.java +++ b/src/main/java/com/application/Main.java @@ -1,9 +1,11 @@ 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); diff --git a/src/main/resources/com.application/styleSheet.css b/src/main/resources/com.application/styleSheet.css index 1efb3b448daa04860ce8a99e33b390db82969f34..f2f7ab00c320a24f5891b0f2a2e6a0595cb3cee8 100644 --- a/src/main/resources/com.application/styleSheet.css +++ b/src/main/resources/com.application/styleSheet.css @@ -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; +} + + + diff --git a/target/classes/com.application/styleSheet.css b/target/classes/com.application/styleSheet.css index 1efb3b448daa04860ce8a99e33b390db82969f34..f2f7ab00c320a24f5891b0f2a2e6a0595cb3cee8 100644 --- a/target/classes/com.application/styleSheet.css +++ b/target/classes/com.application/styleSheet.css @@ -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; +} + + + diff --git a/target/classes/com/application/DB/DB.class b/target/classes/com/application/DB/DB.class index c77ffce8fa0cbecece9c222fcf0d44db5e517a4b..54d5fed9c7c08e1745ce5b53aa191eb9caf3b723 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/DB/Sort.class b/target/classes/com/application/DB/Sort.class deleted file mode 100644 index a8073b0698d44e99c2a6ec25c9c9012f4d5568f2..0000000000000000000000000000000000000000 Binary files a/target/classes/com/application/DB/Sort.class and /dev/null differ diff --git a/target/classes/com/application/Main.class b/target/classes/com/application/Main.class index 6df8d5af623e4d83379853b325596f2de5b2fa48..7f5dd8be87f89da0ee1c433c2fab6350574ae043 100644 Binary files a/target/classes/com/application/Main.class and b/target/classes/com/application/Main.class differ