diff --git a/build.gradle b/build.gradle index 6c73977..43e0867 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,18 @@ buildscript { repositories { mavenCentral() + maven { + url "https://plugins.gradle.org/m2/" + } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE") + classpath("org.openjfx:javafx-plugin:0.0.7") } } +//plugins { +// id "org.openjfx.javafxplugin" version "0.0.7" +//} apply plugin: 'java' apply plugin: 'eclipse' @@ -15,9 +22,11 @@ apply plugin: 'io.spring.dependency-management' apply plugin: 'jacoco' apply plugin: 'checkstyle' +//apply plugin: 'org.openjfx.javafxplugin' + tasks.withType(Checkstyle) { reports { - html.destination rootProject.file("reports/checkstyle.html") + html.destination rootProject.file("build/reports/checkstyle.html") } } @@ -81,3 +90,5 @@ jacocoTestReport { bootJar { mainClassName = 'Client.Application' } + + diff --git a/src/Client/build.gradle b/src/Client/build.gradle index 7345cb7..9b01f2b 100644 --- a/src/Client/build.gradle +++ b/src/Client/build.gradle @@ -70,7 +70,7 @@ dependencies { } jacoco { - toolVersion = "0.8.2" + toolVersion = "0.8.3" reportsDir = file("$buildDir/customJacocoReportDir") } diff --git a/src/Client/src/main/java/gogreen/client/Application.java b/src/Client/src/main/java/gogreen/client/Application.java index f747405..574a1a8 100644 --- a/src/Client/src/main/java/gogreen/client/Application.java +++ b/src/Client/src/main/java/gogreen/client/Application.java @@ -6,13 +6,9 @@ import javafx.scene.Scene; import javafx.stage.Stage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.web.client.RestTemplate; @SpringBootApplication public class Application extends javafx.application.Application { @@ -40,12 +36,19 @@ public class Application extends javafx.application.Application { @Override public void start(Stage primaryStage) throws Exception{ fxmlLoader.setLocation(this.getClass().getClassLoader().getResource("fxml/sample.fxml")); + +// fxmlLoader.setLocation(this.getClass().getClassLoader().getResource("fxml/dashboard.fxml")); + + rootNode = fxmlLoader.load(); // rootNode = FXMLLoader.load(this.getClass().getClassLoader().getResource("fxml/sample.fxml")); primaryStage.setTitle("GoGreen"); Scene scene = new Scene(rootNode); + + // scene.getStylesheets().add(getClass().getResource("stylesheets/dashboardStyle.css").toExternalForm()); + primaryStage.setScene(scene); primaryStage.show(); } diff --git a/src/Client/src/main/java/gogreen/client/controller/DashBoardController.java b/src/Client/src/main/java/gogreen/client/controller/DashBoardController.java new file mode 100644 index 0000000..5b4bcb0 --- /dev/null +++ b/src/Client/src/main/java/gogreen/client/controller/DashBoardController.java @@ -0,0 +1,78 @@ +package gogreen.client.controller; + +import gogreen.client.rest.UserService; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.effect.DropShadow; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.AnchorPane; +import org.springframework.beans.factory.annotation.Autowired; + +public class DashBoardController { + @Autowired + UserService userService; + + @FXML + public AnchorPane menuBar; + public AnchorPane dashboardPane; + public AnchorPane userPane; + public AnchorPane activitiesPane; + public Label welcomebacktext; +// public Button addActivityButton; +// public ComboBox addActivity; + + @FXML + public Label dashboardText; + public Label activitiesText; + public Label userText; + public Button dashboardButton; + public Button activitiesButton; + public Button userButton; + + DropShadow shadow = new DropShadow(); + + public void handleClickAction(MouseEvent event) { + if (event.getTarget() == dashboardButton) { + dashboardPane.setVisible(true); + userPane.setVisible(false); + activitiesPane.setVisible(false); + } else if (event.getTarget() == activitiesButton){ + dashboardPane.setVisible(false); + userPane.setVisible(false); + activitiesPane.setVisible(true); + } else if (event.getTarget() == userButton) { + dashboardPane.setVisible(false); + userPane.setVisible(true); + activitiesPane.setVisible(false); + } + } + + public void displayDashboard(ActionEvent event) { + dashboardPane.setVisible(true); + userPane.setVisible(false); + activitiesPane.setVisible(false); + } + + public void displayActivities(ActionEvent event) { + dashboardPane.setVisible(false); + userPane.setVisible(false); + activitiesPane.setVisible(true); + } + + public void displayUser(ActionEvent event) { + dashboardPane.setVisible(false); + userPane.setVisible(true); + activitiesPane.setVisible(false); + } + public void addShadow(MouseEvent event) { + userButton.setEffect(shadow); + } + + public void removeShadow(MouseEvent event) { + userButton.setEffect(null); + + } + +} diff --git a/src/Client/src/main/java/gogreen/client/controller/UserController.java b/src/Client/src/main/java/gogreen/client/controller/UserController.java index 2878cf8..036a02f 100644 --- a/src/Client/src/main/java/gogreen/client/controller/UserController.java +++ b/src/Client/src/main/java/gogreen/client/controller/UserController.java @@ -4,7 +4,6 @@ import gogreen.client.rest.UserService; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; -import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; @@ -35,6 +34,8 @@ public class UserController { @FXML private Button signupButton; + + // @Value("${my.url}") // private String myUrl; @@ -68,11 +69,28 @@ public class UserController { } userService.registerUser(usernameField.getText(), passwordField.getText()); + + // load the dashboard stage // Parent parent = FXMLLoader.load(this.getClass().getClassLoader().getResource("/fxml/dashboard.fxml")); +// // Scene scene = new Scene(parent); // Stage app_stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); // app_stage.setScene(scene); +// app_stage.setFullScreen(true); // app_stage.show(); + + //on,y works once, when already logged in once, need to restart client for it to work again + openDashboard(); + + } + + public void openDashboard() throws IOException { + Parent dash = FXMLLoader.load(this.getClass().getClassLoader().getResource("fxml/Dashboard.fxml")); + Scene scene = new Scene(dash); + Stage app_stage = new Stage(); + app_stage.setScene(scene); +// app_stage.setFullScreen(true); + app_stage.show(); } public static class AlertHelper { diff --git a/src/Client/src/main/resources/fxml/dashboard.fxml b/src/Client/src/main/resources/fxml/dashboard.fxml index e40f1e1..eff9d05 100644 --- a/src/Client/src/main/resources/fxml/dashboard.fxml +++ b/src/Client/src/main/resources/fxml/dashboard.fxml @@ -1,6 +1,62 @@ - + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Client/src/main/resources/stylesheets/dashboardStyle.css b/src/Client/src/main/resources/stylesheets/dashboardStyle.css new file mode 100644 index 0000000..e10deb1 --- /dev/null +++ b/src/Client/src/main/resources/stylesheets/dashboardStyle.css @@ -0,0 +1,5 @@ +.button { + -fx-border-width: 0px 0px 1px 0px; + -fx-border-color: #f9f9f9; + -fx-border-radius: 0%; +} \ No newline at end of file diff --git a/src/Server/build.gradle b/src/Server/build.gradle index 8bc72ca..50aeedd 100644 --- a/src/Server/build.gradle +++ b/src/Server/build.gradle @@ -58,7 +58,7 @@ dependencies { } jacoco { - toolVersion = "0.8.2" + toolVersion = "0.8.3" reportsDir = file("$buildDir/customJacocoReportDir") } @@ -70,4 +70,8 @@ jacocoTestReport { } } +checkstyle { + toolVersion = "7.6.1" +} +