From eabbe4f19aa2f40bde4dd172c5a79bd2444e9dbc Mon Sep 17 00:00:00 2001 From: ctrebeau <ctrebeau@pasteur.fr> Date: Sat, 5 Apr 2025 16:45:06 +0200 Subject: [PATCH] feat: add CSV extraction feature from JAR to user file system --- pom.xml | 6 ++++++ .../gui/controller/MainController.java | 20 +++++++++++++++++++ .../fr.pasteur.ida.zellige.gui.view/Main.fxml | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b0374fb..512837f 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,13 @@ </repository> </repositories> + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/controller/MainController.java b/src/main/java/fr/pasteur/ida/zellige/gui/controller/MainController.java index 6227855..229d6d9 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/controller/MainController.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/controller/MainController.java @@ -175,6 +175,24 @@ public class MainController< T extends RealType< T > & NativeType< T > > impleme } + @FXML + public void openCSVExample() + { + // Open the example CSV file in the default system text editor + FileChooser fileChooser = new FileChooser(); + fileChooser.getExtensionFilters().add( new FileChooser.ExtensionFilter( "CSV Files", "*.csv" ) ); + + // You can specify the initial directory where the file should be saved or loaded from + fileChooser.setInitialDirectory( new java.io.File( "src/main/resources/" ) ); + + // Open the file + File file = fileChooser.showSaveDialog( null); + if ( file != null ) + { + // Perform the necessary file operations here (e.g., writing to file) + } + } + @FXML public void saveParameters() throws IOException { @@ -191,6 +209,8 @@ public class MainController< T extends RealType< T > & NativeType< T > > impleme } } + + private PretreatmentParameters build( PreprocessingModel<T> model) { return new PretreatmentParameters(model.getChannel().get(), model.binProperty().get() ); diff --git a/src/main/resources/fr.pasteur.ida.zellige.gui.view/Main.fxml b/src/main/resources/fr.pasteur.ida.zellige.gui.view/Main.fxml index 58be0a4..76a34d7 100644 --- a/src/main/resources/fr.pasteur.ida.zellige.gui.view/Main.fxml +++ b/src/main/resources/fr.pasteur.ida.zellige.gui.view/Main.fxml @@ -31,7 +31,8 @@ </Menu> <Menu mnemonicParsing="false" text="Help"> <items> - <MenuItem mnemonicParsing="false" text="About" /> + <MenuItem mnemonicParsing="false" text="Zellige Wiki" /> + <MenuItem mnemonicParsing="false" onAction="#openCSVExample" text="Batch Mode CSV file example" /> </items> </Menu> </menus> -- GitLab