Skip to content
Snippets Groups Projects
Commit b52a8915 authored by Puissegur Alexis's avatar Puissegur Alexis
Browse files

oui

parent 71f15949
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,7 @@
<Image url="@images/temperature.jpg" />
</image></ImageView>
<Label text="température" />
<Label fx:id="temperature" text="0" />
<Label fx:id="temperature" text="-1" />
<Label text="°C" />
</children>
</HBox>
......@@ -76,7 +76,7 @@
<Image url="@images/intensity.jpg" />
</image></ImageView>
<Label text="luminosité" />
<Label fx:id="intensity" text="0" />
<Label fx:id="intensity" text="-1" />
<Label text="LUX" />
</children>
</HBox>
......@@ -87,7 +87,7 @@
<Image url="@images/humidity.png" />
</image></ImageView>
<Label text="humidité dans l'air" />
<Label fx:id="humidityAir" text="0" />
<Label fx:id="humidityAir" text="-1" />
<Label text="\%" />
</children>
</HBox>
......@@ -98,7 +98,7 @@
<Image url="@images/humidity.png" />
</image></ImageView>
<Label text="humidité plante" />
<Label fx:id="humidityPlante" text="0" />
<Label fx:id="humidityPlante" text="-1" />
<Label text="\%" />
</children>
......
......@@ -129,13 +129,15 @@ public class FXMLVueController implements Initializable, Observer {
seuil.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> obs, Number oldval, Number newVal) {
public void changed(ObservableValue<? extends Number> obs, Number oldVal, Number newVal) {
int intVal = ((int) Math.round(newVal.doubleValue())/10)*10;
int intOld = ((int) Math.round(oldVal.doubleValue())/10)*10;
seuil.setValue(intVal);
humiditySeuil.setText(""+intVal);
if(humidityPlante.getText() != null && intVal > Integer.parseInt(humidityPlante.getText())){ // STOP
if(humidityPlante.getText() != null && intVal <= Integer.parseInt(humidityPlante.getText()) && intOld > Integer.parseInt(humidityPlante.getText())){ // STOP
boolean tmp = true;
changeImagePlante(false);
while(tmp){
try{
System.out.println("STOP");
......@@ -145,8 +147,10 @@ public class FXMLVueController implements Initializable, Observer {
e.printStackTrace();
}
}
} else {
} else if(intVal > Integer.parseInt(humidityPlante.getText())){
work();
changeImagePlante(true);
}
}
});
......@@ -157,10 +161,14 @@ public class FXMLVueController implements Initializable, Observer {
humidityPlante.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue != null && humiditySeuil.getText() != null && Integer.parseInt(newValue) < Integer.parseInt(humiditySeuil.getText())) {
System.out.println(oldValue);
System.out.println(newValue);
if (oldValue != null && newValue != null && humiditySeuil.getText() != null && Integer.parseInt(newValue) < Integer.parseInt(humiditySeuil.getText())) {
changeImagePlante(true);
alert = true;
work();
if(Integer.parseInt(oldValue) > Integer.parseInt(humiditySeuil.getText())){
work();
}
}
else {
if(alert){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment