MAJ V1.0.1 (JRE 1.8 with JDK 1.8.0_271)

This commit is contained in:
pablo rodriguez 2023-07-02 17:25:20 +02:00
parent 60034013c0
commit bc5433e2c6
11 changed files with 80 additions and 55 deletions

BIN
Base.xlsx

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,7 @@ import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import baseUFRHG.exportBaseToExcel;
@ -43,7 +44,7 @@ public class exportTable extends AbstractAction{
if(nTable!=null) {
exportBaseToExcel.exportTable(nTable, exportType.TABLE);
}else {
System.out.println("nTable = null");
JOptionPane.showMessageDialog(null, "Erreur, la table est null","erreur", JOptionPane.ERROR_MESSAGE);
}
}

View File

@ -67,7 +67,6 @@ public class createEmargement extends JFrame{
this.fr.setLocationRelativeTo(null); // Centre la fenêtre à l'écran
this.fr.setVisible(true);
this.fr.setVisible(true);
processTask = new ProcessTask(data);
processTask.execute();

View File

@ -22,7 +22,7 @@ public class exportBaseToExcel {
public static void exportBase() {
// Données
Object[][] data = new Object[commandes.nBase.getChild(commandes.nBase.getAttributes("defaut_Year")).getNumberChildren()][30];
Object[][] data = new Object[commandes.nBase.getChild(commandes.nBase.getAttributes("defaut_Year")).getNumberChildren()][29];
@ -40,26 +40,25 @@ public class exportBaseToExcel {
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] = "Regime";
data[indexFormation][16] = "Groupe_Informatique";
data[indexFormation][17] = "Atelier-rentree_horaire";
data[indexFormation][18] = "Atelier_pre-rentree_enseignant";
data[indexFormation][19] = "Atelier_pre-rentree_salle";
data[indexFormation][20] = "UE_Libre";
data[indexFormation][21] = "Covoiturage";
data[indexFormation][22] = "Etudiant_Covoiturage";
data[indexFormation][23] = "Stage_1";
data[indexFormation][24] = "Num_convention_1";
data[indexFormation][25] = "Periode_1";
data[indexFormation][26] = "Stage_2";
data[indexFormation][27] = "Num_convention_2";
data[indexFormation][28] = "Periode_2";
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] = "Regime";
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()][28];
@ -95,7 +94,7 @@ public class exportBaseToExcel {
data1[indexStudent][27] = nStudent.getAttributes("Periode_2");
data[indexFormation][29] = data1;
data[indexFormation][28] = data1;
indexStudent++;
}
@ -209,7 +208,7 @@ public class exportBaseToExcel {
FileSaveXLSX s = new FileSaveXLSX();
s.save(data1, formation, type);
s.save(data, formation, type);
}else {

View File

@ -55,7 +55,7 @@ public class importAllBaseToExcel {
indexCol = cell.getColumnIndex();
if(indexCol==0) { // Colonne formation
if(indexCol==0) { // Colonne formation doit être la première colonne
if(cell.getCellType() == CellType.STRING) {
nBF = nYear.getChild(supprimeCaracatresSpeciaux.TousLesCaracatresSpeciaux(cell.getStringCellValue()));
}
@ -78,48 +78,68 @@ public class importAllBaseToExcel {
CellType cellType = cell.getCellType();
if (cellType == CellType.STRING) {
String cellValue = cell.getStringCellValue();
String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
if(value!=null) {
boolean isOnlySpaces = value.matches("\\s+");
if(!isOnlySpaces)if(!cellValue.equals(value)) {
nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
compteur++;
if(sheet.getRow(0).getCell(indexCol)!=null) {
boolean isString = sheet.getRow(0).getCell(indexCol).getCellType() == CellType.STRING;
if(isString) {
String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
if(value!=null) {
boolean isOnlySpaces = value.matches("\\s+");
if(!isOnlySpaces)if(!cellValue.equals(value)) {
nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
compteur++;
}
}
}
}
System.out.print(cellValue + " ");
System.out.print(cellValue + " ");
} else if (cellType == CellType.NUMERIC) {
String cellValue = String.valueOf( (int) cell.getNumericCellValue());
String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
if(value!=null) {
boolean isOnlySpaces = value.matches("\\s+");
if(!isOnlySpaces)if(!cellValue.equals(value)) {
nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
compteur++;
if(sheet.getRow(0).getCell(indexCol)!=null) {
boolean isString = sheet.getRow(0).getCell(indexCol).getCellType() == CellType.STRING;
if(isString) {
String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
if(value!=null) {
boolean isOnlySpaces = value.matches("\\s+");
if(!isOnlySpaces)if(!cellValue.equals(value)) {
nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
compteur++;
}
}
}
}
System.out.print(cellValue + " ");
} else if (cellType == CellType.BOOLEAN) {
String cellValue = String.valueOf(cell.getBooleanCellValue());
String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
boolean isOnlySpaces = value.matches("\\s+");
if(value!=null) {
if(!isOnlySpaces)if(!cellValue.equals(value)) {
nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
compteur++;
if(sheet.getRow(0).getCell(indexCol)!=null) {
boolean isString = sheet.getRow(0).getCell(indexCol).getCellType() == CellType.STRING;
if(isString) {
String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
boolean isOnlySpaces = value.matches("\\s+");
if(value!=null) {
if(!isOnlySpaces)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.)
String cellValue = (String) cell.getStringCellValue();
String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
if(value!=null) {
boolean isOnlySpaces = value.matches("\\s+");
if(!isOnlySpaces)if(!cellValue.equals(value)) {
nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
compteur++;
}
}
if(sheet.getRow(0).getCell(indexCol)!=null) {
boolean isString = sheet.getRow(0).getCell(indexCol).getCellType() == CellType.STRING;
if(isString) {
String value = nStudent.getAttributes(sheet.getRow(0).getCell(indexCol).getStringCellValue());
if(value!=null) {
boolean isOnlySpaces = value.matches("\\s+");
if(!isOnlySpaces)if(!cellValue.equals(value)) {
nStudent.setAttribut(sheet.getRow(0).getCell(indexCol).getStringCellValue(), cellValue);
compteur++;
}
}
}
}
}
}

View File

@ -186,6 +186,8 @@ public class noeud implements Cloneable{
* @return
*/
public String getAttributes(String nameAttribut) {
if(nameAttribut == null) return null;
if(nameAttribut.matches("\\s*")) return null;
if(this.attributes.containsKey(nameAttribut)) return this.attributes.get(nameAttribut);
return null;
}
@ -197,6 +199,8 @@ public class noeud implements Cloneable{
* @return
*/
public String getAttributesBeginBy(String nameAttribut) {
if(nameAttribut == null) return null;
if(nameAttribut.matches("\\s*")) return null;
Pattern pattern = Pattern.compile("^" + nameAttribut +".*$");
for (Map.Entry<String, String> entry : attributes.entrySet()) {
if(pattern.matcher(entry.getKey()).matches()) {
@ -213,6 +217,8 @@ public class noeud implements Cloneable{
* @return
*/
public Boolean containAttributBeginBy(String nameAttribut) {
if(nameAttribut == null) return null;
if(nameAttribut.matches("\\s*")) return null;
Pattern pattern = Pattern.compile("^" + nameAttribut +".*$");
for (Map.Entry<String, String> entry : attributes.entrySet()) {
if(pattern.matcher(entry.getKey()).matches()) {