diff --git a/GestionDesInscriptions.jar b/GestionDesInscriptions.jar
index 73585a0..4e0454c 100644
Binary files a/GestionDesInscriptions.jar and b/GestionDesInscriptions.jar differ
diff --git a/base.xlsx b/base.xlsx
index 43a668f..137cdc7 100644
Binary files a/base.xlsx and b/base.xlsx differ
diff --git a/base.xml b/base.xml
index 386ca9f..13a6799 100644
--- a/base.xml
+++ b/base.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/resources/fusionneBaseEvaluation.svg b/resources/fusionneBaseEvaluation.svg
index 7294e4e..0e5f3e7 100644
--- a/resources/fusionneBaseEvaluation.svg
+++ b/resources/fusionneBaseEvaluation.svg
@@ -10,7 +10,7 @@
xml:space="preserve"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
sodipodi:docname="fusionneBaseEvaluation.svg"
- inkscape:export-filename="importationexcel.png"
+ inkscape:export-filename="gestionnaire.png"
inkscape:export-xdpi="102.4"
inkscape:export-ydpi="102.4"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
@@ -28,9 +28,9 @@
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
- inkscape:zoom="4.4685506"
- inkscape:cx="31.777642"
- inkscape:cy="13.762852"
+ inkscape:zoom="4.1277778"
+ inkscape:cx="22.530283"
+ inkscape:cy="22.893674"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
@@ -85,7 +85,7 @@
x2="-28.613434"
y2="168.68048"
gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.84635001,0,0,0.84635001,-13.979249,241.60397)" /> {
+
+ private Object[][] data;
+
+ public ProcessTask(Object[][] data) {
+ this.data = data;
+ }
+
+
+ @Override
+ protected Void doInBackground() throws Exception {
+ String filePath = Paths.get("").toAbsolutePath().toString()+ "/base.xlsx";
+
+ try (Workbook workbook = new XSSFWorkbook()) {
+ int rows = data.length; // Nombre de lignes
+ int columns = data[0].length;
+
+ // Créer un style de cellule avec des bordures
+ CellStyle cellStyle = workbook.createCellStyle();
+ cellStyle.setBorderTop(BorderStyle.THIN);
+ cellStyle.setBorderBottom(BorderStyle.THIN);
+ cellStyle.setBorderLeft(BorderStyle.THIN);
+ cellStyle.setBorderRight(BorderStyle.THIN);
+ cellStyle.setAlignment(HorizontalAlignment.LEFT);
+ cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+
+ for (int i = 0; i < rows; i++) {
+ publish(i);
+
+ String nameFormation = (String) data[i][0];
+ String[][] data1 = (String[][]) data[i][columns-1];
+
+ Sheet sheet = workbook.createSheet(nameFormation);
+
+ //Entête de la première ligne
+ Row row1 = sheet.createRow(0);
+ Cell cell1 = row1.createCell(0);
+ int tailleHead = columns - 2 ;
+ for(int j = 0 ; j < tailleHead; j++) {
+ cell1 = row1.createCell(j);
+ cell1.setCellValue((String) data[i][j+1]);
+ cell1.setCellStyle(cellStyle);
+ }
+
+ // Boucle pour insérer les données dans les colonnes
+ int rowNum = 1;
+ for (Object[] rowData : data1) {
+ Row row = sheet.createRow(rowNum++);
+
+ int colNum = 0;
+ for (Object cellData : rowData) {
+ Cell cell = row.createCell(colNum++);
+ if (cellData instanceof String) {
+ cell.setCellValue((String) cellData);
+ } else if (cellData instanceof Integer) {
+ cell.setCellValue((Integer) cellData);
+ }
+ cell.setCellStyle(cellStyle);
+ }
+ }
+
+ for(int j = 0 ; j < tailleHead; j++) {
+ sheet.autoSizeColumn(j);
+ }
+
+
+ }
+
+ // Enregistrer le classeur dans un fichier
+ FileOutputStream fileOut = new FileOutputStream(filePath);
+ workbook.write(fileOut);
+ fileOut.close();
+
+ progressBar.setValue(data.length);
+ System.out.println("Le classeur a été créé avec succès.");
+ JOptionPane.showMessageDialog(null, "Le classeur a été créé avec succès.");
+
+ }catch (IOException e) {
+ System.out.println(e.toString());
+// e.printStackTrace();
+ JOptionPane.showMessageDialog(null, e.toString(), "Erreur dans la class CreateCalcWorkbook", JOptionPane.ERROR_MESSAGE);
+ }
+ return null;
+ }
+
+ @Override
+ protected void process(java.util.List chunks) {
+ int value = chunks.get(chunks.size()-1);
+ progressBar.setValue(value);
+ }
+
+ @Override
+ protected void done() {
+
+// JOptionPane.showMessageDialog(CreateCalcWorkbook.this, "Le processus est terminé !");
+
+ }
+ }
+
+
+
+
+
+
+
+
}
+
+
+
+
diff --git a/src/baseUFRHG/ProgressBarExample.java b/src/baseUFRHG/ProgressBarExample.java
new file mode 100644
index 0000000..f138b26
--- /dev/null
+++ b/src/baseUFRHG/ProgressBarExample.java
@@ -0,0 +1,106 @@
+package baseUFRHG;
+
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JProgressBar;
+import javax.swing.SwingUtilities;
+import javax.swing.SwingWorker;
+
+public class ProgressBarExample extends JFrame {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private JButton startButton;
+ private JProgressBar progressBar;
+ private ProcessTask processTask;
+
+ public ProgressBarExample() {
+ setTitle("Exemple de ProgressBar");
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setLayout(new FlowLayout());
+
+ startButton = new JButton("Démarrer");
+ progressBar = new JProgressBar(0, 100);
+ progressBar.setStringPainted(true);
+
+ startButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ startButton.setEnabled(false);
+ processTask = new ProcessTask();
+ processTask.execute();
+ }
+ });
+
+ add(startButton);
+ add(progressBar);
+
+ pack();
+ setVisible(true);
+ }
+
+ private class ProcessTask extends SwingWorker {
+
+ private List progressList;
+
+ public ProcessTask() {
+ progressList = new ArrayList<>();
+ }
+
+ @Override
+ protected Void doInBackground() throws Exception {
+ runLongProcess();
+ return null;
+ }
+
+ @Override
+ protected void process(List chunks) {
+ int value = chunks.get(chunks.size() - 1);
+ progressBar.setValue(value);
+ }
+
+ @Override
+ protected void done() {
+ startButton.setEnabled(true);
+ progressBar.setValue(0);
+ JOptionPane.showMessageDialog(ProgressBarExample.this, "Le processus est terminé !");
+ }
+
+ private void runLongProcess() {
+ for (int i = 0; i <= 100; i++) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ progressList.add(i);
+ publishProgress();
+ }
+ }
+
+ private void publishProgress() {
+ int lastIndex = progressList.size() - 1;
+ Integer[] chunks = new Integer[]{progressList.get(lastIndex)};
+ publish(chunks);
+ }
+ }
+
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ new ProgressBarExample();
+ }
+ });
+ }
+
+}
diff --git a/src/baseUFRHG/createEvaluation.java b/src/baseUFRHG/createEvaluation.java
index 3d31d28..dd8e8b4 100644
--- a/src/baseUFRHG/createEvaluation.java
+++ b/src/baseUFRHG/createEvaluation.java
@@ -18,35 +18,7 @@ public class createEvaluation {
}
public createEvaluation(noeud rootContent, noeud rootStyles, noeud rootMeta, noeud graphics, String filenameFichier){
-
- // création du premier noeud contenant tous les espaces de nom.
-// analyseCalc = createNoeudAnalyseCalc.entete();
-
- // création et ajoute le noeud analyseCalc au premier noeud.
-// noeud evaluation = new createNoeudEvaluation().getEvaluation();
-
- // Ajoute le noeud evaluation au noeud analyseCalc
-// analyseCalc.addChild(evaluation);
-
- // création et assemblage du noeud fichier.
-// assemblageEtCreationNoeudFichier createFichier = new assemblageEtCreationNoeudFichier(rootContent, rootStyles, rootMeta, graphics, use, filenameFichier);
-
- // Création du noeud csv
-// noeud csv = new noeud("csv");
-// csv.setAttribut("encoding", "UTF-8");
-// csv.setAttribut("separator", ";");
-// csv.setAttribut("nom", "nom");
-// csv.setAttribut("prenom", "prenom");
-// csv.setAttribut("identifiant", "identifiant");
-// csv.setAttribut("email", "email");
-
- // Assemblage du noeud evaluation
-// evaluation.addChild(createFichier.getFichier());
-// evaluation.addChild(csv);
-//
-// commandes.initialise();
-
}
}
diff --git a/src/baseUFRHG/demarre.java b/src/baseUFRHG/demarre.java
index b081c03..d2a2475 100644
--- a/src/baseUFRHG/demarre.java
+++ b/src/baseUFRHG/demarre.java
@@ -1,9 +1,9 @@
package baseUFRHG;
import java.awt.Font;
-import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@@ -45,9 +45,8 @@ public class demarre extends JFrame {
*/
private void initialize() {
frmEvalwriter = new JFrame();
- frmEvalwriter.setResizable(false);
frmEvalwriter.setTitle("Gestion des inscriptions et des groupes - langues - informatique - stage - rentrée");
- frmEvalwriter.setBounds(100, 100, 760, 488);
+ frmEvalwriter.setBounds(100, 100, 760, 484);
int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth();
int screenHeight = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight();
frmEvalwriter.setLocation(( (screenWidth) - frmEvalwriter.getWidth()) / 2, (screenHeight - frmEvalwriter.getHeight()) / 2);
@@ -98,7 +97,12 @@ public class demarre extends JFrame {
btnNewButton.setHorizontalAlignment(SwingConstants.LEFT);
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- importAllBaseToExcel.lecture();
+ File f = FileChooserXLSX.retourneFileXLSX();
+ if(f!=null) {
+ importAllBaseToExcel.lecture(f);
+ }else {
+
+ }
}
});
btnNewButton.setFont(new Font("Arial", Font.BOLD, 16));
@@ -123,7 +127,7 @@ public class demarre extends JFrame {
// btnTutoriels.setIcon(new ImageIcon(demarre.class.getResource("/resources/tutoriel.png")));
btnTutoriels.setHorizontalAlignment(SwingConstants.LEFT);
btnTutoriels.setFont(new Font("Arial", Font.BOLD, 16));
- btnTutoriels.setBounds(376, 313, 356, 60);
+ btnTutoriels.setBounds(376, 313, 356, 95);
frmEvalwriter.getContentPane().add(btnTutoriels);
JLabel lblNewLabel_1 = new JLabel("Importer dans la base des inscriptions depuis un fichier");
@@ -149,7 +153,21 @@ public class demarre extends JFrame {
frmEvalwriter.getContentPane().add(btnimporterDesInscriptionsdepuis);
JLabel lblNewLabel_2 = new JLabel("version 1.0.0");
- lblNewLabel_2.setBounds(10, 424, 128, 14);
+ lblNewLabel_2.setBounds(139, 426, 128, 14);
frmEvalwriter.getContentPane().add(lblNewLabel_2);
+
+ JLabel lblNewLabel_3 = new JLabel("pablo rodriguez - 2023");
+ lblNewLabel_3.setBounds(10, 426, 151, 14);
+ frmEvalwriter.getContentPane().add(lblNewLabel_3);
+
+ JButton btnNewButton_1 = new JButton("Aide à la mise en jour");
+ btnNewButton_1.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+
+ }
+ });
+ btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 12));
+ btnNewButton_1.setBounds(10, 378, 356, 30);
+ frmEvalwriter.getContentPane().add(btnNewButton_1);
}
}
diff --git a/src/baseUFRHG/exportBaseToExcel.java b/src/baseUFRHG/exportBaseToExcel.java
index 053faba..2394602 100644
--- a/src/baseUFRHG/exportBaseToExcel.java
+++ b/src/baseUFRHG/exportBaseToExcel.java
@@ -2,76 +2,83 @@ package baseUFRHG;
public class exportBaseToExcel {
+
public static void export(noeud nBase) {
// Données
- Object[][] data = new Object[nBase.getChild(nBase.getAttributes("defaut_Year")).getNumberChildren()][28];
-
+ Object[][] data = new Object[nBase.getChild(nBase.getAttributes("defaut_Year")).getNumberChildren()][29];
+
+
+
int indexFormation = 0 ;
for(noeud formation : nBase.getChild(nBase.getAttributes("defaut_Year")).getChildren()) {
+
+
+
data[indexFormation][0] = formation.getName();
- data[indexFormation][1] = "Individu_-_Code_Etudiant";
- data[indexFormation][2] = "Individu_-_Prenom";
- data[indexFormation][3] = "Individu_-_Nom";
- data[indexFormation][4] = "Profil_etudiant_lib.";
- data[indexFormation][5] = "Individu_-_Tel._portable";
- data[indexFormation][6] = "Individu_-_Email_personnel";
- data[indexFormation][7] = "Individu_-_Email";
- data[indexFormation][8] = "Groupe";
- data[indexFormation][9] = "Groupe_Principal";
- data[indexFormation][10] = "Groupe_TD";
- data[indexFormation][11] = "Groupe_Langue";
- data[indexFormation][12] = "LV1";
- data[indexFormation][13] = "LV2";
- data[indexFormation][14] = "Groupe_Informatique";
- data[indexFormation][15] = "Atelier-rentree_horaire";
- data[indexFormation][16] = "Atelier_pre-rentree_enseignant";
- data[indexFormation][17] = "Atelier_pre-rentree_salle";
- data[indexFormation][18] = "UE_Libre";
- data[indexFormation][19] = "Covoiturage";
- data[indexFormation][20] = "Etudiant_Covoiturage";
- data[indexFormation][21] = "Stage_1";
- data[indexFormation][22] = "Num_convention_1";
- data[indexFormation][23] = "Periode_1";
- data[indexFormation][24] = "Stage_2";
- data[indexFormation][25] = "Num_convention_2";
- data[indexFormation][26] = "Periode_2";
-
-
- String[][] data1 = new String[formation.getNumberChildren()][26];
+ data[indexFormation][1] = "Formation";
+ data[indexFormation][2] = "Individu_-_Code_Etudiant";
+ data[indexFormation][3] = "Individu_-_Prenom";
+ data[indexFormation][4] = "Individu_-_Nom";
+ data[indexFormation][5] = "Profil_etudiant_lib.";
+ data[indexFormation][6] = "Individu_-_Tel._portable";
+ data[indexFormation][7] = "Individu_-_Email_personnel";
+ data[indexFormation][8] = "Individu_-_Email";
+ data[indexFormation][9] = "Groupe";
+ data[indexFormation][10] = "Groupe_Principal";
+ data[indexFormation][11] = "Groupe_TD";
+ data[indexFormation][12] = "Groupe_Langue";
+ data[indexFormation][13] = "LV1";
+ data[indexFormation][14] = "LV2";
+ data[indexFormation][15] = "Groupe_Informatique";
+ data[indexFormation][16] = "Atelier-rentree_horaire";
+ data[indexFormation][17] = "Atelier_pre-rentree_enseignant";
+ data[indexFormation][18] = "Atelier_pre-rentree_salle";
+ data[indexFormation][19] = "UE_Libre";
+ data[indexFormation][20] = "Covoiturage";
+ data[indexFormation][21] = "Etudiant_Covoiturage";
+ data[indexFormation][22] = "Stage_1";
+ data[indexFormation][23] = "Num_convention_1";
+ data[indexFormation][24] = "Periode_1";
+ data[indexFormation][25] = "Stage_2";
+ data[indexFormation][26] = "Num_convention_2";
+ data[indexFormation][27] = "Periode_2";
+
+ String[][] data1 = new String[formation.getNumberChildren()][27];
int indexStudent = 0;
for(noeud nStudent : formation.getChildren()) {
- data1[indexStudent][0] = nStudent.getAttributes("Individu_-_Code_Etudiant");
- data1[indexStudent][1] = nStudent.getAttributes("Individu_-_Prenom");
- data1[indexStudent][2] = nStudent.getAttributes("Individu_-_Nom");
- data1[indexStudent][3] = nStudent.getAttributes("Profil_etudiant_lib.");
- data1[indexStudent][4] = nStudent.getAttributes("Individu_-_Tel._portable");
- data1[indexStudent][5] = nStudent.getAttributes("Individu_-_Email_personnel");
- data1[indexStudent][6] = nStudent.getAttributes("Individu_-_Email");
- data1[indexStudent][7] = nStudent.getAttributes("Groupe");
- data1[indexStudent][8] = nStudent.getAttributes("Groupe_Principal");
- data1[indexStudent][9] = nStudent.getAttributes("Groupe_TD");
- data1[indexStudent][10] = nStudent.getAttributes("Groupe_Langue");
- data1[indexStudent][11] = nStudent.getAttributes("LV1");
- data1[indexStudent][12] = nStudent.getAttributes("LV2");
- data1[indexStudent][13] = nStudent.getAttributes("Groupe_Informatique");
- data1[indexStudent][14] = nStudent.getAttributes("Atelier-rentree_horaire");
- data1[indexStudent][15] = nStudent.getAttributes("Atelier_pre-rentree_enseignant");
- data1[indexStudent][16] = nStudent.getAttributes("Atelier_pre-rentree_salle");
- data1[indexStudent][17] = nStudent.getAttributes("UE_Libre");
- data1[indexStudent][18] = nStudent.getAttributes("Covoiturage");
- data1[indexStudent][19] = nStudent.getAttributes("Etudiant_Covoiturage");
- data1[indexStudent][20] = nStudent.getAttributes("Stage_1");
- data1[indexStudent][21] = nStudent.getAttributes("Num_convention_1");
- data1[indexStudent][22] = nStudent.getAttributes("Periode_1");
- data1[indexStudent][23] = nStudent.getAttributes("Stage_2");
- data1[indexStudent][24] = nStudent.getAttributes("Num_convention_2");
- data1[indexStudent][25] = nStudent.getAttributes("Periode_2");
+ data1[indexStudent][0] = formation.getName();
+ data1[indexStudent][1] = nStudent.getAttributes("Individu_-_Code_Etudiant");
+ data1[indexStudent][2] = nStudent.getAttributes("Individu_-_Prenom");
+ data1[indexStudent][3] = nStudent.getAttributes("Individu_-_Nom");
+ data1[indexStudent][4] = nStudent.getAttributes("Profil_etudiant_lib.");
+ data1[indexStudent][5] = nStudent.getAttributes("Individu_-_Tel._portable");
+ data1[indexStudent][6] = nStudent.getAttributes("Individu_-_Email_personnel");
+ data1[indexStudent][7] = nStudent.getAttributes("Individu_-_Email");
+ data1[indexStudent][8] = nStudent.getAttributes("Groupe");
+ data1[indexStudent][9] = nStudent.getAttributes("Groupe_Principal");
+ data1[indexStudent][10] = nStudent.getAttributes("Groupe_TD");
+ data1[indexStudent][11] = nStudent.getAttributes("Groupe_Langue");
+ data1[indexStudent][12] = nStudent.getAttributes("LV1");
+ data1[indexStudent][13] = nStudent.getAttributes("LV2");
+ data1[indexStudent][14] = nStudent.getAttributes("Groupe_Informatique");
+ data1[indexStudent][15] = nStudent.getAttributes("Atelier-rentree_horaire");
+ data1[indexStudent][16] = nStudent.getAttributes("Atelier_pre-rentree_enseignant");
+ data1[indexStudent][17] = nStudent.getAttributes("Atelier_pre-rentree_salle");
+ data1[indexStudent][18] = nStudent.getAttributes("UE_Libre");
+ data1[indexStudent][19] = nStudent.getAttributes("Covoiturage");
+ data1[indexStudent][20] = nStudent.getAttributes("Etudiant_Covoiturage");
+ data1[indexStudent][21] = nStudent.getAttributes("Stage_1");
+ data1[indexStudent][22] = nStudent.getAttributes("Num_convention_1");
+ data1[indexStudent][23] = nStudent.getAttributes("Periode_1");
+ data1[indexStudent][24] = nStudent.getAttributes("Stage_2");
+ data1[indexStudent][25] = nStudent.getAttributes("Num_convention_2");
+ data1[indexStudent][26] = nStudent.getAttributes("Periode_2");
- data[indexFormation][27] = data1;
+ data[indexFormation][28] = data1;
indexStudent++;
}
@@ -84,4 +91,9 @@ public class exportBaseToExcel {
}
+
+
+
+
+
}
diff --git a/src/baseUFRHG/importAllBaseToExcel.java b/src/baseUFRHG/importAllBaseToExcel.java
index a340d7c..a1b471e 100644
--- a/src/baseUFRHG/importAllBaseToExcel.java
+++ b/src/baseUFRHG/importAllBaseToExcel.java
@@ -1,9 +1,11 @@
package baseUFRHG;
+import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.swing.JOptionPane;
+import javax.swing.JPanel;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
@@ -14,76 +16,100 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class importAllBaseToExcel {
- public static void lecture() {
+ public static void lecture(File file) {
noeud nBase = recupeBases.recupeLaBase();
- try (FileInputStream fileInputStream = new FileInputStream("base.xlsx");
+ try (FileInputStream fileInputStream = new FileInputStream(file.getAbsolutePath());
Workbook workbook = new XSSFWorkbook(fileInputStream)) {
int numSheets = workbook.getNumberOfSheets();
-
+ int compteur = 0 ;
+
+
for (int sheetIndex = 0; sheetIndex < numSheets; sheetIndex++) {
Sheet sheet = workbook.getSheetAt(sheetIndex);
-
- if( nBase.getChild(sheet.getSheetName())!=null ) {
-
- System.out.println("Feuille : " + sheet.getSheetName());
- noeud nBF = nBase.getChild(sheet.getSheetName());
-
for (Row row : sheet) {
int indexCol = 0;
+ noeud nBF = null;
noeud nStudent = null;
for (Cell cell : row) {
indexCol = cell.getColumnIndex();
- if(indexCol==0) {
- if (cell.getCellType() == CellType.NUMERIC) {
- String idStudent = String.valueOf( (int) cell.getNumericCellValue());
- nStudent = nBF.getChild("n"+idStudent);
- } else if(cell.getCellType() == CellType.STRING) {
- String idStudent = cell.getStringCellValue();
- nStudent = nBF.getChild("n"+idStudent);
+ if(indexCol==0) { // Colonne formation
+ if(cell.getCellType() == CellType.STRING) {
+ nBF = nBase.getChild(cell.getStringCellValue());
}
}
+ if(nBF!=null) {
+ if(indexCol==1) {
+ if (cell.getCellType() == CellType.NUMERIC) {
+ String idStudent = String.valueOf( (int) cell.getNumericCellValue());
+ nStudent = nBF.getChild("n"+idStudent);
+ } else if(cell.getCellType() == CellType.STRING) {
+ String idStudent = cell.getStringCellValue();
+ nStudent = nBF.getChild("n"+idStudent);
+ }
+ }
+ }
+
if(nStudent!=null) {
CellType cellType = cell.getCellType();
if (cellType == CellType.STRING) {
String cellValue = cell.getStringCellValue();
- nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
+ String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
+ if(!cellValue.equals(value)) {
+ nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
+ compteur++;
+ }
System.out.print(cellValue + " ");
} else if (cellType == CellType.NUMERIC) {
String cellValue = String.valueOf( (int) cell.getNumericCellValue());
- nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
- System.out.print(cellValue + " ");
+ String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
+ if(!cellValue.equals(value)) {
+ nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
+ compteur++;
+ }
+ System.out.print(cellValue + " ");
} else if (cellType == CellType.BOOLEAN) {
- boolean cellValue = cell.getBooleanCellValue();
- nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(),String.valueOf(cellValue));
+ String cellValue = String.valueOf(cell.getBooleanCellValue());
+ String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
+ if(!cellValue.equals(value)) {
+ nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
+ compteur++;
+ }
System.out.print(cellValue + " ");
} else {
// Autres types de cellules (formules, vides, etc.)
- nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(),"");
- System.out.print("[Type de cellule non pris en charge] ");
+ String cellValue = (String) cell.getStringCellValue();
+ String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
+ if(!cellValue.equals(value)) {
+ nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
+ compteur++;
+ }
+ System.out.print(cellValue + " ");
+// nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(),"");
+
}
}
-
-
}
System.out.println(); // Nouvelle ligne après chaque ligne du tableau
}
- };
+
System.out.println(); // Nouvelle ligne entre les feuilles
}
+ JOptionPane.showInternalMessageDialog(null, "Nombre de modification : " +String.valueOf(compteur));
+
} catch (IOException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(null, e.toString(), "Erreur dans la class importAllBaseToExcel", JOptionPane.ERROR_MESSAGE);
diff --git a/src/baseUFRHG/lecture.java b/src/baseUFRHG/lecture.java
index fb52cb6..82342ee 100644
--- a/src/baseUFRHG/lecture.java
+++ b/src/baseUFRHG/lecture.java
@@ -20,13 +20,7 @@ public class lecture {
if(fileData!=null) {
String filePath = fileData.getAbsolutePath();
noeudCSV = lectureCSV.noeudCSV(filePath);
-
-// try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
-// new FileOutputStream("C:\\Users\\pabr6\\OneDrive\\Documents\\corrine rapicault - inscriptions\\fichier.xml"), StandardCharsets.UTF_8))) {
-// writer.write(noeudCSV.toWrite());
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
+
}
} catch (Exception e) {
@@ -36,37 +30,6 @@ public class lecture {
// ajoute les étudiants qui n'existent pas, dans la base.
nBase = majBase.addStudents(nBase,noeudCSV);
-
-// //Exporte la base dans un classeur Excel.
-// exportBaseToExcel.export(nBase);
-
-// String directoryName = Paths.get("").toAbsolutePath().toString() + "/base.xml";
-// try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
-// new FileOutputStream(directoryName), StandardCharsets.UTF_8))) {
-// writer.write(nBase.toWrite());
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-//
-// System.out.println(nBase.toWrite());
-//
-//
-// // lecture et création d'un noeud à partir d'un fichier XML
-// try {
-// File fileData = FileChooserXML.retourneFileXML();
-//
-// if(fileData!=null) {
-// String filePath = fileData.getAbsolutePath();
-// String xmlString = lectureFileToString.lecture(filePath);
-// noeud noeud1 = lectureXML.lectureStringToNoeud(xmlString);
-// System.out.println(noeud1.toWrite());
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-
-
-
}