diff --git a/.classpath b/.classpath index a8a136f..842ea18 100644 --- a/.classpath +++ b/.classpath @@ -1,7 +1,7 @@ - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index cb538c0..d20db39 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -21,9 +21,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -126,6 +126,6 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/GestionDesInscriptions_1.jar b/GestionDesInscriptions_1.jar index 2f8c784..bdf214b 100644 Binary files a/GestionDesInscriptions_1.jar and b/GestionDesInscriptions_1.jar differ diff --git a/GestionDesInscriptions_2.jar b/GestionDesInscriptions_2.jar index e60e56e..e19a5c0 100644 Binary files a/GestionDesInscriptions_2.jar and b/GestionDesInscriptions_2.jar differ diff --git a/GestionDesInscriptions_3.jar b/GestionDesInscriptions_3.jar index 04b2aca..0ab6489 100644 Binary files a/GestionDesInscriptions_3.jar and b/GestionDesInscriptions_3.jar differ diff --git a/L1 Géo et amé _ Aménag..xlsx b/L1 Géo et amé _ Aménag..xlsx index 48b397a..4185a02 100644 Binary files a/L1 Géo et amé _ Aménag..xlsx and b/L1 Géo et amé _ Aménag..xlsx differ diff --git a/L2 Géo et amé _ Aménag..xlsx b/L2 Géo et amé _ Aménag..xlsx deleted file mode 100644 index 0c00c47..0000000 Binary files a/L2 Géo et amé _ Aménag..xlsx and /dev/null differ diff --git a/L2 Histoire.xlsx b/L2 Histoire.xlsx deleted file mode 100644 index 288809a..0000000 Binary files a/L2 Histoire.xlsx and /dev/null differ diff --git a/L3 Histoire _ Patrimoine.xlsx b/L3 Histoire _ Patrimoine.xlsx deleted file mode 100644 index 41f21aa..0000000 Binary files a/L3 Histoire _ Patrimoine.xlsx and /dev/null differ diff --git a/base.xlsx b/base.xlsx deleted file mode 100644 index 1c30c0c..0000000 Binary files a/base.xlsx and /dev/null differ diff --git a/base.xml b/base.xml index 9c2e00a..62cf365 100644 --- a/base.xml +++ b/base.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/baseUFRHG/CreateCalcWorkbook.java b/src/baseUFRHG/CreateCalcWorkbook.java index 33a6695..b36b278 100644 --- a/src/baseUFRHG/CreateCalcWorkbook.java +++ b/src/baseUFRHG/CreateCalcWorkbook.java @@ -4,7 +4,6 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.io.FileOutputStream; import java.io.IOException; -import java.nio.file.Paths; import javax.swing.JFrame; import javax.swing.JLabel; @@ -34,11 +33,11 @@ public class CreateCalcWorkbook extends JFrame{ private ProcessTask processTask; private JFrame fr; JPanel panel; - String nameFile; + String path; - public CreateCalcWorkbook(Object[][] data, String nameFile){ + public CreateCalcWorkbook(Object[][] data, String nameFileWithPath){ - this.nameFile = nameFile; + this.path = nameFileWithPath; this.fr = new JFrame(); this.fr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); @@ -85,8 +84,7 @@ public class CreateCalcWorkbook extends JFrame{ @Override protected Void doInBackground() throws Exception { - String filePath = Paths.get("").toAbsolutePath().toString()+ "/"+ nameFile +".xlsx"; - + try (Workbook workbook = new XSSFWorkbook()) { int rows = data.length; // Nombre de lignes int columns = data[0].length; @@ -143,7 +141,7 @@ public class CreateCalcWorkbook extends JFrame{ } // Enregistrer le classeur dans un fichier - FileOutputStream fileOut = new FileOutputStream(filePath); + FileOutputStream fileOut = new FileOutputStream(path); workbook.write(fileOut); fileOut.close(); diff --git a/src/baseUFRHG/FileSaveXLSX.java b/src/baseUFRHG/FileSaveXLSX.java new file mode 100644 index 0000000..675556d --- /dev/null +++ b/src/baseUFRHG/FileSaveXLSX.java @@ -0,0 +1,44 @@ +package baseUFRHG; + +import java.io.File; + +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; + +public class FileSaveXLSX { + Object[][] data = null; + String Formation = ""; + + public void chooseDestination(Object[][] data, String Formation) { + this.data = data; + this.Formation = Formation; + + // Créer une boîte de dialogue de sélection de fichier + JFileChooser fileChooser = new JFileChooser(); + + // Afficher uniquement les dossiers (et non les fichiers) + fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + // Afficher la boîte de dialogue de sélection de fichier + int result = fileChooser.showSaveDialog(null); + + // Vérifier si l'utilisateur a sélectionné un dossier de destination + if (result == JFileChooser.APPROVE_OPTION) { + // Récupérer le dossier sélectionné par l'utilisateur + File selectedFolder = fileChooser.getSelectedFile(); + + // Récupérer le nom du fichier à partir d'une boîte de dialogue + String fileName = JOptionPane.showInputDialog(null, "Nom du fichier :", Formation); + + // Créer le chemin complet du fichier en combinant le dossier et le nom du fichier + String filePath = selectedFolder.getAbsolutePath() + File.separator + fileName + ".xlsx"; + + new CreateCalcWorkbook(data,filePath); + + } + + + + + } +} diff --git a/src/baseUFRHG/demarre.java b/src/baseUFRHG/demarre.java index 5fbe3e8..40822b5 100644 --- a/src/baseUFRHG/demarre.java +++ b/src/baseUFRHG/demarre.java @@ -36,6 +36,10 @@ public class demarre extends JFrame { } public demarre() { + commandes.nBase = recupeBases.recupeLaBase(); + + + initialize(); } diff --git a/src/baseUFRHG/exportBaseToExcel.java b/src/baseUFRHG/exportBaseToExcel.java index bdf6b30..95cc157 100644 --- a/src/baseUFRHG/exportBaseToExcel.java +++ b/src/baseUFRHG/exportBaseToExcel.java @@ -1,5 +1,7 @@ package baseUFRHG; +import java.nio.file.Paths; + import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -90,7 +92,7 @@ public class exportBaseToExcel { } if(data.length>0) { - new CreateCalcWorkbook(data,"Base"); + new CreateCalcWorkbook(data, Paths.get("").toAbsolutePath().toString()+ "/Base.xlsx"); }else { JPanel panel = new JPanel(); JLabel message = new JLabel("

La base de données est nulle.

"); @@ -181,7 +183,12 @@ public class exportBaseToExcel { if(data.length>0) { - new CreateCalcWorkbook(data,formation); + + + FileSaveXLSX s = new FileSaveXLSX(); + s.chooseDestination(data, formation); + + }else { JPanel panel = new JPanel(); JLabel message = new JLabel("

La base de données est nulle.

"); diff --git a/src/baseUFRHG/lecture.java b/src/baseUFRHG/lecture.java index b94fb2e..6a3e957 100644 --- a/src/baseUFRHG/lecture.java +++ b/src/baseUFRHG/lecture.java @@ -33,7 +33,8 @@ public class lecture { // ajoute les étudiants qui n'existent pas, dans la base. - nBase = majBase.addStudents(nBase,noeudCSV); + commandes.nBase = majBase.addStudents(nBase,noeudCSV); + }else { JPanel panel = new JPanel(); JLabel message = new JLabel("

La base de données est nulle.

");