From e968dc0873d48471be7d83744126dd41ca0b8740 Mon Sep 17 00:00:00 2001
From: "hugo.debuyser.etu" <hugo.debuyser.etu@univ-lille.fr>
Date: Fri, 18 Oct 2024 10:40:41 +0200
Subject: [PATCH] Modification des fichiers FXML et ajout des controllers
---
res/stages/add-data-stage.fxml | 6 ++--
res/stages/axes-settings-stage.fxml | 8 ++---
res/stages/display-settings-stage.fxml | 6 ++--
res/stages/load-data-stage.fxml | 6 ++--
res/stages/main-stage.fxml | 17 ++++++-----
.../controller/AddDataController.java | 15 ++++++++++
.../controller/AxesSettingsController.java | 16 ++++++++++
.../controller/DisplaySettingsController.java | 19 ++++++++++++
.../controller/LoadDataController.java | 12 ++++++--
.../controller/MainStageController.java | 29 ++++++++++++++-----
10 files changed, 104 insertions(+), 30 deletions(-)
create mode 100644 src/main/java/fr/univlille/sae/classification/controller/AddDataController.java
create mode 100644 src/main/java/fr/univlille/sae/classification/controller/AxesSettingsController.java
create mode 100644 src/main/java/fr/univlille/sae/classification/controller/DisplaySettingsController.java
diff --git a/res/stages/add-data-stage.fxml b/res/stages/add-data-stage.fxml
index 837b259..99a1ad4 100644
--- a/res/stages/add-data-stage.fxml
+++ b/res/stages/add-data-stage.fxml
@@ -5,7 +5,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.stage.*?>
-<Stage xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1">
+<Stage fx:id="stage" xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univlille.sae.classification.controller.AddDataController">
<scene>
<Scene>
<AnchorPane prefHeight="200" prefWidth="200">
@@ -21,7 +21,7 @@
<HBox alignment="CENTER" layoutX="10.0" layoutY="47.0" prefHeight="17.0" prefWidth="335.0" spacing="20.0">
<children>
<Label text="Valeur 2" />
- <ChoiceBox prefWidth="150.0" />
+ <ChoiceBox prefHeight="26.0" prefWidth="163.0" />
</children>
</HBox>
<HBox alignment="CENTER" layoutX="10.0" layoutY="109.0" prefHeight="17.0" prefWidth="335.0" spacing="20.0">
@@ -30,7 +30,7 @@
<Spinner />
</children>
</HBox>
- <Button mnemonicParsing="false" text="Valider" />
+ <Button fx:id="confirmAdd" mnemonicParsing="false" text="Valider" />
</children></VBox>
</children></AnchorPane>
</Scene>
diff --git a/res/stages/axes-settings-stage.fxml b/res/stages/axes-settings-stage.fxml
index b605dc7..8fb6b84 100644
--- a/res/stages/axes-settings-stage.fxml
+++ b/res/stages/axes-settings-stage.fxml
@@ -5,7 +5,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.stage.*?>
-<Stage xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1">
+<Stage fx:id="stage" xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univlille.sae.classification.controller.AxesSettingsController">
<scene>
<Scene>
<AnchorPane prefHeight="200" prefWidth="200">
@@ -15,16 +15,16 @@
<HBox alignment="CENTER" prefHeight="46.0" prefWidth="406.0" spacing="20.0">
<children>
<Label text="Valeur des ordonnées" />
- <ChoiceBox prefWidth="150.0" />
+ <ChoiceBox fx:id="selectOrd" prefWidth="150.0" />
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="44.0" prefWidth="406.0" spacing="20.0">
<children>
<Label text="Valeur des abscisses" />
- <ChoiceBox prefWidth="150.0" />
+ <ChoiceBox fx:id="selectAbs" prefWidth="150.0" />
</children>
</HBox>
- <Button mnemonicParsing="false" text="Valider" />
+ <Button fx:id="confirmAxes" mnemonicParsing="false" text="Valider" />
</children>
</VBox>
</children></AnchorPane>
diff --git a/res/stages/display-settings-stage.fxml b/res/stages/display-settings-stage.fxml
index 92792ea..acc017f 100644
--- a/res/stages/display-settings-stage.fxml
+++ b/res/stages/display-settings-stage.fxml
@@ -5,7 +5,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.stage.*?>
-<Stage xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1">
+<Stage fx:id="stage" xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univlille.sae.classification.controller.DisplaySettingsController">
<scene>
<Scene>
<AnchorPane prefHeight="200" prefWidth="200">
@@ -15,9 +15,9 @@
<HBox alignment="CENTER" prefHeight="58.0" prefWidth="294.0" spacing="20.0">
<children>
<Label text="Nouvel ajout" />
- <ColorPicker editable="true" />
+ <ColorPicker fx:id="addColor" editable="true" />
</children></HBox>
- <Button mnemonicParsing="false" text="Valider" />
+ <Button fx:id="confirmSettings" mnemonicParsing="false" text="Valider" />
</children></VBox>
</children></AnchorPane>
</Scene>
diff --git a/res/stages/load-data-stage.fxml b/res/stages/load-data-stage.fxml
index fb198d4..111def3 100644
--- a/res/stages/load-data-stage.fxml
+++ b/res/stages/load-data-stage.fxml
@@ -14,13 +14,13 @@
<children>
<HBox alignment="CENTER" prefHeight="91.0" prefWidth="272.0">
<children>
- <Button mnemonicParsing="false" onAction="#openFileChooser" text="Parcourir" />
- <TextField prefHeight="26.0" prefWidth="207.0" />
+ <Button fx:id="browseFile" mnemonicParsing="false" onAction="#openFileChooser" text="Parcourir" />
+ <TextField fx:id="filePath" prefHeight="26.0" prefWidth="207.0" />
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="76.0" prefWidth="310.0">
<children>
- <Button mnemonicParsing="false" onAction="#validate" text="Valider" />
+ <Button fx:id="confirmDataSelection" mnemonicParsing="false" onAction="#validate" text="Valider" />
</children>
</HBox>
</children>
diff --git a/res/stages/main-stage.fxml b/res/stages/main-stage.fxml
index cc9ca10..b7282d0 100644
--- a/res/stages/main-stage.fxml
+++ b/res/stages/main-stage.fxml
@@ -13,24 +13,25 @@
<children>
<VBox prefHeight="488.0" prefWidth="691.0">
<children>
- <VBox alignment="CENTER" prefHeight="379.0" prefWidth="691.0">
+ <HBox prefHeight="356.0" prefWidth="691.0">
<children>
+ <Region prefHeight="338.0" prefWidth="65.0" />
<ScatterChart prefHeight="342.0" prefWidth="609.0">
<xAxis>
- <CategoryAxis prefHeight="21.0" prefWidth="498.0" side="BOTTOM" />
+ <CategoryAxis fx:id="absAxe" prefHeight="21.0" prefWidth="498.0" side="BOTTOM" />
</xAxis>
<yAxis>
- <NumberAxis side="LEFT" />
+ <NumberAxis fx:id="ordAxe" side="LEFT" />
</yAxis>
</ScatterChart>
- <Button mnemonicParsing="false" text="Configuration de l'affichage" />
+ <Button fx:id="settings" mnemonicParsing="false" text="Réglage" />
</children>
- </VBox>
+ </HBox>
<HBox alignment="CENTER" prefHeight="169.0" prefWidth="691.0" spacing="50.0">
<children>
- <Button mnemonicParsing="false" onAction="#openLoadData" prefHeight="27.0" prefWidth="185.0" text="Charger un jeu de données" />
- <Button mnemonicParsing="false" prefHeight="26.0" prefWidth="141.0" text="Ajouter une donnée" />
- <Button disable="true" mnemonicParsing="false" prefHeight="26.0" prefWidth="157.0" text="Classifier une donnée" />
+ <Button fx:id="loadData" mnemonicParsing="false" onAction="#openLoadData" prefHeight="27.0" prefWidth="185.0" text="Charger un jeu de données" />
+ <Button fx:id="addData" mnemonicParsing="false" prefHeight="26.0" prefWidth="141.0" text="Ajouter une donnée" />
+ <Button fx:id="classifyData" disable="true" mnemonicParsing="false" prefHeight="26.0" prefWidth="157.0" text="Classifier une donnée" />
</children>
</HBox>
</children>
diff --git a/src/main/java/fr/univlille/sae/classification/controller/AddDataController.java b/src/main/java/fr/univlille/sae/classification/controller/AddDataController.java
new file mode 100644
index 0000000..d025119
--- /dev/null
+++ b/src/main/java/fr/univlille/sae/classification/controller/AddDataController.java
@@ -0,0 +1,15 @@
+package fr.univlille.sae.classification.controller;
+
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.stage.Stage;
+
+public class AddDataController {
+ @FXML
+ Stage stage;
+
+ @FXML
+ Button confirmAdd;
+
+
+}
diff --git a/src/main/java/fr/univlille/sae/classification/controller/AxesSettingsController.java b/src/main/java/fr/univlille/sae/classification/controller/AxesSettingsController.java
new file mode 100644
index 0000000..0679ea9
--- /dev/null
+++ b/src/main/java/fr/univlille/sae/classification/controller/AxesSettingsController.java
@@ -0,0 +1,16 @@
+package fr.univlille.sae.classification.controller;
+
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.ChoiceBox;
+
+public class AxesSettingsController {
+ @FXML
+ ChoiceBox selectOrd;
+
+ @FXML
+ ChoiceBox selectAbs;
+
+ @FXML
+ Button confirmAxes;
+}
diff --git a/src/main/java/fr/univlille/sae/classification/controller/DisplaySettingsController.java b/src/main/java/fr/univlille/sae/classification/controller/DisplaySettingsController.java
new file mode 100644
index 0000000..203a5ae
--- /dev/null
+++ b/src/main/java/fr/univlille/sae/classification/controller/DisplaySettingsController.java
@@ -0,0 +1,19 @@
+package fr.univlille.sae.classification.controller;
+
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.ColorPicker;
+import javafx.stage.Stage;
+
+public class DisplaySettingsController {
+ @FXML
+ Stage stage;
+
+ @FXML
+ Button confirmSettings;
+
+ @FXML
+ ColorPicker addColor;
+
+
+}
diff --git a/src/main/java/fr/univlille/sae/classification/controller/LoadDataController.java b/src/main/java/fr/univlille/sae/classification/controller/LoadDataController.java
index 1908058..5615e33 100644
--- a/src/main/java/fr/univlille/sae/classification/controller/LoadDataController.java
+++ b/src/main/java/fr/univlille/sae/classification/controller/LoadDataController.java
@@ -1,7 +1,9 @@
package fr.univlille.sae.classification.controller;
import javafx.fxml.FXML;
+import javafx.scene.control.Button;
import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
@@ -14,7 +16,13 @@ public class LoadDataController {
Stage stage;
@FXML
- Label filenamelab;
+ Button browseFile;
+
+ @FXML
+ Button confirmDataSelection;
+
+ @FXML
+ TextField filePath;
File file;
@@ -34,7 +42,7 @@ public class LoadDataController {
this.file = fileChooser.showOpenDialog(stage);
if(file != null) {
- filenamelab.setText(file.getName());
+ filePath.setText(file.getName());
}
}
diff --git a/src/main/java/fr/univlille/sae/classification/controller/MainStageController.java b/src/main/java/fr/univlille/sae/classification/controller/MainStageController.java
index 636343a..9639175 100644
--- a/src/main/java/fr/univlille/sae/classification/controller/MainStageController.java
+++ b/src/main/java/fr/univlille/sae/classification/controller/MainStageController.java
@@ -2,10 +2,9 @@ package fr.univlille.sae.classification.controller;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
-import javafx.scene.Scene;
-import javafx.scene.layout.VBox;
-import javafx.stage.Modality;
-import javafx.stage.Stage;
+import javafx.scene.chart.*;
+import javafx.scene.control.Button;
+import javafx.stage.*;
import java.io.File;
import java.io.IOException;
@@ -17,6 +16,25 @@ public class MainStageController {
@FXML
Stage stage;
+ @FXML
+ CategoryAxis absAxe;
+
+ @FXML
+ NumberAxis ordAxe;
+
+ @FXML
+ Button settings;
+
+ @FXML
+ Button loadData;
+
+ @FXML
+ Button addData;
+
+ @FXML
+ Button classifyData;
+
+
Stage loadStage;
@@ -25,9 +43,6 @@ public class MainStageController {
* @throws IOException
*/
public void openLoadData() throws IOException {
-
-
-
FXMLLoader loader = new FXMLLoader();
URL fxmlFileUrl = new File(System.getProperty("user.dir") + File.separator + "res" + File.separator + "stages" + File.separator + "load-data-stage.fxml").toURI().toURL();
--
GitLab