diff --git a/resource/views/CapteurSimple.fxml b/resource/views/CapteurSimple.fxml
index 01a7f33..05d4614 100644
--- a/resource/views/CapteurSimple.fxml
+++ b/resource/views/CapteurSimple.fxml
@@ -7,13 +7,18 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/model/Capteur.java b/src/model/Capteur.java
index 33772e5..2f3bba6 100644
--- a/src/model/Capteur.java
+++ b/src/model/Capteur.java
@@ -1,7 +1,11 @@
package model;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.beans.property.IntegerProperty;
import javafx.beans.property.Property;
import javafx.beans.property.StringProperty;
+import javafx.scene.control.SpinnerValueFactory;
public abstract class Capteur {
protected StringProperty id;
@@ -35,11 +39,12 @@ public abstract class Capteur {
public void setValeur(int v) {
this.valeur.set(Integer.toString(v));
}
- protected Property tpsGen;
+
+ protected IntegerProperty tpsGen;
public int getTpsGen(){
return tpsGen.getValue();
}
- public Property tpsGenProperty() {
+ public IntegerProperty tpsGenProperty() {
return tpsGen;
}
public void setTpsGen(int t) {
@@ -47,8 +52,6 @@ public abstract class Capteur {
}
-
-
abstract void start();
abstract void stop();
}
diff --git a/src/model/CapteurCompose.java b/src/model/CapteurCompose.java
index b179605..07579c5 100644
--- a/src/model/CapteurCompose.java
+++ b/src/model/CapteurCompose.java
@@ -1,5 +1,7 @@
package model;
+import javafx.beans.Observable;
+
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -26,4 +28,5 @@ public class CapteurCompose extends Capteur{
void stop() {
}
+
}
diff --git a/src/model/CapteurSimple.java b/src/model/CapteurSimple.java
index c64733f..9da9fa2 100644
--- a/src/model/CapteurSimple.java
+++ b/src/model/CapteurSimple.java
@@ -1,6 +1,13 @@
package model;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.beans.property.IntegerProperty;
+import javafx.beans.property.Property;
+import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
public class CapteurSimple extends Capteur{
private StratGeneration strategie;
@@ -11,8 +18,12 @@ public class CapteurSimple extends Capteur{
id=new SimpleStringProperty();
nom=new SimpleStringProperty();
setId(i);
- setNom(n);/*
+ setNom(n);
+ valeur=new SimpleStringProperty();
+ tpsGen=new SimpleIntegerProperty();
setValeur(0);
+ setTpsGen(1);
+ /*
strategie=new StratGenerationCPU();*/
}
@Override
diff --git a/src/view/VueCapteurSimple.java b/src/view/VueCapteurSimple.java
index 284239e..b824932 100644
--- a/src/view/VueCapteurSimple.java
+++ b/src/view/VueCapteurSimple.java
@@ -1,5 +1,6 @@
package view;
+import javafx.beans.property.Property;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.text.Text;
@@ -15,27 +16,28 @@ public class VueCapteurSimple extends VueCapteur{
private TextField nomCapteur;
@FXML
private Label idCapteur;
- /*
+
@FXML
- private Text valeurCapteur;
+ private Label valeurCapteur;
@FXML
- private Spinner spinTps;*/
+ private Spinner spinTps;
Capteur capteur;
public VueCapteurSimple(Capteur capteur) throws IOException {
super(capteur,"views/CapteurSimple.fxml");
this.capteur=capteur;
idCapteur.textProperty().bindBidirectional(capteur.idProperty());
+
nomCapteur.textProperty().bindBidirectional(capteur.nomProperty());
- capteur.setNom("aaa");
+/*
+ valeurCapteur.textProperty().bindBidirectional(capteur.valeurProperty());
+*/
+ spinTps.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0,10,capteur.getTpsGen(),1));
+ capteur.tpsGenProperty().bind(spinTps.valueProperty());
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
-
- /*
- spinTps.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0,10,1,1));
- spinTps.valueFactoryProperty().bindBidirectional(capteur.tpsGenProperty());*/
}
}