Transférer les fichiers vers 'src/Test'

This commit is contained in:
Romain BESSON 2022-12-01 21:08:14 +01:00
parent 4b11806f28
commit 20b60e2e76

View File

@ -18,10 +18,10 @@ import java.util.Objects;
public class Controller implements ActionListener, ListSelectionListener { public class Controller implements ActionListener, ListSelectionListener {
private final BDatabase db; private final BDatabase db;
private ProfView pv = null; private ProfView pv;
private AdminView av = null; private AdminView av;
private StudentView sv;
private BFrame currentModal; private BFrame currentModal;
private MainMenu parent; private MainMenu parent;
private ArrayList<Etudiant> e; private ArrayList<Etudiant> e;
@ -32,17 +32,15 @@ public class Controller implements ActionListener, ListSelectionListener {
private ArrayList<String> tmpStud; private ArrayList<String> tmpStud;
public Controller(BDatabase db, MainMenu frame) { public Controller(BDatabase db) {
this.db = db; this.db = db;
this.e = this.db.getEtuList(); this.e = this.db.getEtuList();
this.g = this.db.getGroupeList(); this.g = this.db.getGroupeList();
parent = frame;
// Les 3 fenetres s'ouvriront en meme temps (Pour le contexte du projet) this.sv = new StudentView(this.e, this.g, this);
//this.pv = new ProfView(this.e, this.g, this); this.pv = new ProfView(this.e, this.g, this);
//System.out.println("[+] Demarrage de la vue professeur -> " + this.pv); this.av = new AdminView(this.e, this.g, this);
//this.av = new AdminView(this.e, this.g, this); this.parent = new MainMenu(this);
//System.out.println("[+] Demarrage de la vue Administrateur -> " + this.av);
} }
/** /**
@ -58,7 +56,7 @@ public class Controller implements ActionListener, ListSelectionListener {
}; };
} }
// TODO: mettre a jour les parametres de la methode la pluplart sont inutiles
/** /**
* Pour afficher une JTable sans listener * Pour afficher une JTable sans listener
* *
@ -82,10 +80,10 @@ public class Controller implements ActionListener, ListSelectionListener {
//forModal.add(liste); //forModal.add(liste);
//BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal); //BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal);
} }
// TODO: mettre a jour les parametres de la methode la pluplart sont inutiles
/** /**
* Pour afficher une JTable contenant un listener * Pour afficher une JTable contenant un listener
* *
@ -287,7 +285,7 @@ public class Controller implements ActionListener, ListSelectionListener {
} }
else if(Objects.equals(command, "av::AddStudGrup")) { else if(Objects.equals(command, "av::AddStudGrup")) {
ArrayList<ArrayList<String>> data = new ArrayList(); ArrayList<ArrayList<String>> data = new ArrayList<>();
String[] titre = { String[] titre = {
"Nom", "Nom",
@ -437,7 +435,6 @@ public class Controller implements ActionListener, ListSelectionListener {
} }
} }
public JTable initTable() { public JTable initTable() {
Object[][] data = new Object[this.e.size()][3]; Object[][] data = new Object[this.e.size()][3];
String[] title = { String[] title = {
@ -445,7 +442,6 @@ public class Controller implements ActionListener, ListSelectionListener {
"Prenom", "Prenom",
"Groupe", "Groupe",
}; };
for(int i = 0; i <= this.e.size()-1; i++) { for(int i = 0; i <= this.e.size()-1; i++) {
Object[] info = { Object[] info = {
this.e.get(i).getNom(), this.e.get(i).getNom(),
@ -453,25 +449,21 @@ public class Controller implements ActionListener, ListSelectionListener {
String.valueOf(this.e.get(i).getGroupe()), String.valueOf(this.e.get(i).getGroupe()),
"[DEPLACER]" "[DEPLACER]"
}; };
data[i] = info; data[i] = info;
} }
return createJTable(data, title); return createJTable(data, title);
} }
public ProfView getProfView() {
public void setAv (AdminView av) { return this.pv;
if (this.av == null) {
this.av = av;
}
} }
public StudentView getStudentView() {
public void setPv (ProfView pv) { return this.sv;
if (this.pv == null) {
this.pv = pv;
} }
public AdminView getAdminView() {
return this.av;
} }