commit 4d51cc5d011f38619d7ee294edafd135dc63e60a Author: rocaly Date: Tue Dec 5 00:40:06 2023 +0100 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0a44d59 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..47de8eb --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TD2.iml b/TD2.iml new file mode 100644 index 0000000..b6f246f --- /dev/null +++ b/TD2.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/fxml/dashboard.fxml b/resources/fxml/dashboard.fxml new file mode 100644 index 0000000..efee2d1 --- /dev/null +++ b/resources/fxml/dashboard.fxml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + +
+ + +
+ + + +
diff --git a/resources/images/play_disabled.png b/resources/images/play_disabled.png new file mode 100644 index 0000000..8cb7eeb Binary files /dev/null and b/resources/images/play_disabled.png differ diff --git a/resources/images/play_enabled.png b/resources/images/play_enabled.png new file mode 100644 index 0000000..879049c Binary files /dev/null and b/resources/images/play_enabled.png differ diff --git a/src/captor/CPUCaptor.java b/src/captor/CPUCaptor.java new file mode 100644 index 0000000..8ecea66 --- /dev/null +++ b/src/captor/CPUCaptor.java @@ -0,0 +1,22 @@ +package captor; + +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; + +import java.util.Random; + +public class CPUCaptor { + private DoubleProperty cpuLoad = new SimpleDoubleProperty(); + private Random r = new Random(); + + public CPUCaptor() { + } + + public void refreshLoadAverage() { + cpuLoad.setValue((r.nextInt(100)/100d)); + } + + public DoubleProperty getCpuLoad() { + return cpuLoad; + } +} diff --git a/src/launch/DashboardContext.java b/src/launch/DashboardContext.java new file mode 100644 index 0000000..0d89a97 --- /dev/null +++ b/src/launch/DashboardContext.java @@ -0,0 +1,12 @@ +package launch; + +import captor.CPUCaptor; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; + +public class DashboardContext { + private BooleanProperty refreshState = new SimpleBooleanProperty(false); + private CPUCaptor osCaptorService; + + //TODO CODE SINGLETON +} diff --git a/src/launch/Launch.java b/src/launch/Launch.java new file mode 100644 index 0000000..c894b86 --- /dev/null +++ b/src/launch/Launch.java @@ -0,0 +1,17 @@ +package launch; + +import javafx.application.Application; +import javafx.stage.Stage; + +public class Launch extends Application { + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage stage) throws Exception { + //TODO Load DASHBOARD.FXML + + //TODO CREATE THREAD AND REFRESH CPU LOA + } +} \ No newline at end of file diff --git a/src/view/DashboardView.java b/src/view/DashboardView.java new file mode 100644 index 0000000..9fd49d1 --- /dev/null +++ b/src/view/DashboardView.java @@ -0,0 +1,18 @@ +package view; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.control.ProgressBar; + +public class DashboardView { + @FXML + private ProgressBar cpuJauge; + + @FXML + private Label cpuUsageText; + + @FXML + public void initialize() { + //TODO BIND CPU JAUGE AND CPU TEXT + } +} diff --git a/src/view/RefreshButton.java b/src/view/RefreshButton.java new file mode 100644 index 0000000..cf7f4f9 --- /dev/null +++ b/src/view/RefreshButton.java @@ -0,0 +1,18 @@ +package view; + +import javafx.scene.control.Button; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import launch.DashboardContext; + +public class RefreshButton extends Button { + + private ImageView imageView = new ImageView(); + private Image image_enabled = new Image(this.getClass().getClassLoader().getResource("images/play_enabled.png").toExternalForm()); + private Image image_disabled =new Image(this.getClass().getClassLoader().getResource("images/play_disabled.png").toExternalForm()); + + + public RefreshButton() { + //TODO ADD IMAGE IN BUTTON + Listener on change state + Listener on click + } +}