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
64a4cb6c
Commit
64a4cb6c
authored
6 years ago
by
Salles Coralie
Browse files
Options
Downloads
Patches
Plain Diff
Interface IOT
parent
49c8a1e1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/src/Vue/FXMLVue.fxml
+68
-55
68 additions, 55 deletions
app/src/Vue/FXMLVue.fxml
app/src/Vue/FXMLVueController.java
+42
-16
42 additions, 16 deletions
app/src/Vue/FXMLVueController.java
app/src/app/App.java
+2
-5
2 additions, 5 deletions
app/src/app/App.java
with
112 additions
and
76 deletions
app/src/Vue/FXMLVue.fxml
+
68
−
55
View file @
64a4cb6c
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.TextField?>
...
...
@@ -16,146 +14,161 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane
maxHeight=
"-Infinity"
maxWidth=
"-Infinity"
minHeight=
"-Infinity"
minWidth=
"-Infinity"
prefHeight=
"
40
0.0"
prefWidth=
"
60
0.0"
xmlns=
"http://javafx.com/javafx/8.0.141"
xmlns:fx=
"http://javafx.com/fxml/1"
fx:controller=
"Vue.FXMLVueController"
>
<GridPane
maxHeight=
"-Infinity"
maxWidth=
"-Infinity"
minHeight=
"-Infinity"
minWidth=
"-Infinity"
prefHeight=
"
35
0.0"
prefWidth=
"
44
0.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>
<ColumnConstraints
hgrow=
"SOMETIMES"
minWidth=
"10.0"
prefWidth=
"100.0"
/>
</columnConstraints>
<rowConstraints>
<RowConstraints
maxHeight=
"129.33331298828125"
minHeight=
"10.0"
prefHeight=
"
59.33332824707031
"
valignment=
"CENTER"
vgrow=
"SOMETIMES"
/>
<RowConstraints
maxHeight=
"2
07.6666717529297
"
minHeight=
"10.0"
prefHeight=
"2
07.6666717529297
"
vgrow=
"SOMETIMES"
/>
<RowConstraints
maxHeight=
"129.33331298828125"
minHeight=
"10.0"
prefHeight=
"
60.0
"
valignment=
"CENTER"
vgrow=
"SOMETIMES"
/>
<RowConstraints
maxHeight=
"2
49.0
"
minHeight=
"10.0"
prefHeight=
"2
20.0
"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"30.0"
vgrow=
"SOMETIMES"
/>
</rowConstraints>
<children>
<Label
text=
"La plante qui pleure"
textAlignment=
"CENTER"
GridPane.halignment=
"CENTER"
>
<font>
<Font
size=
"28.0"
/>
<Font
name=
"Trebuchet MS Bold"
size=
"28.0"
/>
</font>
</Label>
<GridPane
fx:id=
"accueil"
visible=
"false
"
GridPane.rowIndex=
"1"
>
<GridPane
fx:id=
"accueil"
style=
"-fx-background-color: white;
"
GridPane.rowIndex=
"1"
>
<columnConstraints>
<ColumnConstraints
hgrow=
"SOMETIMES"
minWidth=
"10.0"
prefWidth=
"100.0"
/>
<ColumnConstraints
hgrow=
"SOMETIMES"
maxWidth=
"-Infinity"
minWidth=
"10.0"
prefWidth=
"20.0"
/>
<ColumnConstraints
hgrow=
"SOMETIMES"
minWidth=
"10.0"
prefWidth=
"100.0"
/>
</columnConstraints>
<rowConstraints>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"
3
0.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"3
0
.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"3
0
.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"3
0
.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"
1
0.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"3
1
.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"3
1
.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"3
1
.0"
vgrow=
"SOMETIMES"
/>
</rowConstraints>
<children>
<Label
text=
"Informations générales"
textAlignment=
"CENTER"
GridPane.halignment=
"CENTER"
GridPane.valignment=
"CENTER"
>
<font>
<Font
name=
"System Bold"
size=
"12.0"
/>
<Font
name=
"System Bold
Italic
"
size=
"12.0"
/>
</font></Label>
<Label
text=
"Informations sur la plante"
GridPane.columnIndex=
"2"
GridPane.halignment=
"CENTER"
GridPane.valignment=
"CENTER"
>
<font>
<Font
name=
"System Bold"
size=
"12.0"
/>
</font></Label>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.rowIndex=
"1"
>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.rowIndex=
"1"
GridPane.valignment=
"CENTER"
>
<children>
<ImageView
fitHeight=
"35.0"
fitWidth=
"37.0"
pickOnBounds=
"true"
preserveRatio=
"true"
>
<image>
<Image
url=
"@images/temperature.jpg"
/>
</image></ImageView>
<Label
fx:id=
"temperature"
text=
"température"
/>
<Label
text=
"°C"
/>
</children>
</HBox>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.
rowIndex=
"2
"
>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.
halignment=
"CENTER"
GridPane.rowIndex=
"2"
GridPane.valignment=
"CENTER
"
>
<children>
<ImageView
fitHeight=
"35.0"
fitWidth=
"37.0"
pickOnBounds=
"true"
preserveRatio=
"true"
>
<image>
<Image
url=
"@images/intensity.jpg"
/>
</image></ImageView>
<Label
fx:id=
"intensity"
text=
"luminosité"
/>
<Label
text=
"LUX"
/>
</children>
</HBox>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.
rowIndex=
"3
"
>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.
halignment=
"CENTER"
GridPane.rowIndex=
"3"
GridPane.valignment=
"CENTER
"
>
<children>
<ImageView
fitHeight=
"35.0"
fitWidth=
"37.0"
pickOnBounds=
"true"
preserveRatio=
"true"
>
<image>
<Image
url=
"@images/humidity.png"
/>
</image></ImageView>
<Label
fx:id=
"himidityAir"
text=
"himidité dans l'air"
/>
<Label
text=
"\%"
/>
</children>
</HBox>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.columnIndex=
"2"
GridPane.
rowIndex=
"1
"
>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.columnIndex=
"2"
GridPane.
halignment=
"CENTER"
GridPane.rowIndex=
"1"
GridPane.valignment=
"CENTER
"
>
<children>
<ImageView
fitHeight=
"35.0"
fitWidth=
"37.0"
pickOnBounds=
"true"
preserveRatio=
"true"
>
<image>
<Image
url=
"@images/humidity.png"
/>
</image></ImageView>
<Label
fx:id=
"humidityPlante"
text=
"humidité dans la plante"
/>
<Label
fx:id=
"humidityPlante"
text=
"humidité plante"
/>
<Label
text=
"\%"
/>
</children>
</HBox>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.columnIndex=
"2"
GridPane.
rowIndex=
"2
"
>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.columnIndex=
"2"
GridPane.
halignment=
"CENTER"
GridPane.rowIndex=
"2"
GridPane.valignment=
"CENTER
"
>
<children>
<ImageView
fitHeight=
"3
5
.0"
fitWidth=
"3
7
.0"
pickOnBounds=
"true"
preserveRatio=
"true"
>
<ImageView
fitHeight=
"3
0
.0"
fitWidth=
"3
0
.0"
pickOnBounds=
"true"
preserveRatio=
"true"
>
<image>
<Image
url=
"@images/seuil.jpg"
/>
</image></ImageView>
<Label
fx:id=
"humiditySeuil"
text=
"seuil d'humidité pour arrosage"
/>
<Label
fx:id=
"humiditySeuil"
text=
"seuil d'humidité"
/>
<Label
text=
"\%"
/>
</children>
<GridPane.margin>
<Insets
left=
"8.0"
/>
</GridPane.margin>
</HBox>
<Separator
orientation=
"VERTICAL"
prefHeight=
"200.0"
GridPane.columnIndex=
"1"
GridPane.halignment=
"CENTER"
GridPane.rowSpan=
"4"
/>
<HBox
fx:id=
"alertMessage"
alignment=
"CENTER"
prefHeight=
"100.0"
prefWidth=
"200.0"
style=
"-fx-background-color: red;"
GridPane.columnIndex=
"2"
GridPane.halignment=
"CENTER"
GridPane.rowIndex=
"3"
GridPane.valignment=
"CENTER"
>
<children>
<Label
text=
"ARROSER LA PLANTE"
>
<font>
<Font
name=
"System Bold"
size=
"18.0"
/>
</font>
</Label>
</children>
</HBox>
</children>
<GridPane.margin>
<Insets
left=
"10.0"
right=
"10.0"
/>
</GridPane.margin>
</GridPane>
<GridPane
fx:id=
"humidity"
visible=
"false"
GridPane.rowIndex=
"1"
>
<columnConstraints>
<ColumnConstraints
hgrow=
"SOMETIMES"
minWidth=
"10.0"
prefWidth=
"100.0"
/>
</columnConstraints>
<rowConstraints>
<RowConstraints
maxHeight=
"-Infinity"
minHeight=
"10.0"
prefHeight=
"180.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"30.0"
vgrow=
"SOMETIMES"
/>
</rowConstraints>
<children>
<LineChart>
<xAxis>
<CategoryAxis
label=
"temps"
side=
"BOTTOM"
/>
</xAxis>
<yAxis>
<NumberAxis
side=
"LEFT"
/>
</yAxis>
</LineChart>
</children>
<GridPane.margin>
<Insets
left=
"10.0"
right=
"10.0"
/>
<Insets
bottom=
"10.0"
left=
"10.0"
right=
"10.0"
/>
</GridPane.margin>
</GridPane>
<GridPane
fx:id=
"configuration"
visible=
"false"
GridPane.rowIndex=
"1"
>
<GridPane
fx:id=
"configuration"
style=
"-fx-background-color: white;"
visible=
"false"
GridPane.rowIndex=
"1"
>
<columnConstraints>
<ColumnConstraints
hgrow=
"SOMETIMES"
minWidth=
"10.0"
prefWidth=
"100.0"
/>
</columnConstraints>
<rowConstraints>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"
3
0.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
m
inHeight=
"10.0
"
prefHeight=
"
30
.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
minHeight=
"10.0"
prefHeight=
"
30
.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
maxHeight=
"60.0"
minHeight=
"10.0"
prefHeight=
"
6
0.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
m
axHeight=
"61.0"
minHeight=
"2.333343505859375
"
prefHeight=
"
44
.0"
vgrow=
"SOMETIMES"
/>
<RowConstraints
maxHeight=
"135.66665649414062"
minHeight=
"10.0"
prefHeight=
"
105
.0"
vgrow=
"SOMETIMES"
/>
</rowConstraints>
<children>
<HBox
alignment=
"CENTER_LEFT"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
>
<children>
<Label
text=
"Seuil d'humidité minimum tolérable: "
wrapText=
"true"
/>
<TextField
fx:id=
"seuil"
alignment=
"CENTER_RIGHT"
promptText=
"valeur en %"
/>
<Label
fx:id=
"seuilError"
text=
"(en %)"
wrapText=
"true"
/>
<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"
/>
<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"
>
<GridPane.margin>
<Insets
right=
"40.0"
/>
</GridPane.margin>
</Label>
<HBox
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"10.0"
GridPane.rowIndex=
"2"
>
<children>
<Label
text=
"Activer l'arrosage automatique : "
wrapText=
"true"
>
<font>
<Font
size=
"14.0"
/>
</font>
</Label>
<CheckBox
fx:id=
"arrosageAuto"
mnemonicParsing=
"false"
onAction=
"#clickAuto"
text=
"Désactivé"
/>
</children>
</HBox>
</children>
<GridPane.margin>
<Insets
left=
"10.0"
right=
"10.0"
/>
</GridPane.margin>
</GridPane>
<HBox
alignment=
"CENTER"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"30.0"
GridPane.halignment=
"CENTER"
GridPane.rowIndex=
"2"
GridPane.valignment=
"CENTER"
>
<HBox
alignment=
"CENTER"
prefHeight=
"100.0"
prefWidth=
"200.0"
spacing=
"30.0"
style=
"-fx-background-color: white;"
GridPane.halignment=
"CENTER"
GridPane.rowIndex=
"2"
GridPane.valignment=
"CENTER"
>
<children>
<Button
mnemonicParsing=
"false"
onAction=
"#clickAccueil"
text=
"Accueil"
/>
<Button
mnemonicParsing=
"false"
onAction=
"#clickHumidity"
text=
"Humidité"
/>
<Button
mnemonicParsing=
"false"
onAction=
"#clickConfig"
text=
"Configuration"
/>
<Button
fx:id=
"buttonAccueil"
mnemonicParsing=
"false"
onAction=
"#clickAccueil"
prefWidth=
"90.0"
text=
"Accueil"
/>
<Button
fx:id=
"buttonConfig"
mnemonicParsing=
"false"
onAction=
"#clickConfig"
prefWidth=
"90.0"
text=
"Configuration"
/>
</children>
<GridPane.margin>
<Insets
bottom=
"5.0"
top=
"5.0"
/>
</GridPane.margin>
</HBox>
</children>
</GridPane>
This diff is collapsed.
Click to expand it.
app/src/Vue/FXMLVueController.java
+
42
−
16
View file @
64a4cb6c
...
...
@@ -12,13 +12,12 @@ import javafx.beans.value.ObservableValue;
import
javafx.event.ActionEvent
;
import
javafx.fxml.FXML
;
import
javafx.fxml.Initializable
;
import
javafx.scene.chart.CategoryAxis
;
import
javafx.scene.chart.LineChart
;
import
javafx.scene.chart.NumberAxis
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.CheckBox
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.TextField
;
import
javafx.scene.layout.GridPane
;
import
javafx.scene.layout.HBox
;
/**
* FXML Controller class
...
...
@@ -39,9 +38,8 @@ public class FXMLVueController implements Initializable {
private
Label
humidityPlante
;
@FXML
private
Label
humiditySeuil
;
@FXML
private
GridPane
humidity
;
private
HBox
alertMessage
;
@FXML
private
GridPane
configuration
;
...
...
@@ -49,9 +47,17 @@ public class FXMLVueController implements Initializable {
private
TextField
seuil
;
@FXML
private
Label
seuilError
;
@FXML
private
CheckBox
arrosageAuto
;
private
GridPane
currentGridPane
;
private
Button
currentButton
;
@FXML
private
Button
buttonAccueil
;
@FXML
private
Button
buttonConfig
;
/**
* Initializes the controller class.
...
...
@@ -61,16 +67,18 @@ public class FXMLVueController implements Initializable {
//Put the gridPane Accueil visible
accueil
.
setVisible
(
true
);
currentGridPane
=
accueil
;
currentButton
=
buttonAccueil
;
currentButton
.
setStyle
(
"-fx-background-color: #7fca5eff"
);
alertMessage
.
setVisible
(
false
);
//Only allow integers as a value for the seuil
seuil
.
textProperty
().
addListener
(
new
ChangeListener
<
String
>()
{
@Override
public
void
changed
(
ObservableValue
<?
extends
String
>
observable
,
String
oldValue
,
String
newValue
)
{
if
(!
newValue
.
matches
(
"\\d*"
))
{
seuil
.
setText
(
newValue
.
replaceAll
(
"[^\\d]"
,
""
));
}
seuilError
.
setText
(
"
(en %)
"
);
seuilError
.
setText
(
""
);
if
(!(
seuil
.
getText
().
isEmpty
())
&&
!(
Integer
.
parseInt
(
seuil
.
getText
())<
100
)){
seuilError
.
setText
(
"La valeur du seuil doit être inférieure à 100%"
);
}
...
...
@@ -78,28 +86,46 @@ public class FXMLVueController implements Initializable {
});
//Bind the label for the seuil in Accueil and the value in configurations
humiditySeuil
.
textProperty
().
bind
(
seuil
.
textProperty
());
}
@FXML
private
void
clickHumidity
(
ActionEvent
event
)
{
currentGridPane
.
setVisible
(
false
);
humidity
.
setVisible
(
true
);
currentGridPane
=
humidity
;
}
/**
* Change the page for the accueil page when clicking on accueil button
* @param event
*/
@FXML
private
void
clickAccueil
(
ActionEvent
event
)
{
currentGridPane
.
setVisible
(
false
);
accueil
.
setVisible
(
true
);
currentGridPane
=
accueil
;
currentButton
.
setStyle
(
"-fx-background-color: #d5d5d5ff"
);
currentButton
=
buttonAccueil
;
currentButton
.
setStyle
(
"-fx-background-color: #7fca5eff"
);
}
/**
* Change the page for the configuration page when clicking on configuration button
* @param event
*/
@FXML
private
void
clickConfig
(
ActionEvent
event
)
{
currentGridPane
.
setVisible
(
false
);
configuration
.
setVisible
(
true
);
currentGridPane
=
configuration
;
currentButton
.
setStyle
(
"-fx-background-color: #d5d5d5ff"
);
currentButton
=
buttonConfig
;
currentButton
.
setStyle
(
"-fx-background-color: #7fca5eff"
);
}
/**
* Change the text for activate or desactivate according to the checkbox
* @param event
*/
@FXML
private
void
clickAuto
(
ActionEvent
event
)
{
if
(
arrosageAuto
.
isSelected
()){
arrosageAuto
.
setText
(
"Activé"
);
}
else
arrosageAuto
.
setText
(
"Désactivé"
);
}
}
This diff is collapsed.
Click to expand it.
app/src/app/App.java
+
2
−
5
View file @
64a4cb6c
...
...
@@ -22,11 +22,10 @@ public class App extends Application {
@Override
public
void
start
(
Stage
stage
)
throws
Exception
{
Parent
root
=
FXMLLoader
.
load
(
getClass
().
getResource
(
"/Vue/FXMLVue.fxml"
));
Scene
scene
=
new
Scene
(
root
);
stage
.
setTitle
(
"La plante qui pleure"
);
stage
.
setResizable
(
false
);
stage
.
setScene
(
scene
);
stage
.
show
();
}
...
...
@@ -35,8 +34,6 @@ public class App extends Application {
* @param args the command line arguments
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
BluetoothDevices
b
;
b
=
new
BluetoothDevices
();
launch
(
args
);
}
...
...
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