$
This commit is contained in:
parent
337340e8fd
commit
7e475648ed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -14,6 +14,8 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import org.mariadb.jdbc.*;
|
||||
|
||||
import javax.crypto.spec.PSource;
|
||||
|
||||
/**
|
||||
* <p>Methodes pour les interaction avec une base de donnees</p>
|
||||
*
|
||||
|
@ -7,6 +7,7 @@ import javax.swing.JTextField;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JScrollPane;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
@ -15,6 +16,7 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ProfView extends BFrame implements ActionListener {
|
||||
@ -199,7 +201,6 @@ public class ProfView extends BFrame implements ActionListener {
|
||||
data_final[x] = data[x];
|
||||
}
|
||||
|
||||
|
||||
JTable liste = new JTable(data_final, titre) {
|
||||
public boolean editCellAt(int row, int column, java.util.EventObject e) {
|
||||
return false;
|
||||
@ -214,66 +215,75 @@ public class ProfView extends BFrame implements ActionListener {
|
||||
|
||||
frame.openBFrame();
|
||||
} else if(command == "fi::SearchStudentPer3Letters") {
|
||||
/**
|
||||
* Faire l'interface du filtrage.
|
||||
* */
|
||||
char[] beg = this.text.getText().toCharArray();
|
||||
ArrayList<Etudiant> listFiltered = new ArrayList<>();
|
||||
char[] cur;
|
||||
if(this.text.getText().length() < 3 || this.text.getText() == null) {
|
||||
JOptionPane.showMessageDialog(
|
||||
this,
|
||||
"Veuillez ecrire au moins 3 lettres",
|
||||
"Erreur.",
|
||||
JOptionPane.ERROR_MESSAGE
|
||||
);
|
||||
} else {
|
||||
char[] beg = this.text.getText().toCharArray();
|
||||
|
||||
for(int i = 0; i <= this.e.size()-1; i++) {
|
||||
cur = this.e.get(i).getNom().toCharArray();
|
||||
if(cur[0] == beg[0] && cur[1] == beg[1] && cur[2] == beg[2]) {
|
||||
listFiltered.add(new EtudiantNP(
|
||||
this.e.get(i).getNom(),
|
||||
this.e.get(i).getPrenom(),
|
||||
this.e.get(i).getGroupe()
|
||||
));
|
||||
BFrame frame = new BFrame(
|
||||
"Liste d'eleves d'ou les noms commence par " + beg[0] + beg[1] + beg[2],
|
||||
1,
|
||||
1,
|
||||
500,
|
||||
500,
|
||||
"GridLayout",
|
||||
1,
|
||||
1,
|
||||
2
|
||||
);
|
||||
|
||||
ArrayList<String> filtreEleveNom = db.fetchAll("SELECT nom FROM fi_eleves WHERE nom LIKE '" + beg[0] + beg[1] + beg[2] + "%'");
|
||||
ArrayList<String> filtreElevePrenom = db.fetchAll("SELECT prenom FROM fi_eleves WHERE nom LIKE '" + beg[0] + beg[1] + beg[2] + "%'");
|
||||
ArrayList<String> filtreEleveGroupe = db.fetchAll("SELECT groupe FROM fi_eleves WHERE nom LIKE '" + beg[0] + beg[1] + beg[2] + "%'");
|
||||
|
||||
System.out.println(filtreEleveGroupe.size() + filtreElevePrenom.size() + filtreEleveGroupe.size());
|
||||
|
||||
if(filtreEleveGroupe.size() == 0 || filtreEleveNom.size() == 0 || filtreElevePrenom.size() == 0) {
|
||||
JOptionPane.showMessageDialog(
|
||||
this,
|
||||
"Eleve introuvable !",
|
||||
"Erreur.",
|
||||
JOptionPane.ERROR_MESSAGE
|
||||
);
|
||||
|
||||
frame.closeBFrame();
|
||||
} else {
|
||||
String[] titre = {
|
||||
"Nom",
|
||||
"Prenom",
|
||||
"Groupe"
|
||||
};
|
||||
|
||||
String[][] data = new String[filtreEleveNom.size()][2];
|
||||
|
||||
for(int i = 0; i <= filtreEleveNom.size()-1; i++){
|
||||
data[i] = new String[]{
|
||||
filtreEleveNom.get(i),
|
||||
filtreElevePrenom.get(i),
|
||||
String.valueOf(filtreEleveGroupe.get(i))
|
||||
};
|
||||
}
|
||||
|
||||
JTable liste = new JTable(data, titre) {
|
||||
public boolean editCellAt(int row, int column, java.util.EventObject e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
liste.getTableHeader().setReorderingAllowed(false);
|
||||
liste.setFillsViewportHeight(true);
|
||||
|
||||
JScrollPane scroll = new JScrollPane(liste);
|
||||
frame.getContentPane().add(scroll);
|
||||
|
||||
frame.openBFrame();
|
||||
}
|
||||
}
|
||||
|
||||
BFrame frame = new BFrame(
|
||||
"Liste d'eleves d'ou les noms commence par " + beg[0] + beg[1] + beg[2],
|
||||
1,
|
||||
1,
|
||||
500,
|
||||
500,
|
||||
"GridLayout",
|
||||
1,
|
||||
1,
|
||||
2
|
||||
);
|
||||
|
||||
String[] titre = {
|
||||
"Nom",
|
||||
"Prenom",
|
||||
"Groupe"
|
||||
};
|
||||
|
||||
String[][] data = new String[listFiltered.size()][2];
|
||||
|
||||
for(int i = 0; i <= listFiltered.size()-1; i++){
|
||||
data[i] = new String[]{
|
||||
this.e.get(i).getNom(),
|
||||
this.e.get(i).getPrenom(),
|
||||
String.valueOf(this.e.get(i).getGroupe())
|
||||
};
|
||||
}
|
||||
|
||||
JTable liste = new JTable(data, titre) {
|
||||
public boolean editCellAt(int row, int column, java.util.EventObject e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
liste.getTableHeader().setReorderingAllowed(false);
|
||||
liste.setFillsViewportHeight(true);
|
||||
|
||||
JScrollPane scroll = new JScrollPane(liste);
|
||||
frame.getContentPane().add(scroll);
|
||||
|
||||
frame.openBFrame();
|
||||
frame.refreshBFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,6 @@ public class TestTexteMNP {
|
||||
Integer.parseInt(studGroupe.get(i), 10)
|
||||
)
|
||||
);
|
||||
|
||||
//System.out.println(listEtu.get(i).monPrint());
|
||||
} else {
|
||||
System.out.println("[!] Erreur lors du chargement de la liste des etudiants.");
|
||||
System.exit(-1);
|
||||
@ -65,6 +63,9 @@ public class TestTexteMNP {
|
||||
|
||||
System.out.println("[+] Liste des groupes chargees.");
|
||||
|
||||
/**
|
||||
* Redirection vers ProfView (vue professeur)
|
||||
* */
|
||||
new ProfView(listEtu, listGroupe, bd);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user