diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java index 2777ec3da79ca0501ec154bc0133af8bcd0ec12c..ca1ceb1cd18cc120df764b1ce11ad9d60b481efd 100644 --- a/src/main/java/com/application/DB/DB.java +++ b/src/main/java/com/application/DB/DB.java @@ -6,8 +6,13 @@ import com.google.cloud.bigquery.*; import java.io.File; import java.io.FileInputStream; +import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; import java.util.*; /** @@ -101,17 +106,15 @@ public class DB { // Initializing the data map to store the results Map<String, Number> data = new HashMap<>(); - List<List<Number>> listOfLists = new ArrayList<List<Number>>(); - // Initializing the date format - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // Preparing a query statement 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-04 11:10:09\" ORDER BY TimeStamp"; + "AND \"2021-01-28 11:10:09\" ORDER BY TimeStamp ASC"; // Creates a job configuration queryJob = getJob(QueryJobConfiguration.newBuilder(sqlStatement).build()); @@ -121,20 +124,35 @@ public class DB { System.out.println("InTidTork \t UtTidTork"); for (FieldValueList row : result.iterateAll()) { + // Kwh + int variantValue = row.get("VariantValue").getNumericValue().intValue(); + // Retrieving the wanted data long timeStamp = row.get("TimeStamp").getTimestampValue()/1000; + // Riktig format, men i string String formatedTimeStamp = dateFormat.format(timeStamp); + // Format the date to LocalDateTime datatype + LocalDateTime date = LocalDateTime.parse(formatedTimeStamp, format); + // Creates a future date to compare against + LocalDateTime dateFuture = date.plusDays(1); - int variantValue = row.get("VariantValue").getNumericValue().intValue(); - - System.out.println(timeStamp); - + //System.out.println(date); data.put(formatedTimeStamp, variantValue); + } +/* + NavigableMap<String, Number> sortedData = new TreeMap<>(data); + + for (Map.Entry<String, Number> entry : sortedData.entrySet()) { + String key = entry.getKey(); + String next = sortedData.higherEntry(entry.getKey()).getKey(); // next - listOfLists.add(new ArrayList<Number>()); + //System.out.println("Nå: "+key); + //System.out.printf("Neste: %s\n\n",next); } - return data; + + */ + return data; } /** @@ -153,6 +171,8 @@ public class DB { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + + // Preparing a query statement final String sqlStatement = "SELECT Name, CalculatedStart, CalculatedStop FROM `sf-drying-optimization.124.int_dk_valmaticsdryingbatches`" + @@ -176,7 +196,10 @@ public class DB { String formattedCalculatedStart = dateFormat.format(calculatedStart); String formattedCalculatedStop = dateFormat.format(calculatedStop); - System.out.printf("%s\t\t\t%s\t\t\t%s\n",name, formattedCalculatedStart, formattedCalculatedStop); + java.sql.Timestamp timestamp = new Timestamp(calculatedStart); + //System.out.println(timestamp); + + //System.out.printf("%s\t\t\t%s\t\t\t%s\n",name, formattedCalculatedStart, formattedCalculatedStop); } //return data; diff --git a/src/main/java/com/application/GUI/ProgressCircleIndicator.java b/src/main/java/com/application/GUI/ProgressCircleIndicator.java new file mode 100644 index 0000000000000000000000000000000000000000..4ef8a946a9f2d0c579c57395673c734e2a80f5cf --- /dev/null +++ b/src/main/java/com/application/GUI/ProgressCircleIndicator.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2014, Andrea Vacondio + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.application.GUI; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.ReadOnlyBooleanProperty; +import javafx.beans.property.ReadOnlyBooleanWrapper; +import javafx.beans.property.ReadOnlyIntegerProperty; +import javafx.beans.property.ReadOnlyIntegerWrapper; +import javafx.css.CssMetaData; +import javafx.css.Styleable; +import javafx.css.StyleableDoubleProperty; +import javafx.css.StyleableProperty; +import javafx.scene.control.Control; + +import com.sun.javafx.css.converters.SizeConverter; + +/** + * Base class for the progress indicator controls represented by circualr shapes + * + * @author Andrea Vacondio + * + */ +abstract class ProgressCircleIndicator extends Control { + private static final int INDETERMINATE_PROGRESS = -1; + + private ReadOnlyIntegerWrapper progress = new ReadOnlyIntegerWrapper(0); + private ReadOnlyBooleanWrapper indeterminate = new ReadOnlyBooleanWrapper(false); + + public ProgressCircleIndicator() { + this.getStylesheets().add(ProgressCircleIndicator.class.getResource("/com.application/CSS/circleprogress.css").toExternalForm()); + } + + public int getProgress() { + return progress.get(); + } + + /** + * Set the value for the progress, it cannot be more then 100 (meaning 100%). A negative value means indeterminate progress. + * + * @param progressValue + * @see ProgressCircleIndicator#makeIndeterminate() + */ + public void setProgress(int progressValue) { + progress.set(defaultToHundred(progressValue)); + indeterminate.set(progressValue < 0); + } + + public ReadOnlyIntegerProperty progressProperty() { + return progress.getReadOnlyProperty(); + } + + public boolean isIndeterminate() { + return indeterminate.get(); + } + + public void makeIndeterminate() { + setProgress(INDETERMINATE_PROGRESS); + } + + public ReadOnlyBooleanProperty indeterminateProperty() { + return indeterminate.getReadOnlyProperty(); + } + + private int defaultToHundred(int value) { + if (value > 100) { + return 100; + } + return value; + } + + public final void setInnerCircleRadius(int value) { + innerCircleRadiusProperty().set(value); + } + + public final DoubleProperty innerCircleRadiusProperty() { + return innerCircleRadius; + } + + public final double getInnerCircleRadius() { + return innerCircleRadiusProperty().get(); + } + + /** + * radius of the inner circle + */ + private DoubleProperty innerCircleRadius = new StyleableDoubleProperty(60) { + @Override + public Object getBean() { + return ProgressCircleIndicator.this; + } + + @Override + public String getName() { + return "innerCircleRadius"; + } + + @Override + public CssMetaData<ProgressCircleIndicator, Number> getCssMetaData() { + return StyleableProperties.INNER_CIRCLE_RADIUS; + } + }; + + private static class StyleableProperties { + private static final CssMetaData<ProgressCircleIndicator, Number> INNER_CIRCLE_RADIUS = new CssMetaData<ProgressCircleIndicator, Number>( + "-fx-inner-radius", SizeConverter.getInstance(), 60) { + + @Override + public boolean isSettable(ProgressCircleIndicator n) { + return n.innerCircleRadiusProperty() == null || !n.innerCircleRadiusProperty().isBound(); + } + + @Override + public StyleableProperty<Number> getStyleableProperty(ProgressCircleIndicator n) { + return (StyleableProperty<Number>) n.innerCircleRadiusProperty(); + } + }; + + public static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES; + static { + final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>(Control.getClassCssMetaData()); + styleables.add(INNER_CIRCLE_RADIUS); + STYLEABLES = Collections.unmodifiableList(styleables); + } + } + + /** + * @return The CssMetaData associated with this class, which may include the CssMetaData of its super classes. + */ + public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() { + return StyleableProperties.STYLEABLES; + } + + @Override + public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() { + return StyleableProperties.STYLEABLES; + } +} diff --git a/src/main/java/com/application/GUI/RingProgressIndicator.java b/src/main/java/com/application/GUI/RingProgressIndicator.java new file mode 100644 index 0000000000000000000000000000000000000000..a7bb3d9f196094d7299ee5e073e6b0c32f626f60 --- /dev/null +++ b/src/main/java/com/application/GUI/RingProgressIndicator.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2014, Andrea Vacondio + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.application.GUI; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javafx.beans.property.DoubleProperty; +import javafx.css.CssMetaData; +import javafx.css.Styleable; +import javafx.css.StyleableDoubleProperty; +import javafx.css.StyleableProperty; +import javafx.scene.control.Control; +import javafx.scene.control.Skin; + +import com.sun.javafx.css.converters.SizeConverter; + +/** + * Progress indicator showing a filling arc. + * + * @author Andrea Vacondio + * + */ +public class RingProgressIndicator extends ProgressCircleIndicator { + public RingProgressIndicator() { + this.getStylesheets().add(RingProgressIndicator.class.getResource("/com.application/CSS/ringprogress.css").toExternalForm()); + this.getStyleClass().add("ringindicator"); + } + + @Override + protected Skin<?> createDefaultSkin() { + return new RingProgressIndicatorSkin(this); + } + + public final void setRingWidth(int value) { + ringWidthProperty().set(value); + } + + public final DoubleProperty ringWidthProperty() { + return ringWidth; + } + + public final double getRingWidth() { + return ringWidthProperty().get(); + } + + /** + * thickness of the ring indicator. + */ + private DoubleProperty ringWidth = new StyleableDoubleProperty(22) { + @Override + public Object getBean() { + return RingProgressIndicator.this; + } + + @Override + public String getName() { + return "ringWidth"; + } + + @Override + public CssMetaData<RingProgressIndicator, Number> getCssMetaData() { + return StyleableProperties.RING_WIDTH; + } + }; + + private static class StyleableProperties { + private static final CssMetaData<RingProgressIndicator, Number> RING_WIDTH = new CssMetaData<RingProgressIndicator, Number>( + "-fx-ring-width", SizeConverter.getInstance(), 22) { + + @Override + public boolean isSettable(RingProgressIndicator n) { + return n.ringWidth == null || !n.ringWidth.isBound(); + } + + @Override + public StyleableProperty<Number> getStyleableProperty(RingProgressIndicator n) { + return (StyleableProperty<Number>) n.ringWidth; + } + }; + + public static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES; + static { + final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>(Control.getClassCssMetaData()); + styleables.addAll(ProgressCircleIndicator.getClassCssMetaData()); + styleables.add(RING_WIDTH); + STYLEABLES = Collections.unmodifiableList(styleables); + } + } + + @Override + public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() { + return StyleableProperties.STYLEABLES; + } +} diff --git a/src/main/java/com/application/GUI/RingProgressIndicatorSkin.java b/src/main/java/com/application/GUI/RingProgressIndicatorSkin.java new file mode 100644 index 0000000000000000000000000000000000000000..d2193f859ca98bb00503fa65c547bd897cfbb4cb --- /dev/null +++ b/src/main/java/com/application/GUI/RingProgressIndicatorSkin.java @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2014, Andrea Vacondio + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.application.GUI; + +import javafx.animation.Animation; +import javafx.animation.Interpolator; +import javafx.animation.RotateTransition; +import javafx.scene.Node; +import javafx.scene.control.Label; +import javafx.scene.control.Skin; +import javafx.scene.layout.Region; +import javafx.scene.layout.StackPane; +import javafx.scene.shape.Arc; +import javafx.scene.shape.Circle; +import javafx.util.Duration; + +/** + * Skin of the ring progress indicator where an arc grows and by the progress value up to 100% where the arc becomes a ring. + * + * @author Andrea Vacondio + * + */ +public class RingProgressIndicatorSkin implements Skin<RingProgressIndicator> { + + private final RingProgressIndicator indicator; + private final Label percentLabel = new Label(); + private final Circle innerCircle = new Circle(); + private final Circle outerCircle = new Circle(); + private final StackPane container = new StackPane(); + private final Arc fillerArc = new Arc(); + private final RotateTransition transition = new RotateTransition(Duration.millis(2000), fillerArc); + + public RingProgressIndicatorSkin(final RingProgressIndicator indicator) { + this.indicator = indicator; + initContainer(indicator); + initFillerArc(); + container.widthProperty().addListener((o, oldVal, newVal) -> { + fillerArc.setCenterX(newVal.intValue() / 2); + }); + container.heightProperty().addListener((o, oldVal, newVal) -> { + fillerArc.setCenterY(newVal.intValue() / 2); + }); + innerCircle.getStyleClass().add("ringindicator-inner-circle"); + outerCircle.getStyleClass().add("ringindicator-outer-circle-secondary"); + updateRadii(); + + this.indicator.indeterminateProperty().addListener((o, oldVal, newVal) -> { + initIndeterminate(newVal); + }); + this.indicator.progressProperty().addListener((o, oldVal, newVal) -> { + if (newVal.intValue() >= 0) { + setProgressLabel(newVal.intValue()); + fillerArc.setLength(newVal.intValue() * -3.6); + } + }); + this.indicator.ringWidthProperty().addListener((o, oldVal, newVal) -> { + updateRadii(); + }); + innerCircle.strokeWidthProperty().addListener((e) -> { + updateRadii(); + }); + innerCircle.radiusProperty().addListener((e) -> { + updateRadii(); + }); + initTransition(); + initIndeterminate(indicator.isIndeterminate()); + initLabel(indicator.getProgress()); + indicator.visibleProperty().addListener((o, oldVal, newVal) -> { + if (newVal && this.indicator.isIndeterminate()) { + transition.play(); + } else { + transition.pause(); + } + }); + container.getChildren().addAll(fillerArc, outerCircle, innerCircle, percentLabel); + } + + private void setProgressLabel(int value) { + if (value >= 0) { + percentLabel.setText(String.format("%d%%", value)); + } + } + + private void initTransition() { + transition.setAutoReverse(false); + transition.setCycleCount(Animation.INDEFINITE); + transition.setDelay(Duration.ZERO); + transition.setInterpolator(Interpolator.LINEAR); + transition.setByAngle(360); + } + + private void initFillerArc() { + fillerArc.setManaged(false); + fillerArc.getStyleClass().add("ringindicator-filler"); + fillerArc.setStartAngle(90); + fillerArc.setLength(indicator.getProgress() * -3.6); + } + + private void initContainer(final RingProgressIndicator indicator) { + container.getStylesheets().addAll(indicator.getStylesheets()); + container.getStyleClass().addAll("circleindicator-container"); + container.setMaxHeight(Region.USE_PREF_SIZE); + container.setMaxWidth(Region.USE_PREF_SIZE); + } + + private void updateRadii() { + double ringWidth = indicator.getRingWidth(); + double innerCircleHalfStrokeWidth = innerCircle.getStrokeWidth() / 2; + double innerCircleRadius = indicator.getInnerCircleRadius(); + outerCircle.setRadius(innerCircleRadius + innerCircleHalfStrokeWidth + ringWidth); + fillerArc.setRadiusY(innerCircleRadius + innerCircleHalfStrokeWidth - 1 + (ringWidth / 2)); + fillerArc.setRadiusX(innerCircleRadius + innerCircleHalfStrokeWidth - 1 + (ringWidth / 2)); + fillerArc.setStrokeWidth(ringWidth); + innerCircle.setRadius(innerCircleRadius); + } + + private void initLabel(int value) { + setProgressLabel(value); + percentLabel.getStyleClass().add("circleindicator-label"); + } + + private void initIndeterminate(boolean newVal) { + percentLabel.setVisible(!newVal); + if (newVal) { + fillerArc.setLength(360); + fillerArc.getStyleClass().add("indeterminate"); + if (indicator.isVisible()) { + transition.play(); + } + } else { + fillerArc.getStyleClass().remove("indeterminate"); + fillerArc.setRotate(0); + transition.stop(); + } + } + + @Override + public RingProgressIndicator getSkinnable() { + return indicator; + } + + @Override + public Node getNode() { + return container; + } + + @Override + public void dispose() { + transition.stop(); + } + +} diff --git a/src/main/java/com/application/Main.java b/src/main/java/com/application/Main.java index 55fe15859aaf50de937bbee7368fc47152d51fad..1413fe7390eb12f506e689565e7767658bbc9e8f 100644 --- a/src/main/java/com/application/Main.java +++ b/src/main/java/com/application/Main.java @@ -1,30 +1,29 @@ package com.application; import com.application.DB.DB; -import javafx.application.Application; +import com.application.GUI.RingProgressIndicator; +import com.sun.corba.se.spi.orbutil.threadpool.Work; +import javafx.application.Application; +import javafx.application.Platform; 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.*; import javafx.scene.Scene; import javafx.stage.Stage; - - import javafx.scene.chart.CategoryAxis; - import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; - import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.*; +import java.util.logging.Logger; + +import static java.util.logging.Level.SEVERE; /** * This class launches the application @@ -35,14 +34,13 @@ 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 + * * @param args * @throws IOException */ @@ -61,10 +59,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(); } /** @@ -79,37 +76,41 @@ 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(); + LineChart<String, Number> 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"); + 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 root.setTop(this.topBar); root.setLeft(this.sideBar); - root.setCenter(this.lineChart); + root.setCenter(lineChart); 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); Scene scene = new Scene(root, 1200, 600); - scene.getStylesheets().add(getClass().getResource("/com.application/styleSheet.css").toExternalForm()); + scene.getStylesheets().add(getClass().getResource("/com.application/CSS/styleSheet.css").toExternalForm()); primaryStage.setTitle("Moelven Drying Application"); - //primaryStage.setMaximized(true); + primaryStage.setMaximized(true); primaryStage.setMinHeight(600); primaryStage.setMinWidth(1200); primaryStage.setScene(scene); @@ -122,42 +123,112 @@ 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.setId("sideBarButtonFinish"); + + // Creating the circular progressbar + RingProgressIndicator ringProgressIndicator = new RingProgressIndicator(); + ringProgressIndicator.setRingWidth(100); + ringProgressIndicator.makeIndeterminate(); + + class WorkerThread extends Thread{ + RingProgressIndicator rpi; + int progress = 0; + + public WorkerThread(RingProgressIndicator rpi){ + this.rpi = rpi; + } + + @Override + public void run(){ + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + while (true){ + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + Logger.getLogger(getClass().getName()).log(SEVERE,null,e); + } + Platform.runLater(() -> {rpi.setProgress(progress);}); + + progress += 1; + if(progress>100){ + break; + } + } + } + } + + new WorkerThread(ringProgressIndicator).start(); + + + + sideBarVBox.getChildren().addAll(ringProgressIndicator, 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 * @@ -166,8 +237,8 @@ public class Main extends Application { */ private HBox createLogoBar() throws FileNotFoundException { // 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")); + Image moelvenLogoM = new Image(new FileInputStream("src/main/resources/com.application/GUI/moelven_logo_m.png")); + Image moelvenLogoTitle = new Image(new FileInputStream("src/main/resources/com.application/GUI/moelven_logo_title.png")); // Creating imageview objects ImageView imageViewM = new ImageView(moelvenLogoM); @@ -196,8 +267,7 @@ public class Main extends Application { final NumberAxis yAxis = new NumberAxis(); xAxis.setLabel("Date"); - final LineChart<String, Number> lineChart = - new LineChart<>(xAxis, yAxis); + final LineChart<String, Number> lineChart = new LineChart<>(xAxis, yAxis); lineChart.setTitle("Drying Process"); @@ -211,6 +281,6 @@ public class Main extends Application { lineChart.getData().add(series1); return lineChart; } - } + diff --git a/src/main/resources/com.application/CSS/circleprogress.css b/src/main/resources/com.application/CSS/circleprogress.css new file mode 100644 index 0000000000000000000000000000000000000000..09310043981aeeef6415816f2406617756064cd2 --- /dev/null +++ b/src/main/resources/com.application/CSS/circleprogress.css @@ -0,0 +1,11 @@ +.circleindicator-container { + circleindicator-color: red; + -fx-padding: 5.0; + -fx-background-color: -fx-background; +} +.circleindicator-container > .circleindicator-label { + -fx-font-weight: bold; + -fx-font-size: 2.5em; + -fx-text-fill: circleindicator-color; + -fx-padding: 5.0; +} \ No newline at end of file diff --git a/src/main/resources/com.application/CSS/ringprogress.css b/src/main/resources/com.application/CSS/ringprogress.css new file mode 100644 index 0000000000000000000000000000000000000000..10df8a25965ca69d6c4c5ce4c6b821d6aafd5cc3 --- /dev/null +++ b/src/main/resources/com.application/CSS/ringprogress.css @@ -0,0 +1,25 @@ +.ringindicator{ + -fx-ring-width: 22.0; + -fx-inner-radius: 60.0; +} +.ringindicator-inner-circle { + -fx-opacity: 0.55; + -fx-stroke: circleindicator-color; + -fx-stroke-width: 8.0px; + -fx-fill: -fx-background; +} +.ringindicator-filler { + -fx-stroke: circleindicator-color; + -fx-fill: -fx-background; + -fx-stroke-line-cap: butt; +} +.ringindicator-outer-circle-secondary { + -fx-opacity: 0.1; + -fx-stroke: circleindicator-color; + -fx-stroke-width: 2.0px; + -fx-fill: -fx-background; +} +.indeterminate { + -fx-opacity: 0.55; + -fx-stroke: linear-gradient(from 0.0% 0.0% to 70.0% 70.0%, circleindicator-color 70.0%, white 75.0%, white); +} diff --git a/src/main/resources/com.application/CSS/styleSheet.css b/src/main/resources/com.application/CSS/styleSheet.css new file mode 100644 index 0000000000000000000000000000000000000000..7265a693ae83ab88b3a4d320a376d17e25f0575d --- /dev/null +++ b/src/main/resources/com.application/CSS/styleSheet.css @@ -0,0 +1,53 @@ +/* General css for alle the main windows */ + +/*noinspection CssUnusedSymbol*/ +.root { + -fx-pref-width: 1150; + -fx-pref-height: 600; + -fx-fill-height: true; + -fx-max-width: infinity; + -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: 250; +} + +#sideBarLabel { + -fx-pref-height: 17; + -fx-translate-x: 10; + -fx-max-height: infinity; + -fx-max-width: infinity; + -fx-font-size: 16; + -fx-font-family: Arial; +} + +#sideBarLabelText { + -fx-pref-height: 17; + -fx-translate-x: 5; + -fx-max-height: infinity; + -fx-max-width: infinity; + -fx-font-size: 16; + -fx-font-family: Arial; +} + +#sideBarButtonFinish { + -fx-translate-x: 5; + -fx-translate-y: 20; + -fx-pref-width: infinity; + -fx-pref-height: 25; + -fx-font-size: 20; + -fx-font-family: Arial; + -fx-background-color: rgba(104, 229, 59, 1); +} + + + + diff --git a/src/main/resources/com.application/GUI/graphical_user_interface.fxml b/src/main/resources/com.application/GUI/graphical_user_interface.fxml index 975d47da34a8cbb9301984afc53582812ac0721b..4d8f5c57661d0a3add54e8c0ee84bb5649706afc 100644 --- a/src/main/resources/com.application/GUI/graphical_user_interface.fxml +++ b/src/main/resources/com.application/GUI/graphical_user_interface.fxml @@ -55,14 +55,14 @@ <left> <ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true" translateX="5.0" BorderPane.alignment="CENTER"> <image> - <Image url="@moelven_logo_m.jpg" /> + <Image url="@moelven_logo_m.png" /> </image> </ImageView> </left> <center> <ImageView fitHeight="30.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true"> <image> - <Image url="@moelven_logo_title.jpg" /> + <Image url="@moelven_logo_title.png" /> </image> </ImageView> </center> diff --git a/src/main/resources/com.application/GUI/moelven_logo_m.jpg b/src/main/resources/com.application/GUI/moelven_logo_m.jpg deleted file mode 100644 index 9140870bda82d1499b6d98df0a71674fd76436ec..0000000000000000000000000000000000000000 Binary files a/src/main/resources/com.application/GUI/moelven_logo_m.jpg and /dev/null differ diff --git a/src/main/resources/com.application/GUI/moelven_logo_m.png b/src/main/resources/com.application/GUI/moelven_logo_m.png new file mode 100644 index 0000000000000000000000000000000000000000..7e8119a3417f0c81825bfcd3d7e5abaca0ad8115 Binary files /dev/null and b/src/main/resources/com.application/GUI/moelven_logo_m.png differ diff --git a/src/main/resources/com.application/GUI/moelven_logo_title.jpg b/src/main/resources/com.application/GUI/moelven_logo_title.jpg deleted file mode 100644 index 9d3f195108bc799381176c7cd5904ed1ec3fb4f6..0000000000000000000000000000000000000000 Binary files a/src/main/resources/com.application/GUI/moelven_logo_title.jpg and /dev/null differ diff --git a/src/main/resources/com.application/GUI/moelven_logo_title.png b/src/main/resources/com.application/GUI/moelven_logo_title.png new file mode 100644 index 0000000000000000000000000000000000000000..271d0265e0c76fb05dcb46de2e1626b59d1bf008 Binary files /dev/null and b/src/main/resources/com.application/GUI/moelven_logo_title.png differ diff --git a/src/main/resources/com.application/styleSheet.css b/src/main/resources/com.application/styleSheet.css deleted file mode 100644 index f2f7ab00c320a24f5891b0f2a2e6a0595cb3cee8..0000000000000000000000000000000000000000 --- a/src/main/resources/com.application/styleSheet.css +++ /dev/null @@ -1,25 +0,0 @@ -/* General css for alle the main windows */ - -/*noinspection CssUnusedSymbol*/ -.root { - -fx-pref-width: 1150; - -fx-pref-height: 600; - -fx-fill-height: true; - -fx-max-width: infinity; - -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/CSS/circleprogress.css b/target/classes/com.application/CSS/circleprogress.css new file mode 100644 index 0000000000000000000000000000000000000000..09310043981aeeef6415816f2406617756064cd2 --- /dev/null +++ b/target/classes/com.application/CSS/circleprogress.css @@ -0,0 +1,11 @@ +.circleindicator-container { + circleindicator-color: red; + -fx-padding: 5.0; + -fx-background-color: -fx-background; +} +.circleindicator-container > .circleindicator-label { + -fx-font-weight: bold; + -fx-font-size: 2.5em; + -fx-text-fill: circleindicator-color; + -fx-padding: 5.0; +} \ No newline at end of file diff --git a/target/classes/com.application/CSS/ringprogress.css b/target/classes/com.application/CSS/ringprogress.css new file mode 100644 index 0000000000000000000000000000000000000000..10df8a25965ca69d6c4c5ce4c6b821d6aafd5cc3 --- /dev/null +++ b/target/classes/com.application/CSS/ringprogress.css @@ -0,0 +1,25 @@ +.ringindicator{ + -fx-ring-width: 22.0; + -fx-inner-radius: 60.0; +} +.ringindicator-inner-circle { + -fx-opacity: 0.55; + -fx-stroke: circleindicator-color; + -fx-stroke-width: 8.0px; + -fx-fill: -fx-background; +} +.ringindicator-filler { + -fx-stroke: circleindicator-color; + -fx-fill: -fx-background; + -fx-stroke-line-cap: butt; +} +.ringindicator-outer-circle-secondary { + -fx-opacity: 0.1; + -fx-stroke: circleindicator-color; + -fx-stroke-width: 2.0px; + -fx-fill: -fx-background; +} +.indeterminate { + -fx-opacity: 0.55; + -fx-stroke: linear-gradient(from 0.0% 0.0% to 70.0% 70.0%, circleindicator-color 70.0%, white 75.0%, white); +} diff --git a/target/classes/com.application/CSS/styleSheet.css b/target/classes/com.application/CSS/styleSheet.css new file mode 100644 index 0000000000000000000000000000000000000000..7265a693ae83ab88b3a4d320a376d17e25f0575d --- /dev/null +++ b/target/classes/com.application/CSS/styleSheet.css @@ -0,0 +1,53 @@ +/* General css for alle the main windows */ + +/*noinspection CssUnusedSymbol*/ +.root { + -fx-pref-width: 1150; + -fx-pref-height: 600; + -fx-fill-height: true; + -fx-max-width: infinity; + -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: 250; +} + +#sideBarLabel { + -fx-pref-height: 17; + -fx-translate-x: 10; + -fx-max-height: infinity; + -fx-max-width: infinity; + -fx-font-size: 16; + -fx-font-family: Arial; +} + +#sideBarLabelText { + -fx-pref-height: 17; + -fx-translate-x: 5; + -fx-max-height: infinity; + -fx-max-width: infinity; + -fx-font-size: 16; + -fx-font-family: Arial; +} + +#sideBarButtonFinish { + -fx-translate-x: 5; + -fx-translate-y: 20; + -fx-pref-width: infinity; + -fx-pref-height: 25; + -fx-font-size: 20; + -fx-font-family: Arial; + -fx-background-color: rgba(104, 229, 59, 1); +} + + + + diff --git a/target/classes/com.application/GUI/moelven_logo_m.jpg b/target/classes/com.application/GUI/moelven_logo_m.jpg deleted file mode 100644 index 9140870bda82d1499b6d98df0a71674fd76436ec..0000000000000000000000000000000000000000 Binary files a/target/classes/com.application/GUI/moelven_logo_m.jpg and /dev/null differ diff --git a/target/classes/com.application/GUI/moelven_logo_m.png b/target/classes/com.application/GUI/moelven_logo_m.png new file mode 100644 index 0000000000000000000000000000000000000000..7e8119a3417f0c81825bfcd3d7e5abaca0ad8115 Binary files /dev/null and b/target/classes/com.application/GUI/moelven_logo_m.png differ diff --git a/target/classes/com.application/GUI/moelven_logo_title.jpg b/target/classes/com.application/GUI/moelven_logo_title.jpg deleted file mode 100644 index 9d3f195108bc799381176c7cd5904ed1ec3fb4f6..0000000000000000000000000000000000000000 Binary files a/target/classes/com.application/GUI/moelven_logo_title.jpg and /dev/null differ diff --git a/target/classes/com.application/GUI/moelven_logo_title.png b/target/classes/com.application/GUI/moelven_logo_title.png new file mode 100644 index 0000000000000000000000000000000000000000..271d0265e0c76fb05dcb46de2e1626b59d1bf008 Binary files /dev/null and b/target/classes/com.application/GUI/moelven_logo_title.png differ diff --git a/target/classes/com.application/styleSheet.css b/target/classes/com.application/styleSheet.css deleted file mode 100644 index f2f7ab00c320a24f5891b0f2a2e6a0595cb3cee8..0000000000000000000000000000000000000000 --- a/target/classes/com.application/styleSheet.css +++ /dev/null @@ -1,25 +0,0 @@ -/* General css for alle the main windows */ - -/*noinspection CssUnusedSymbol*/ -.root { - -fx-pref-width: 1150; - -fx-pref-height: 600; - -fx-fill-height: true; - -fx-max-width: infinity; - -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 cf5b913fe5b25df78e5f87d4e74206b7819a98bb..f55cd733a771a5caab5806fc12243e1ebbed11d6 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 af7725eabeed8f31bef3c2fa8720615f22f08490..0000000000000000000000000000000000000000 Binary files a/target/classes/com/application/DB/Sort.class and /dev/null differ diff --git a/target/classes/com/application/GUI/ProgressCircleIndicator$1.class b/target/classes/com/application/GUI/ProgressCircleIndicator$1.class new file mode 100644 index 0000000000000000000000000000000000000000..d0f6619ccfc51df20025bf53bd19d1be30a483a1 Binary files /dev/null and b/target/classes/com/application/GUI/ProgressCircleIndicator$1.class differ diff --git a/target/classes/com/application/GUI/ProgressCircleIndicator$StyleableProperties$1.class b/target/classes/com/application/GUI/ProgressCircleIndicator$StyleableProperties$1.class new file mode 100644 index 0000000000000000000000000000000000000000..b2abd17a1f9d5237d8c693f2f3431d0bfa289b0c Binary files /dev/null and b/target/classes/com/application/GUI/ProgressCircleIndicator$StyleableProperties$1.class differ diff --git a/target/classes/com/application/GUI/ProgressCircleIndicator$StyleableProperties.class b/target/classes/com/application/GUI/ProgressCircleIndicator$StyleableProperties.class new file mode 100644 index 0000000000000000000000000000000000000000..6ba268984e19383c6e9f0f15d192a63540fc1a5f Binary files /dev/null and b/target/classes/com/application/GUI/ProgressCircleIndicator$StyleableProperties.class differ diff --git a/target/classes/com/application/GUI/ProgressCircleIndicator.class b/target/classes/com/application/GUI/ProgressCircleIndicator.class new file mode 100644 index 0000000000000000000000000000000000000000..f2a2a897c8389c67ee681fcc23c1f5a8f26e4975 Binary files /dev/null and b/target/classes/com/application/GUI/ProgressCircleIndicator.class differ diff --git a/target/classes/com/application/GUI/RingProgressIndicator$1.class b/target/classes/com/application/GUI/RingProgressIndicator$1.class new file mode 100644 index 0000000000000000000000000000000000000000..45e87f705c61feeef1ec2e892e8517d527ae9e7a Binary files /dev/null and b/target/classes/com/application/GUI/RingProgressIndicator$1.class differ diff --git a/target/classes/com/application/GUI/RingProgressIndicator$StyleableProperties$1.class b/target/classes/com/application/GUI/RingProgressIndicator$StyleableProperties$1.class new file mode 100644 index 0000000000000000000000000000000000000000..f6f4608ba8c4728e9567d3828a3a5dcd43664fe5 Binary files /dev/null and b/target/classes/com/application/GUI/RingProgressIndicator$StyleableProperties$1.class differ diff --git a/target/classes/com/application/GUI/RingProgressIndicator$StyleableProperties.class b/target/classes/com/application/GUI/RingProgressIndicator$StyleableProperties.class new file mode 100644 index 0000000000000000000000000000000000000000..a9481c06841d92100d649c3cc6af6a5d22a0626c Binary files /dev/null and b/target/classes/com/application/GUI/RingProgressIndicator$StyleableProperties.class differ diff --git a/target/classes/com/application/GUI/RingProgressIndicator.class b/target/classes/com/application/GUI/RingProgressIndicator.class new file mode 100644 index 0000000000000000000000000000000000000000..1f080c004c95a0e44e6bdd514c01df9ffc7cef1e Binary files /dev/null and b/target/classes/com/application/GUI/RingProgressIndicator.class differ diff --git a/target/classes/com/application/GUI/RingProgressIndicatorSkin.class b/target/classes/com/application/GUI/RingProgressIndicatorSkin.class new file mode 100644 index 0000000000000000000000000000000000000000..68574e9a1b22e916dd04365334201ee14fa7e573 Binary files /dev/null and b/target/classes/com/application/GUI/RingProgressIndicatorSkin.class differ diff --git a/target/classes/com/application/Main$1WorkerThread.class b/target/classes/com/application/Main$1WorkerThread.class new file mode 100644 index 0000000000000000000000000000000000000000..d4793f5681bdd83671fe08bf926fc358debbea06 Binary files /dev/null and b/target/classes/com/application/Main$1WorkerThread.class differ diff --git a/target/classes/com/application/Main.class b/target/classes/com/application/Main.class index 529aafa67273028ab74fc4440d51c6f3ee9d1512..fd2fd756630461a11db07cc7f98d510688c791c2 100644 Binary files a/target/classes/com/application/Main.class and b/target/classes/com/application/Main.class differ