Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mesji/bacheloroppgave_2022
1 result
Show changes
Showing
with 2732 additions and 198 deletions
package com.application.GUI.Panes;
import com.application.DB.Constants;
import com.application.GUI.LineChartFunctionality;
import com.application.Main;
import javafx.geometry.Pos;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
public class BottomBar {
private final Main main;
public BottomBar(Main main) {
this.main = main;
}
public HBox createBottomBar() {
HBox hBox = new HBox();
Label liveDataText = new Label("View Live Data");
main.setLiveDataBox(new CheckBox());
Main.getLiveDataBox().setSelected(Constants.DEFAULT_IS_SELECTED_LIVE_DATA);
Main.getLiveDataBox().setOnAction(event -> {
if (Main.getLiveDataBox().isSelected()) {
LineChartFunctionality.setPrintLiveData(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintLiveData(false);
LineChartFunctionality.printGraphs();
}
});
Label regressionText = new Label("View Regression");
main.setRegressionBox(new CheckBox());
Main.getRegressionBox().setSelected(Constants.DEFAULT_IS_SELECTED_REGRESSION);
Main.getRegressionBox().setOnAction(event -> {
if (Main.getRegressionBox().isSelected()) {
LineChartFunctionality.setPrintRegression(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintRegression(false);
LineChartFunctionality.printGraphs();
}
});
Label regressionConfidenceIntervalText = new Label("View Regression Shadow");
main.setRegressionConfidenceIntervalBox(new CheckBox());
Main.getRegressionConfidenceIntervalBox().setSelected(Constants.DEFAULT_IS_SELECTED_REGRESSION_SHADOW);
Main.getRegressionConfidenceIntervalBox().setOnAction(event -> {
if (Main.getRegressionConfidenceIntervalBox().isSelected()) {
LineChartFunctionality.setPrintRegressionConfidenceInterval(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintRegressionConfidenceInterval(false);
LineChartFunctionality.printGraphs();
}
});
Label previousText = new Label("View Previous Data");
main.setPreviousBox(new CheckBox());
Main.getPreviousBox().setSelected(Constants.DEFAULT_IS_SELECTED_PREVIOUS_DATA);
Main.getPreviousBox().setOnAction(event -> {
if (Main.getPreviousBox().isSelected()) {
LineChartFunctionality.setPrintPreviousData(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintPreviousData(false);
LineChartFunctionality.printGraphs();
}
});
hBox.getChildren().addAll(liveDataText, Main.getLiveDataBox(), regressionText, Main.getRegressionBox(), regressionConfidenceIntervalText, Main.getRegressionConfidenceIntervalBox(), previousText, Main.getPreviousBox());
hBox.setAlignment(Pos.CENTER_RIGHT);
hBox.setSpacing(5);
return hBox;
}
}
\ No newline at end of file
package com.application.GUI.Panes;
import com.application.GUI.PopUpWindows.LoginPopup;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import static com.application.DB.Constants.isIsAdmin;
public class LogoBar {
private static Button login = new Button("Login");
/**
* This function imports the logos and defines the alignments
*
* @return a logoBar containing the logos in proper alignments
* @throws FileNotFoundException
*/
public HBox createLogoBar() throws FileNotFoundException {
// Defining the image paths
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);
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);
Region region2 = new Region();
HBox.setHgrow(region2, Priority.ALWAYS);
// Login button
getLogin().setOnAction(event -> {
if(getLogin().getText().equals("Login")){
LoginPopup.login();
} else {
if(isIsAdmin()){
LoginPopup.adminPopup();
} else {
LoginPopup.userPopup();
}
}
});
return new HBox(imageViewM, region1, imageViewTitle, region2, getLogin());
}
public static Button getLogin() {
return login;
}
}
\ No newline at end of file
package com.application.GUI.Panes;
import com.application.DB.Constants;
import com.application.GUI.LineChartFunctionality;
import com.application.GUI.PopUpWindows.NotificationPopUp;
import com.application.Main;
import javafx.scene.control.CheckMenuItem;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
public class MenuBar {
private final Main main;
public MenuBar(Main main) {
this.main = main;
}
/**
* Creates the menubar with buttons.
* Defines each action when button is clicked.
*
* @return MenuBar as a HBox
*/
public javafx.scene.control.MenuBar createMenuBar() {
// Creating a menubar
javafx.scene.control.MenuBar menuBar = new javafx.scene.control.MenuBar();
// Defining the individual menus
Menu menuFile = new Menu("File");
Menu menuView = new Menu("View");
Menu menuHelp = new Menu("Help");
MenuItem menuFileExit = new MenuItem("Exit");
menuFileExit.setOnAction(event -> Main.exitApplication());
Main.setMenuViewLiveData(new CheckMenuItem("Live Data"));
main.setMenuViewRegression(new CheckMenuItem("Regression"));
main.setMenuViewRegressionShadow(new CheckMenuItem("Regression Shadow"));
main.setMenuViewPreviousData(new CheckMenuItem("Previous Data"));
Main.getMenuViewLiveData().setSelected(Constants.DEFAULT_IS_SELECTED_LIVE_DATA);
Main.getMenuViewRegression().setSelected(Constants.DEFAULT_IS_SELECTED_REGRESSION);
Main.getMenuViewRegressionShadow().setSelected(Constants.DEFAULT_IS_SELECTED_REGRESSION_SHADOW);
Main.getMenuViewPreviousData().setSelected(Constants.DEFAULT_IS_SELECTED_PREVIOUS_DATA);
Main.getMenuViewLiveData().setOnAction(event -> {
if (Main.getMenuViewLiveData().isSelected()) {
LineChartFunctionality.setPrintLiveData(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintLiveData(false);
LineChartFunctionality.printGraphs();
}
});
Main.getMenuViewRegression().setOnAction(event -> {
if (Main.getMenuViewRegression().isSelected()) {
LineChartFunctionality.setPrintRegression(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintRegression(false);
LineChartFunctionality.printGraphs();
}
});
Main.getMenuViewRegressionShadow().setOnAction(event -> {
if (Main.getMenuViewRegressionShadow().isSelected()) {
LineChartFunctionality.setPrintRegressionConfidenceInterval(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintRegressionConfidenceInterval(false);
LineChartFunctionality.printGraphs();
}
});
Main.getMenuViewPreviousData().setOnAction(event -> {
if (Main.getMenuViewPreviousData().isSelected()) {
LineChartFunctionality.setPrintPreviousData(true);
LineChartFunctionality.printGraphs();
} else {
LineChartFunctionality.setPrintPreviousData(false);
LineChartFunctionality.printGraphs();
}
});
MenuItem aboutUs = new MenuItem("About Us");
aboutUs.setOnAction(event -> getAboutUs());
MenuItem help = new MenuItem("Help");
help.setOnAction(event -> getHelp());
menuFile.getItems().addAll(menuFileExit);
menuView.getItems().addAll(Main.getMenuViewLiveData(), Main.getMenuViewRegression(), Main.getMenuViewRegressionShadow(), Main.getMenuViewPreviousData());
menuHelp.getItems().addAll(aboutUs, help);
// Adding the menus to the menubar
menuBar.getMenus().addAll(menuFile, menuView, menuHelp);
// Returns the menubar
return menuBar;
}
private static void getAboutUs(){
String message = "Hei! Dette er en veldig lang string som sikkert går utenfor window! Dette er About us section!";
NotificationPopUp.displayNotificationWindow(message);
}
private static void getHelp(){
String message = "Hei! Dette er en veldig lang string som sikkert går utenfor window! Dette er Help section!";
NotificationPopUp.displayNotificationWindow(message);
}
}
\ No newline at end of file
package com.application.GUI.Panes;
import com.application.DB.Constants;
import com.application.GUI.PopUpWindows.InputPopup;
import com.application.GUI.PopUpWindows.OutputPopup;
import com.application.GUI.ProgressBar.RingProgressIndicator;
import com.application.Main;
import javafx.application.Platform;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import java.util.logging.Logger;
import static com.application.DB.HelpingFunctions.isLoadedData;
import static com.application.DB.Settings.NUMBER_OF_SECONDS_LIVE_DATA;
import static com.application.GUI.LineChartFunctionality.getDataPointsXAxis;
import static com.application.GUI.LineChartFunctionality.getLiveData;
import static java.util.logging.Level.SEVERE;
public class SideBar {
public SideBar(Main main) {
}
public VBox createSideBar() {
// Creating a vbox
VBox sideBarVBox = new VBox();
Label treeSpeciesLabel = new Label("Tree Species");
treeSpeciesLabel.setId("sideBarLabelText");
Main.setTreeSpeciesText(new TextField());
Main.getTreeSpeciesText().setId("sideBarLabelText");
Main.getTreeSpeciesText().setPromptText("No Input");
Main.getTreeSpeciesText().setText(Constants.TREE_SPECIES);
Main.getTreeSpeciesText().setEditable(false);
Label dimensionsLabel = new Label("Width x Height");
dimensionsLabel.setId("sideBarLabelText");
Main.setDimensionsText(new TextField());
Main.getDimensionsText().setId("sideBarLabelText");
Main.getDimensionsText().setPromptText("No Input");
Main.getDimensionsText().setText(Constants.DIMENSIONS);
Main.getDimensionsText().setEditable(false);
Label sawsetLabel = new Label("Sawset");
sawsetLabel.setId("sideBarLabelText");
Main.setSawsetText(new TextField());
Main.getSawsetText().setId("sideBarLabelText");
Main.getSawsetText().setPromptText("No Input");
Main.getSawsetText().setText(Constants.SAWSET);
Main.getSawsetText().setEditable(false);
Label moistureGoalLabel = new Label("Moisture Goal");
moistureGoalLabel.setId("sideBarLabelText");
Main.setMoistureGoalText(new TextField());
Main.getMoistureGoalText().setId("sideBarLabelText");
Main.getMoistureGoalText().setPromptText("No Input");
Main.getMoistureGoalText().setText(Constants.MOISTURE_GOAL);
Main.getMoistureGoalText().setEditable(false);
Label timeLeftLabel = new Label("Time Left");
timeLeftLabel.setId("sideBarLabelText");
Main.setTimeLeftText(new TextField());
Main.getTimeLeftText().setId("sideBarLabelText");
Main.getTimeLeftText().setPromptText("Calculating...");
Main.getTimeLeftText().setText(Constants.TIME_LEFT);
Main.getTimeLeftText().setEditable(false);
Button inputParametersButton = new Button("Input Parameters");
inputParametersButton.setId("sideBarButtonInputParameters");
inputParametersButton.setOnAction(e -> InputPopup.display());
Button finishButton = new Button("Finish");
finishButton.setId("sideBarButtonFinish");
finishButton.setOnAction(e -> OutputPopup.displayOutputWindow());
Button exitButton = new Button("Exit");
exitButton.setId("sideBarButtonExit");
exitButton.setOnAction(e -> Main.exitApplication());
// 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() {
while (!Constants.IS_FINISHED) {
try {
ringProgressIndicator.makeIndeterminate();
Thread.sleep(500L * NUMBER_OF_SECONDS_LIVE_DATA);
} catch (InterruptedException e) {
e.printStackTrace();
}
while (isLoadedData()) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
Logger.getLogger(getClass().getName()).log(SEVERE, null, e);
}
Platform.runLater(() -> rpi.setProgress(progress));
progress = getLiveData().size()/ getDataPointsXAxis()*100;
if (progress > 100) {
break;
}
}
}
}
}
new WorkerThread(ringProgressIndicator).start();
sideBarVBox.getChildren().addAll(ringProgressIndicator, treeSpeciesLabel, Main.getTreeSpeciesText(), dimensionsLabel, Main.getDimensionsText(),
sawsetLabel, Main.getSawsetText(), moistureGoalLabel, Main.getMoistureGoalText(), timeLeftLabel, Main.getTimeLeftText(), inputParametersButton, finishButton, exitButton);
VBox.setVgrow(sideBarVBox, Priority.ALWAYS);
return sideBarVBox;
}
}
\ No newline at end of file
package com.application.GUI.PopUpWindows;
import com.application.DB.Constants;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;
import static com.application.DB.HelpingFunctions.isValidInput;
import static com.application.DB.Settings.*;
import static com.application.DB.DB.getCurrentDrying;
import static com.application.DB.Constants.MAX_USER_INPUT_CHARACTERS;
import static com.application.DB.HelpingFunctions.setLoadedData;
import static com.application.GUI.LineChartFunctionality.*;
import static com.application.Main.*;
import static com.application.DB.DB.setInputParameters;
/**
* This class handles the popup input window
*
* @author Eilert Tunheim, Karin Pettersen, Mads Arnesen
* @version 1.0
*/
public class InputPopup {
public static void display() {
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Input Parameters");
// Top
Label inputLabel= new Label("Input");
inputLabel.setId("inputTop");
// Center - Input fields
// Tree species
Label treeSpeciesInputLabel = new Label("Tree Species");
treeSpeciesInputLabel.setId("inputLabel");
ObservableList<String> treeSpecies = FXCollections.observableArrayList(
"Furu",
"Gran"
);
ComboBox<String> treeSpeciesList = new ComboBox<>(treeSpecies);
treeSpeciesList.setPromptText("Select Tree Species");
treeSpeciesList.setId("inputDropDownBox");
treeSpeciesList.setEditable(true);
// Dimensions
Label dimensionsInputLabel = new Label("Dimensions");
dimensionsInputLabel.setId("inputLabel");
ObservableList<String> dimensions = FXCollections.observableArrayList(
"47x150",
"47x175",
"47x200",
"47x225",
"47x250",
"50x150",
"50x175",
"50x200",
"50x225",
"50x250"
);
ComboBox<String> dimensionsList = new ComboBox<>(dimensions);
dimensionsList.setPromptText("Select Dimensions");
dimensionsList.setId("inputDropDownBox");
dimensionsList.setEditable(true);
// Sawset
Label sawsetInputLabel = new Label("Sawset");
sawsetInputLabel.setId("inputLabel");
ObservableList<String> sawset = FXCollections.observableArrayList(
"1ex",
"2ex",
"3ex",
"4ex"
);
ComboBox<String> sawsetList = new ComboBox<>(sawset);
sawsetList.setPromptText("Select Sawset");
sawsetList.setId("inputDropDownBox");
sawsetList.setEditable(true);
// Moisture
Label moistureGoalInputLabel = new Label("Moisture Goal");
moistureGoalInputLabel.setId("inputLabel");
ObservableList<String> moistureGoal = FXCollections.observableArrayList(
"10%",
"12%",
"14%",
"16%",
"18%",
"20%"
);
ComboBox<String> moistureList = new ComboBox<>(moistureGoal);
moistureList.setPromptText("Select Moisture Goal");
moistureList.setId("inputDropDownBox");
moistureList.setEditable(true);
// Bottom - start button
Button startButton = new Button("Start");
startButton.setId("inputButtonStart");
startButton.setOnAction(e -> {
// Sets the start time
Constants.CURRENT_DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
Constants.START_TIME = Constants.CURRENT_DATE;
// Retrieves the user inputs
Constants.TREE_SPECIES = treeSpeciesList.getValue();
Constants.DIMENSIONS = dimensionsList.getValue();
Constants.SAWSET = sawsetList.getValue();
if (moistureList.getValue() != null && moistureList.getValue().contains("%")) {
Constants.MOISTURE_GOAL = moistureList.getValue().replace("%", "");
} else {
Constants.MOISTURE_GOAL = moistureList.getValue();
}
boolean err = false;
// If the input is null, sets the value to be empty
if (treeSpeciesList.getValue() == null) {
Constants.TREE_SPECIES = "";
} else if (isValidInput(treeSpeciesList.getValue())) {
treeSpeciesList.setValue("");
err = true;
}
if (dimensionsList.getValue() == null) {
Constants.DIMENSIONS = "";
} else if (dimensionsList.getValue().length() > MAX_USER_INPUT_CHARACTERS) {
NotificationPopUp.displayNotificationWindow("A maximum of "+MAX_USER_INPUT_CHARACTERS+" characters is allowed!");
dimensionsList.setValue("");
err = true;
}
if (sawsetList.getValue() == null) {
Constants.SAWSET = "";
} else if (sawsetList.getValue().length() > MAX_USER_INPUT_CHARACTERS) {
NotificationPopUp.displayNotificationWindow("A maximum of "+MAX_USER_INPUT_CHARACTERS+" characters is allowed!");
sawsetList.setValue("");
err = true;
}
if (moistureList.getValue() == null) {
Constants.MOISTURE_GOAL = "";
} else if (moistureList.getValue().length() > MAX_USER_INPUT_CHARACTERS) {
NotificationPopUp.displayNotificationWindow("A maximum of "+MAX_USER_INPUT_CHARACTERS+" characters is allowed!");
moistureList.setValue("");
err = true;
}
if (!err) {
setTreeSpeciesText(Constants.TREE_SPECIES);
setDimensionsText(Constants.DIMENSIONS);
setSawsetText(Constants.SAWSET);
setMoistureGoalText(Constants.MOISTURE_GOAL);
window.close();
// Fungerende ny thread!!@@@@@
// Gather data
try {
Thread thread = new Thread(() -> {
try {
setLoadedData(false);
// Henter her data fra databasen
Map<Integer, Map<String, Number>> data = setInputParameters();
Platform.runLater(() -> {
try {
loadSingleSeries(data);
setLoadedData(true);
} catch (Exception ex) {
ex.printStackTrace();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
);
thread.setDaemon(true);
thread.interrupt();
thread.join();
//Platform.exit();
thread.start();
} catch (Exception ex) {
ex.printStackTrace();
}
// Retrieve data for current drying period
try {
Thread liveDataThread = new Thread(() -> {
try {
while (!Constants.IS_FINISHED) {
Constants.STOP_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
Map<String, Number> data = getCurrentDrying();
Platform.runLater(() -> {
try {
loadLiveData(data);
} catch (Exception ex) {
ex.printStackTrace();
}
});
Thread.sleep(1000L * NUMBER_OF_SECONDS_LIVE_DATA);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
);
liveDataThread.setDaemon(true);
liveDataThread.interrupt();
liveDataThread.join();
//Platform.exit();
liveDataThread.start();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
);
/*
// Fungerende ny thread!!@@@@@
try{
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
// Henter her data fra databasen
loadSingleSeries(setInputParameters());
//loadSingleSeries();
//loadMultipleSeries();
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
thread.start();
} catch (Exception ex) {
ex.printStackTrace();
}
}
);
*/
/*
class KwhThread implements Runnable {
Map<Integer, Map<String, Number>> dataVariable;
private volatile boolean finished;
@Override
public void run() {
try{
dataVariable = setInputParameters();
} catch (Exception ex) {
ex.printStackTrace();
}
finished = true;
synchronized (this){
this.notify();
}
}
public Map<Integer, Map<String, Number>> getDataVariable() throws InterruptedException {
synchronized (this){
if(!finished)
this.wait();
}
return dataVariable;
}
}
KwhThread kwhThread = new KwhThread();
Thread thread = new Thread(kwhThread);
thread.setName("GetKwhThread");
thread.start();
try {
loadSingleSeries(kwhThread.getDataVariable());
} catch (Exception ex) {
ex.printStackTrace();
}
*/
/*
*/
VBox layout = new VBox(10);
layout.getChildren().addAll(inputLabel, treeSpeciesInputLabel, treeSpeciesList, dimensionsInputLabel, dimensionsList,
sawsetInputLabel, sawsetList, moistureGoalInputLabel, moistureList, startButton);
layout.setAlignment(Pos.CENTER);
Scene scene = new Scene(layout, 600, 500);
scene.getStylesheets().add(InputPopup.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
}
package com.application.GUI.PopUpWindows;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import static com.application.DB.AccountHandler.*;
import static com.application.DB.Constants.*;
import static com.application.GUI.Panes.LogoBar.getLogin;
public class LoginPopup {
public static PasswordField PASSWORD_TEXT_FIELD = new PasswordField();
public static void login(){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Login window");
Label userNameLabel = new Label("Username:");
Label passwordLabel = new Label("Password:");
TextField userNameTextField = new TextField();
getPasswordTextField().clear();
Button closeButton = new Button("Close");
Button loginButton = new Button("Login");
closeButton.setOnAction(event -> window.close());
loginButton.setOnAction(event -> {
try {
getAccountInformation(userNameTextField.getText(), hashPassword(getPasswordTextField().getText()));
if(getLogin().getText().equals("Admin")) {
LoginPopup.adminPopup();
window.close();
}
} catch (Exception e) {
e.printStackTrace();
}
if(!getLogin().getText().equals("Login")){
window.close();
}
});
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(userNameLabel, userNameTextField, passwordLabel, getPasswordTextField(), loginButton, closeButton);
Scene scene = new Scene(layout, 500, 300);
scene.getStylesheets().add(InputPopup.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
public static void adminPopup(){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Admin window");
Label usernameLabel = new Label("Username: ");
TextField usernameTextfield = new TextField();
usernameTextfield.setText(getUserName());
usernameTextfield.setEditable(false);
Button addUser = new Button("Add User");
Button deleteUser = new Button("Delete User");
Button logout = new Button("Logout");
Button close = new Button("Close");
addUser.setOnAction(event -> {
adminAddUser();
});
deleteUser.setOnAction(event -> {
adminDeleteUser();
});
logout.setOnAction(event -> {
logout();
window.close();
});
close.setOnAction(event -> window.close());
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(usernameLabel, usernameTextfield, addUser, deleteUser, logout, close);
Scene scene = new Scene(layout, 500, 300);
scene.getStylesheets().add(InputPopup.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
public static void adminAddUser(){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Admin window");
Label firstNameLabel = new Label("First Name: ");
Label lastNameLabel = new Label("Last Name: ");
Label phoneNoLabel = new Label("Phone No: ");
Label usernameLabel = new Label("Username: ");
Label passwordFirstLabel = new Label("Password : ");
Label passwordSecondLabel = new Label("Password Repeat: ");
Label isAdminLabel = new Label("Is Admin: ");
TextField firstNameTextField = new TextField();
TextField lastNameTextField = new TextField();
TextField phoneNoTextField = new TextField();
TextField usernameTextField = new TextField();
PasswordField passwordFirstField = new PasswordField();
PasswordField passwordSecondField = new PasswordField();
CheckBox isAdminBox = new CheckBox();
isAdminBox.setSelected(false);
Button close = new Button("Close");
Button addUser = new Button("Add User");
close.setOnAction(event -> window.close());
addUser.setOnAction(event -> {
// If the passwords match each other, add the user, if not display an errormessage
if(passwordFirstField.getText().contentEquals(passwordSecondField.getText())){
// Hashing the password if they match.
String hashedPassword = hashPassword(passwordFirstField.getText());
// Tries to add the user
try {
if(addUser(firstNameTextField.getText(), lastNameTextField.getText(), phoneNoTextField.getText(),
usernameTextField.getText(), hashedPassword, isAdminBox.isSelected())){
NotificationPopUp.displayNotificationWindow("Successfully added user!");
window.close();
} else NotificationPopUp.displayNotificationWindow("That username already exist in the database!");
} catch (Exception e) {
e.printStackTrace();
}
} else {
NotificationPopUp.displayNotificationWindow("Passwords does not match!");
passwordFirstField.clear();
passwordSecondField.clear();
}
});
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(firstNameLabel, firstNameTextField, lastNameLabel, lastNameTextField,
phoneNoLabel, phoneNoTextField, usernameLabel, usernameTextField,
passwordFirstLabel, passwordFirstField, passwordSecondLabel, passwordSecondField,
isAdminLabel, isAdminBox, addUser, close);
Scene scene = new Scene(layout, 500, 600);
scene.getStylesheets().add(InputPopup.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
public static void adminDeleteUser(){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Admin window");
Label usernameLabel = new Label("Username: ");
TextField usernameTextField = new TextField();
Button close = new Button("Close");
Button delete = new Button("Delete User");
close.setOnAction(event -> window.close());
delete.setOnAction(event -> {
try {
boolean results = deleteUser(usernameTextField.getText());
if(results){
NotificationPopUp.displayNotificationWindow(usernameTextField.getText()+" was successfully deleted!");
window.close();
} else {
NotificationPopUp.displayNotificationWindow("Could not find username: " + usernameTextField.getText());
usernameTextField.clear();
}
} catch (Exception e) {
e.printStackTrace();
}
});
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(usernameLabel, usernameTextField, delete, close);
Scene scene = new Scene(layout, 500, 300);
scene.getStylesheets().add(InputPopup.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
public static void logout(){
getLogin().setText("Login");
setFirstName("");
setLastName("");
setIsAdmin(false);
setPhoneNo("");
setUserName("");
}
public static void userPopup(){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("User window");
Label nameLabel = new Label("Name: ");
Label phoneNoLabel = new Label("Phone no: ");
TextField nameTextfield = new TextField();
TextField phoneNoTextField = new TextField();
nameTextfield.setEditable(false);
phoneNoTextField.setEditable(false);
nameTextfield.setText(getFirstName() + " " + getLastName());
phoneNoTextField.setText(getPhoneNo());
Button close = new Button("Close");
Button logout = new Button("Logout");
close.setOnAction(event -> window.close());
logout.setOnAction(event -> {
logout();
window.close();
});
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(nameLabel, nameTextfield, phoneNoLabel, phoneNoTextField, logout, close);
Scene scene = new Scene(layout, 500, 300);
scene.getStylesheets().add(InputPopup.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
public static String hashPassword(String password){
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-512");
assert messageDigest != null;
messageDigest.update(password.getBytes(StandardCharsets.UTF_8));
byte[] hashedPassword = messageDigest.digest();
StringBuilder hashedPasswordString = new StringBuilder();
for (byte b: hashedPassword) {
hashedPasswordString.append(String.format("%02x",b));
}
return hashedPasswordString.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static PasswordField getPasswordTextField() {
return PASSWORD_TEXT_FIELD;
}
}
package com.application.GUI.PopUpWindows;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class NotificationPopUp {
public static void displayNotificationWindow(String message){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Notification window");
Label messageLabel = new Label();
messageLabel.setText(message);
messageLabel.setWrapText(true);
messageLabel.setTextAlignment(TextAlignment.CENTER);
Button close = new Button("Close");
close.setOnAction(event -> window.close());
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(messageLabel,close);
Scene scene = new Scene(layout, 300, 200);
scene.getStylesheets().add(InputPopup.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
}
package com.application.GUI.PopUpWindows;
import com.application.DB.Constants;
import com.application.DB.DB;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import static com.application.DB.Constants.IS_FINISHED;
import static com.application.DB.Constants.MAX_USER_INPUT_CHARACTERS;
public class OutputPopup {
public static void displayOutputWindow(){
Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Moisture Check");
// Top
Label moistureCheckLabelHuge = new Label("Moisture Check");
moistureCheckLabelHuge.setId("inputTop");
moistureCheckLabelHuge.setAlignment(Pos.TOP_CENTER);
// Center - Output field
TextField moistureCheckTextField = new TextField();
moistureCheckTextField.setId("inputLabel");
moistureCheckTextField.setAlignment(Pos.CENTER);
moistureCheckTextField.setPromptText("Please enter a value");
// Bottom - Buttons
Button countinueButton = new Button("Continue");
countinueButton.setId("inputButtonStart");
countinueButton.setAlignment(Pos.BOTTOM_CENTER);
countinueButton.setOnAction(e -> {
try {
boolean err = false;
if(moistureCheckTextField.getCharacters().length() > MAX_USER_INPUT_CHARACTERS){
err = true;
}
if(!err){
if(!moistureCheckTextField.getCharacters().toString().isEmpty() &&
!moistureCheckTextField.getCharacters().toString().equals("Please enter a value")) {
Constants.STOP_TIME = null;
DB.pushManMoisture(moistureCheckTextField.getCharacters().toString());
Constants.NUMBER_OF_CHECKS++;
window.close();
} else {
NotificationPopUp.displayNotificationWindow("Please enter a value!");
moistureCheckTextField.setPromptText("Please enter a value");
}
} else {
NotificationPopUp.displayNotificationWindow("A maximum of "+MAX_USER_INPUT_CHARACTERS+" characters is allowed!");
moistureCheckTextField.setText("");
moistureCheckTextField.setPromptText("Please enter a value");
}
} catch (Exception ex) {
ex.printStackTrace();
}
});
Button finishButton = new Button("Finish");
finishButton.setId("inputButtonStart");
finishButton.setAlignment(Pos.BOTTOM_CENTER);
finishButton.setOnAction(e -> {
try {
boolean err = false;
if(moistureCheckTextField.getCharacters().length() > MAX_USER_INPUT_CHARACTERS){
err = true;
}
if(!err) {
if (!moistureCheckTextField.getCharacters().toString().isEmpty() &&
!moistureCheckTextField.getCharacters().toString().equals("Please enter a value")) {
IS_FINISHED = true;
Constants.STOP_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now());
DB.pushManMoisture(moistureCheckTextField.getCharacters().toString());
window.close();
} else {
NotificationPopUp.displayNotificationWindow("Please enter a value!");
moistureCheckTextField.setPromptText("Please enter a value");
}
} else {
NotificationPopUp.displayNotificationWindow("A maximum of "+MAX_USER_INPUT_CHARACTERS+" characters is allowed!");
moistureCheckTextField.setText("");
moistureCheckTextField.setPromptText("Please enter a value");
}
} catch (Exception ex) {
ex.printStackTrace();
}
});
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.setSpacing(10);
layout.getChildren().addAll(moistureCheckLabelHuge,moistureCheckTextField,countinueButton,finishButton);
Scene scene = new Scene(layout, 600, 500);
scene.getStylesheets().add(InputPopup.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
}
}
/*
* 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.ProgressBar;
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;
}
}
/*
* 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.ProgressBar;
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;
}
}
/*
* 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.ProgressBar;
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();
}
}
This diff is collapsed.
.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
.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);
}
/*
Css for main window styling
*/
.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 styling
*/
#sideBar {
-fx-pref-width: 250;
-fx-pref-height: infinity;
}
#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;
}
#sideBarButtonInputParameters {
-fx-translate-x: 5;
-fx-translate-y: 20;
-fx-pref-width: infinity;
-fx-pref-height: 25;
-fx-font-size: 16;
-fx-font-weight: 200;
-fx-font-family: Arial;
}
#sideBarButtonFinish {
-fx-translate-x: 5;
-fx-translate-y: 50;
-fx-pref-width: infinity;
-fx-pref-height: 25;
-fx-font-size: 20;
-fx-font-family: Arial;
-fx-background-color: rgba(104, 229, 59, 1);
}
#sideBarButtonExit {
-fx-translate-x: 5;
-fx-translate-y: 75;
-fx-pref-width: infinity;
-fx-pref-height: 25;
-fx-font-size: 20;
-fx-font-family: Arial;
-fx-background-color: Red;
-fx-text-fill: white;
}
/*
BottomBar styling
*/
#bottomBar {
-fx-pref-width: infinity;
-fx-pref-height: 50;
}
#bottomBarButtons {
-fx-alignment: center-right;
-fx-tile-alignment: center-right;
-fx-translate-x: -5;
-fx-pref-width: 150;
-fx-pref-height: 25;
}
/*
Input popup window
*/
#inputTop {
-fx-alignment: top-center;
-fx-font-size: 24;
-fx-font-weight: 700;
-fx-font-family: Arial;
-fx-text-fill: rgba(12, 76, 81, 1);
-fx-pref-width: 200;
}
#inputCenter {
-fx-alignment: center;
}
#inputBottom {
-fx-alignment: bottom-center;
}
#inputLabel {
-fx-pref-height: 17;
-fx-translate-x: 10;
-fx-pref-width: 100;
-fx-max-height: infinity;
-fx-max-width: infinity;
-fx-font-size: 16;
-fx-font-family: Arial;
}
#inputDropDownBox {
-fx-pref-height: 17;
-fx-pref-width: 500;
-fx-translate-x: 5;
-fx-max-height: infinity;
-fx-alignment: center-left;
-fx-font-size: 16;
-fx-font-family: Arial;
}
#inputButtonStart {
-fx-pref-width: 200;
-fx-translate-y: 10;
-fx-pref-height: 25;
-fx-font-size: 20;
-fx-font-family: Arial;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-text-fill: white;
-fx-alignment: bottom-center;
}
#inputButtonExit {
-fx-pref-width: infinity;
-fx-translate-y: 10;
-fx-pref-height: 25;
-fx-font-size: 20;
-fx-font-family: Arial;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-text-fill: white;
-fx-alignment: bottom-center;
}
.chart-series-line {
-fx-stroke-width: 7px;
-fx-effect: null;
}
.chart-earlier-data-line {
-fx-stroke-width: 1px;
-fx-effect: null;
}
.default-color0.chart-earlier-data-line{-fx-stroke: black; -fx-opacity: 1.0}
.default-color1.chart-series-line{-fx-stroke: green; -fx-opacity: 1.0}
.default-color2.chart-series-line{-fx-stroke: red; -fx-opacity: 0.1}
.default-color3.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color4.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color5.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color6.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color7.chart-earlier-data-line{-fx-stroke: rgba(0,168,355,0.3); -fx-opacity: 0.1}
.default-color0.chart-line-symbol{-fx-background-color: black,white;}
.default-color1.chart-line-symbol{-fx-background-color: green,green;}
.default-color2.chart-line-symbol{-fx-background-color: red,red;}
.default-color3.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color4.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color5.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color6.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
.default-color7.chart-line-symbol{-fx-background-color: rgba(0,168,355,0.3),white;}
src/main/resources/com.application/GUI/moelven_logo_m.jpg

80.6 KiB

src/main/resources/com.application/GUI/moelven_logo_m.png

24 KiB