This commit is contained in:
pro.boooooo
2022-12-01 18:59:34 +01:00
parent 060c7c621e
commit 3bc0799992
8 changed files with 209 additions and 106 deletions

View File

@@ -18,11 +18,11 @@ import java.util.Objects;
public class Controller implements ActionListener, ListSelectionListener {
private final BDatabase db;
private ProfView pv = null;
private AdminView av = null;
private ProfView pv;
private AdminView av;
private StudentView sv;
private BFrame currentModal;
private MainMenu parent;
private JFrame parent;
private ArrayList<Etudiant> e;
private ArrayList<Groupe> g;
@@ -32,17 +32,15 @@ public class Controller implements ActionListener, ListSelectionListener {
private ArrayList<String> tmpStud;
public Controller(BDatabase db, MainMenu frame) {
public Controller(BDatabase db) {
this.db = db;
this.e = this.db.getEtuList();
this.g = this.db.getGroupeList();
parent = frame;
// Les 3 fenetres s'ouvriront en meme temps (Pour le contexte du projet)
//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);
//System.out.println("[+] Demarrage de la vue Administrateur -> " + this.av);
this.sv = new StudentView(this.e, this.g, this);
this.pv = new ProfView(this.e, this.g, this);
this.av = new AdminView(this.e, this.g, this);
this.parent = new MainMenu(this);
}
/**
@@ -58,7 +56,6 @@ public class Controller implements ActionListener, ListSelectionListener {
};
}
/**
* Pour afficher une JTable sans listener
*
@@ -283,7 +280,7 @@ public class Controller implements ActionListener, ListSelectionListener {
}
else if(Objects.equals(command, "av::AddStudGrup")) {
ArrayList<ArrayList<String>> data = new ArrayList();
ArrayList<ArrayList<String>> data = new ArrayList<>();
String[] titre = {
"Nom",
@@ -433,41 +430,16 @@ public class Controller implements ActionListener, ListSelectionListener {
}
}
public JTable initTable() {
Object[][] data = new Object[this.e.size()][3];
String[] title = {
"Nom",
"Prenom",
"Groupe",
};
for(int i = 0; i <= this.e.size()-1; i++) {
Object[] info = {
this.e.get(i).getNom(),
this.e.get(i).getPrenom(),
String.valueOf(this.e.get(i).getGroupe()),
"[DEPLACER]"
};
data[i] = info;
}
return createJTable(data, title);
public ProfView getProfView() {
return this.pv;
}
public void setAv (AdminView av) {
if (this.av == null) {
this.av = av;
}
public StudentView getStudentView() {
return this.sv;
}
public void setPv (ProfView pv) {
if (this.pv == null) {
this.pv = pv;
}
public AdminView getAdminView() {
return this.av;
}