diff --git a/.drone.yml b/.drone.yml
index 192bd46..c8ca2cb 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -2,10 +2,6 @@ kind: pipeline
type: docker
name: javaFX
-trigger:
- event:
- - push
-
steps:
- name: generate-and-deploy-docs
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer
@@ -19,7 +15,3 @@ steps:
branch:
- master
depends_on: [ build ]
-
-volumes:
- - name: docs
- temp: {}
\ No newline at end of file
diff --git a/Source/out/production/ProjetJavaFX/console/LView$1$1.class b/Source/out/production/ProjetJavaFX/console/LView$1$1.class
index b9f8657..c00a2e7 100644
Binary files a/Source/out/production/ProjetJavaFX/console/LView$1$1.class and b/Source/out/production/ProjetJavaFX/console/LView$1$1.class differ
diff --git a/Source/out/production/ProjetJavaFX/console/LView$1.class b/Source/out/production/ProjetJavaFX/console/LView$1.class
index 89019de..6be9aa3 100644
Binary files a/Source/out/production/ProjetJavaFX/console/LView$1.class and b/Source/out/production/ProjetJavaFX/console/LView$1.class differ
diff --git a/Source/out/production/ProjetJavaFX/console/LView.class b/Source/out/production/ProjetJavaFX/console/LView.class
index 8d7e77d..c50afbd 100644
Binary files a/Source/out/production/ProjetJavaFX/console/LView.class and b/Source/out/production/ProjetJavaFX/console/LView.class differ
diff --git a/Source/out/production/ProjetJavaFX/fxml/FenetrePrincipale.fxml b/Source/out/production/ProjetJavaFX/fxml/FenetrePrincipale.fxml
deleted file mode 100644
index 2e8219a..0000000
--- a/Source/out/production/ProjetJavaFX/fxml/FenetrePrincipale.fxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/Source/out/production/ProjetJavaFX/fxml/MainPage.fxml b/Source/out/production/ProjetJavaFX/fxml/MainPage.fxml
new file mode 100644
index 0000000..2f94644
--- /dev/null
+++ b/Source/out/production/ProjetJavaFX/fxml/MainPage.fxml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/out/production/ProjetJavaFX/img/th.png b/Source/out/production/ProjetJavaFX/img/th.png
new file mode 100644
index 0000000..a2ce61d
Binary files /dev/null and b/Source/out/production/ProjetJavaFX/img/th.png differ
diff --git a/Source/out/production/ProjetJavaFX/model/CapteurVirtuel.class b/Source/out/production/ProjetJavaFX/model/CapteurVirtuel.class
index b795070..68a8b15 100644
Binary files a/Source/out/production/ProjetJavaFX/model/CapteurVirtuel.class and b/Source/out/production/ProjetJavaFX/model/CapteurVirtuel.class differ
diff --git a/Source/out/production/ProjetJavaFX/model/Captor.class b/Source/out/production/ProjetJavaFX/model/Captor.class
index 2f6d758..1e9cfd1 100644
Binary files a/Source/out/production/ProjetJavaFX/model/Captor.class and b/Source/out/production/ProjetJavaFX/model/Captor.class differ
diff --git a/Source/out/production/ProjetJavaFX/view/MainPage.class b/Source/out/production/ProjetJavaFX/view/MainPage.class
new file mode 100644
index 0000000..b7cbbc3
Binary files /dev/null and b/Source/out/production/ProjetJavaFX/view/MainPage.class differ
diff --git a/Source/resource/fxml/FenetrePrincipale.fxml b/Source/resource/fxml/FenetrePrincipale.fxml
deleted file mode 100644
index 2e8219a..0000000
--- a/Source/resource/fxml/FenetrePrincipale.fxml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/Source/resource/fxml/MainPage.fxml b/Source/resource/fxml/MainPage.fxml
new file mode 100644
index 0000000..2f94644
--- /dev/null
+++ b/Source/resource/fxml/MainPage.fxml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/resource/img/th.png b/Source/resource/img/th.png
new file mode 100644
index 0000000..a2ce61d
Binary files /dev/null and b/Source/resource/img/th.png differ
diff --git a/Source/src/console/LView.java b/Source/src/console/LView.java
index 30e1e3f..87c0211 100644
--- a/Source/src/console/LView.java
+++ b/Source/src/console/LView.java
@@ -1,5 +1,7 @@
package console;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
import model.*;
import javafx.application.Application;
import javafx.collections.ObservableList;
@@ -11,14 +13,17 @@ import javafx.util.Callback;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
-import javafx.scene.layout.StackPane;
+
+import java.io.IOException;
public class LView extends Application {
@Override
- public void start(Stage primaryStage) {
- CapteurVirtuel cV1 = new CapteurVirtuel("CaVirt1");
- CapteurVirtuel cV2 = new CapteurVirtuel("CaVirt2");
+ public void start(Stage primaryStage) throws IOException {
+ CapteurVirtuel cV1 = new CapteurVirtuel("CaptVirt1");
+ CapteurVirtuel cV2 = new CapteurVirtuel("CaptVirt2");
+
+
Captor c1 = new Captor("c1");
Captor c2 = new Captor("c2");
@@ -59,6 +64,9 @@ public class LView extends Application {
cV2.addToLesCapteurs(c5);
cV2.addToLesCapteurs(c6);
+ cV1.startThread();
+ cV2.startThread();
+
captors.add(cV1);
captors.add(cV2);
@@ -92,13 +100,11 @@ public class LView extends Application {
});
listview.setItems(captors);
-
- final StackPane root = new StackPane();
- root.getChildren().add(listview);
- final Scene scene = new Scene(root);
- primaryStage.setTitle("ListView");
- primaryStage.setWidth(300);
- primaryStage.setHeight(350);
+ Parent root = FXMLLoader.load(getClass().getResource("/fxml/MainPage.fxml"));
+ Scene scene = new Scene(root);
+ primaryStage.setTitle("Station Météo");
+ primaryStage.setWidth(900);
+ primaryStage.setHeight(500);
primaryStage.setScene(scene);
primaryStage.show();
diff --git a/Source/src/model/CapteurVirtuel.java b/Source/src/model/CapteurVirtuel.java
index 8515ad0..5a89e49 100644
--- a/Source/src/model/CapteurVirtuel.java
+++ b/Source/src/model/CapteurVirtuel.java
@@ -1,6 +1,7 @@
package model;
+import javafx.application.Platform;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleStringProperty;
@@ -9,7 +10,7 @@ import javafx.collections.*;
import java.util.*;
import static model.Captor.rand;
-public class CapteurVirtuel extends Sujet{
+public class CapteurVirtuel extends Sujet implements Runnable {
private final UUID id= UUID.randomUUID();
private final StringProperty nom;
@@ -20,19 +21,7 @@ public class CapteurVirtuel extends Sujet{
public CapteurVirtuel(String nom){
this.nom= new SimpleStringProperty(nom);
this.tempMoyenne.set(0.0);
- lesCapteurs.addListener((MapChangeListener super Integer, ? super Captor>) c -> {
- this.tempMoyenne.set(this.updateData());
- System.out.println("HEY");
- });
- }
-
- public UUID getId()
- {
- return this.id;
- }
-
- public String getName(){
- return this.nom.get();
+ lesCapteurs.addListener((MapChangeListener super Integer, ? super Captor>) c -> this.updateData());
}
public DoubleProperty getTempMoyenneProperty(){
@@ -56,16 +45,11 @@ public class CapteurVirtuel extends Sujet{
return Double.toString(this.getTempMoyenne());
}
-
- public Collection getLesCapteurs(){
- return lesCapteurs.values();
- }
-
public void addToLesCapteurs(Captor c){
lesCapteurs.put((rand.nextInt()%10),c);
}
- private Double updateData() {
+ private void updateData() {
int coef = 0;
double valeurs =0;
for (Map.Entry entry : lesCapteurs.entrySet()){
@@ -73,10 +57,29 @@ public class CapteurVirtuel extends Sujet{
valeurs += entry.getKey() * entry.getValue().getTemperature();
}
if (coef==0 || valeurs==0){
- return 0.0;
+ this.tempMoyenne.set(0.0);
}else {
- return valeurs / coef;
+ this.tempMoyenne.set(valeurs/coef);
}
}
+ @Override
+ public void run(){
+ while (true){
+ Platform.runLater(this::updateData);
+ try{
+ Thread.sleep(1);
+ }
+ catch (InterruptedException e){
+ break;
+ }
+ }
+ }
+
+ public void startThread(){
+ Thread threadVirtualCaptor = new Thread(this);
+ threadVirtualCaptor.setDaemon(true);
+ threadVirtualCaptor.start();
+ }
+
}
diff --git a/Source/src/model/Captor.java b/Source/src/model/Captor.java
index 790c844..ba481c9 100644
--- a/Source/src/model/Captor.java
+++ b/Source/src/model/Captor.java
@@ -19,7 +19,7 @@ public class Captor implements Runnable{
public Captor(String name){
this.name=new SimpleStringProperty(name);
- this.temperature=new SimpleDoubleProperty(1.0);
+ this.temperature=new SimpleDoubleProperty(5.0);
}
public UUID getId()
@@ -48,7 +48,7 @@ public class Captor implements Runnable{
while (true){
Platform.runLater(()->setTemperature(rand.nextDouble(80.)-20.));
try{
- Thread.sleep(5000);
+ Thread.sleep(2999);
}
catch (InterruptedException e){
break;
diff --git a/Source/src/view/MainPage.java b/Source/src/view/MainPage.java
new file mode 100644
index 0000000..675d055
--- /dev/null
+++ b/Source/src/view/MainPage.java
@@ -0,0 +1,19 @@
+package view;
+
+import console.LView;
+import javafx.event.EventHandler;
+import javafx.fxml.FXML;
+
+import java.awt.event.MouseEvent;
+
+
+public class MainPage {
+ @FXML
+ private javafx.scene.control.Label labelAvecBinding;
+ @FXML
+ public void initialize() {
+
+ labelAvecBinding.textProperty().set("CPU Temperature");
+
+ }
+}