Transférer les fichiers vers 'src/Test'

This commit is contained in:
2022-12-01 19:45:59 +01:00
parent 3bc0799992
commit 51ed175269
2 changed files with 121 additions and 65 deletions

View File

@@ -18,11 +18,11 @@ import java.util.Objects;
public class Controller implements ActionListener, ListSelectionListener {
private final BDatabase db;
private ProfView pv;
private AdminView av;
private StudentView sv;
private ProfView pv = null;
private AdminView av = null;
private BFrame currentModal;
private JFrame parent;
private MainMenu parent;
private ArrayList<Etudiant> e;
private ArrayList<Groupe> g;
@@ -32,15 +32,17 @@ public class Controller implements ActionListener, ListSelectionListener {
private ArrayList<String> tmpStud;
public Controller(BDatabase db) {
public Controller(BDatabase db, MainMenu frame) {
this.db = db;
this.e = this.db.getEtuList();
this.g = this.db.getGroupeList();
parent = frame;
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);
// 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);
}
/**
@@ -56,6 +58,7 @@ public class Controller implements ActionListener, ListSelectionListener {
};
}
/**
* Pour afficher une JTable sans listener
*
@@ -75,9 +78,12 @@ public class Controller implements ActionListener, ListSelectionListener {
this.currentJTableUse = liste;
forModal.add(liste);
this.parent.updateTable(liste);
BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal);
//forModal.add(liste);
//BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal);
}
/**
@@ -100,9 +106,10 @@ public class Controller implements ActionListener, ListSelectionListener {
this.currentJTableUse = liste;
forModal.add(liste);
this.parent.updateTable(liste);
BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal);
//forModal.add(liste);
//BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal);
}
/**
@@ -280,7 +287,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",
@@ -430,16 +437,41 @@ public class Controller implements ActionListener, ListSelectionListener {
}
}
public ProfView getProfView() {
return this.pv;
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 StudentView getStudentView() {
return this.sv;
public void setAv (AdminView av) {
if (this.av == null) {
this.av = av;
}
}
public AdminView getAdminView() {
return this.av;
public void setPv (ProfView pv) {
if (this.pv == null) {
this.pv = pv;
}
}