Skip to content
Snippets Groups Projects
Commit b9b0910c authored by Matias Mennecart's avatar Matias Mennecart
Browse files

Add load file view

parent d33d87c7
No related branches found
No related tags found
No related merge requests found
......@@ -41,12 +41,20 @@
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14</version>
<version>17</version>
<!-- Pour Mac M1+ -->
<!-- <classifier>mac-aarch64</classifier> -->
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>17</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>14</version>
<version>17</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.Scene?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>
<Stage fx:id="stage" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univlille.sae.classification.controller.LoadDataController">
<scene>
<Scene>
<AnchorPane prefHeight="143.0" prefWidth="363.0">
<children>
<VBox layoutX="-1.0" layoutY="1.0" prefHeight="151.0" prefWidth="364.0">
<children>
<HBox alignment="CENTER" prefHeight="91.0" prefWidth="272.0">
<children>
<Label fx:id="filenamelab" prefHeight="83.0" prefWidth="157.0" text="file name" />
<Button mnemonicParsing="false" onAction="#openFileChooser" text="Parcourir" />
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="76.0" prefWidth="310.0">
<children>
<Button mnemonicParsing="false" onAction="#validate" text="Valider" />
</children>
</HBox>
</children>
</VBox>
</children></AnchorPane>
</Scene>
</scene>
</Stage>
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.Scene?>
<?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.chart.ScatterChart?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>
<Stage fx:id="stage" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univlille.sae.classification.controller.MainStageController">
<scene>
<Scene>
<AnchorPane prefHeight="487.0" prefWidth="692.0">
<children>
<VBox prefHeight="488.0" prefWidth="691.0">
<children>
<HBox prefHeight="305.0" prefWidth="691.0">
<children>
<Region prefHeight="200.0" prefWidth="200.0" />
<ScatterChart prefHeight="213.0" prefWidth="557.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</ScatterChart>
<Region prefHeight="200.0" prefWidth="200.0" />
</children>
</HBox>
<Region prefHeight="77.0" prefWidth="691.0" />
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<Region prefHeight="101.0" prefWidth="131.0" />
<Button mnemonicParsing="false" onAction="#openLoadData" prefHeight="27.0" prefWidth="122.0" text="Charger" />
<Region prefHeight="101.0" prefWidth="75.0" />
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="129.0" text="Classifier" />
<Region prefHeight="101.0" prefWidth="70.0" />
<Button mnemonicParsing="false" prefHeight="26.0" prefWidth="133.0" text="Reglages" />
<Region prefHeight="101.0" prefWidth="111.0" />
</children>
</HBox>
</children>
</VBox>
</children></AnchorPane>
</Scene>
</scene>
</Stage>
package fr.univlille.sae.classification.controller;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import java.io.File;
public class LoadDataController {
@FXML
Stage stage;
@FXML
Label filenamelab;
File file;
public void loadData() {
System.out.println("Loading data");
stage.close();
}
public void openFileChooser() {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Choisissez le fichier à importer");
this.file = fileChooser.showOpenDialog(stage);
if(file != null) {
filenamelab.setText(file.getName());
}
}
public void validate() {
if (file == null) {
stage.close();
//throw exception
}
loadData();
}
}
......@@ -27,9 +27,9 @@ public class MainStageController {
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 + "main-stage.fxml").toURI().toURL();
URL fxmlFileUrl = new File(System.getProperty("user.dir") + File.separator + "res" + File.separator + "stages" + File.separator + "load-data-stage.fxml").toURI().toURL();
if (fxmlFileUrl == null) {
System.out.println("Impossible de charger le fichier fxml");
......@@ -44,7 +44,7 @@ public class MainStageController {
loadStage.setTitle("Chargement des donées");
loadStage.showAndWait();
*/
}
......
package fr.univlille.sae.classification;
package fr.univlille.sae.classification.model;
import java.io.File;
import java.util.ArrayList;
......
package fr.univlille.sae.classification;
package fr.univlille.sae.classification.model;
import java.util.Set;
......
package fr.univlille.sae.classification;
package fr.univlille.sae.classification.model;
import java.util.List;
import java.util.Set;
public abstract class LoadableData {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment