Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plante-qui-pleure
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Puissegur Alexis
plante-qui-pleure
Commits
1928d5dd
Commit
1928d5dd
authored
6 years ago
by
Masson Lea
Browse files
Options
Downloads
Patches
Plain Diff
slider instead of textfield for seuil
parent
dc1f8286
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/Vue/FXMLVue.fxml
+8
-4
8 additions, 4 deletions
app/src/Vue/FXMLVue.fxml
app/src/Vue/FXMLVueController.java
+13
-17
13 additions, 17 deletions
app/src/Vue/FXMLVueController.java
with
21 additions
and
21 deletions
app/src/Vue/FXMLVue.fxml
+
8
−
4
View file @
1928d5dd
...
...
@@ -20,6 +20,7 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.control.Slider?>
<GridPane
maxHeight=
"-Infinity"
maxWidth=
"-Infinity"
minHeight=
"-Infinity"
minWidth=
"-Infinity"
prefHeight=
"401.0"
prefWidth=
"440.0"
style=
"-fx-background-color: white;"
xmlns=
"http://javafx.com/javafx/8.0.141"
xmlns:fx=
"http://javafx.com/fxml/1"
fx:controller=
"Vue.FXMLVueController"
>
<columnConstraints>
...
...
@@ -193,19 +194,22 @@
<Label
text=
"Seuil d'humidité minimum tolérable: "
wrapText=
"true"
>
<font>
<Font
size=
"14.0"
/>
</font></Label>
<TextField
fx:id=
"seuil"
alignment=
"CENTER_RIGHT"
promptText=
"<100"
text=
"50"
/>
</font>
</Label>
<Slider
fx:id=
"seuil"
blockIncrement=
"10"
minorTickCount=
"10"
majorTickUnit=
"10"
min=
"10"
max=
"90"
value=
"50"
showTickLabels=
"true"
showTickMarks=
"true"
snapToTicks=
"true"
/>
<!--TextField fx:id="seuil" alignment="CENTER_RIGHT" promptText="<100" text="50"/-->
<Label
text=
" %"
wrapText=
"true"
/>
</children>
<GridPane.margin>
<Insets
/>
</GridPane.margin>
</HBox>
<Label
fx:id=
"seuilError"
textFill=
"#c70606"
wrapText=
"true"
GridPane.halignment=
"RIGHT"
GridPane.rowIndex=
"1"
GridPane.valignment=
"TOP"
>
<
!--
Label fx:id="seuilError" textFill="#c70606" wrapText="true" GridPane.halignment="RIGHT" GridPane.rowIndex="1" GridPane.valignment="TOP">
<GridPane.margin>
<Insets right="40.0" />
</GridPane.margin>
</Label>
</Label
--
>
<HBox
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.rowIndex=
"2"
>
<children>
<Label
text=
"Activer l'arrosage automatique : "
wrapText=
"true"
>
...
...
This diff is collapsed.
Click to expand it.
app/src/Vue/FXMLVueController.java
+
13
−
17
View file @
1928d5dd
...
...
@@ -15,6 +15,8 @@ import java.util.Formatter;
import
java.util.Locale
;
import
java.util.ResourceBundle
;
import
javafx.application.Platform
;
import
javafx.beans.InvalidationListener
;
import
javafx.beans.binding.Bindings
;
import
javafx.beans.value.ChangeListener
;
import
javafx.beans.value.ObservableValue
;
import
javafx.event.ActionEvent
;
...
...
@@ -29,6 +31,7 @@ import javafx.scene.control.CheckBox;
import
javafx.scene.control.ComboBox
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.RadioButton
;
import
javafx.scene.control.Slider
;
import
javafx.scene.control.TextField
;
import
javafx.scene.control.ToggleGroup
;
import
javafx.scene.layout.GridPane
;
...
...
@@ -62,7 +65,7 @@ public class FXMLVueController implements Initializable, Observer {
@FXML
private
GridPane
configuration
;
@FXML
private
TextField
seuil
;
private
Slider
seuil
;
@FXML
private
Label
seuilError
;
@FXML
...
...
@@ -106,7 +109,6 @@ public class FXMLVueController implements Initializable, Observer {
private
boolean
isConnected
=
false
;
private
BluetoothManager
bluetoothManager
;
/**
* Initializes the controller class.
...
...
@@ -120,22 +122,18 @@ public class FXMLVueController implements Initializable, Observer {
currentGridPane
=
accueil
;
currentButton
=
buttonAccueil
;
openPage
(
accueil
,
buttonAccueil
);
//Only allow integers as a value for the seuil
seuil
.
textProperty
().
addListener
(
new
ChangeListener
<
String
>()
{
seuil
.
valueProperty
().
addListener
(
new
ChangeListener
<
Number
>()
{
@Override
public
void
changed
(
ObservableValue
<?
extends
String
>
observable
,
String
oldValue
,
String
newValue
)
{
if
(!
newValue
.
matches
(
"\\d*"
))
{
seuil
.
setText
(
newValue
.
replaceAll
(
"[^\\d]"
,
""
));
}
seuilError
.
setText
(
""
);
if
(!(
seuil
.
getText
().
isEmpty
())
&&
!(
Integer
.
parseInt
(
seuil
.
getText
())<
100
)){
seuilError
.
setText
(
"La valeur du seuil doit être inférieure à 100%"
);
}
public
void
changed
(
ObservableValue
<?
extends
Number
>
obs
,
Number
oldval
,
Number
newVal
)
{
int
intVal
=
((
int
)
Math
.
round
(
newVal
.
doubleValue
())/
10
)*
10
;
seuil
.
setValue
(
intVal
);
humiditySeuil
.
setText
(
""
+
intVal
);
}
});
//Bind the label for the senewValueuil in Accueil and the value in configurations
humiditySeuil
.
textProperty
().
bind
(
seuil
.
text
Property
());
//
humiditySeuil.textProperty().bind(
Bindings.convert(
seuil.
value
Property())
)
;
humidityPlante
.
textProperty
().
addListener
(
new
ChangeListener
<
String
>()
{
@Override
...
...
@@ -264,7 +262,5 @@ public class FXMLVueController implements Initializable, Observer {
currentButton
.
setStyle
(
"-fx-background-color: #d5d5d5ff"
);
currentButton
=
justClicked
;
currentButton
.
setStyle
(
"-fx-background-color: #7fca5eff"
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment