From 20b60e2e766e8f04c58eb46d988adf219969848d Mon Sep 17 00:00:00 2001 From: besson Date: Thu, 1 Dec 2022 21:08:14 +0100 Subject: [PATCH] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'src/?= =?UTF-8?q?Test'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Test/Controller.java | 46 +++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/src/Test/Controller.java b/src/Test/Controller.java index ce9b072..bde9e15 100644 --- a/src/Test/Controller.java +++ b/src/Test/Controller.java @@ -18,10 +18,10 @@ 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 ArrayList e; @@ -32,17 +32,15 @@ public class Controller implements ActionListener, ListSelectionListener { private ArrayList 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,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 * @@ -82,10 +80,10 @@ public class Controller implements ActionListener, ListSelectionListener { //forModal.add(liste); - //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 * @@ -287,7 +285,7 @@ public class Controller implements ActionListener, ListSelectionListener { } else if(Objects.equals(command, "av::AddStudGrup")) { - ArrayList> data = new ArrayList(); + ArrayList> data = new ArrayList<>(); String[] titre = { "Nom", @@ -380,7 +378,7 @@ public class Controller implements ActionListener, ListSelectionListener { JLabel intro = new JLabel( "Deplacer " + tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1) + - " dans le groupe : " + " dans le groupe : " ); forModal.add(intro, settings); @@ -437,7 +435,6 @@ public class Controller implements ActionListener, ListSelectionListener { } } - public JTable initTable() { Object[][] data = new Object[this.e.size()][3]; String[] title = { @@ -445,7 +442,6 @@ public class Controller implements ActionListener, ListSelectionListener { "Prenom", "Groupe", }; - for(int i = 0; i <= this.e.size()-1; i++) { Object[] info = { this.e.get(i).getNom(), @@ -453,25 +449,21 @@ public class Controller implements ActionListener, ListSelectionListener { String.valueOf(this.e.get(i).getGroupe()), "[DEPLACER]" }; - data[i] = info; } - return createJTable(data, title); } - - public void setAv (AdminView av) { - if (this.av == null) { - this.av = av; - } + public ProfView getProfView() { + return this.pv; } + public StudentView getStudentView() { + return this.sv; + } - public void setPv (ProfView pv) { - if (this.pv == null) { - this.pv = pv; - } + public AdminView getAdminView() { + return this.av; }