Transférer les fichiers vers 'src/Test'

This commit is contained in:
Romain BESSON 2022-12-01 12:16:30 +01:00
parent e22ee64513
commit c40366e4e2
2 changed files with 27 additions and 19 deletions

View File

@ -22,6 +22,8 @@ public class Controller implements ActionListener, ListSelectionListener {
private AdminView av = null; private AdminView av = null;
private BFrame currentModal; private BFrame currentModal;
private MainMenu parent;
private ArrayList<Etudiant> e; private ArrayList<Etudiant> e;
private ArrayList<Groupe> g; private ArrayList<Groupe> g;
@ -30,10 +32,11 @@ public class Controller implements ActionListener, ListSelectionListener {
private ArrayList<String> tmpStud; private ArrayList<String> tmpStud;
public Controller(BDatabase db) { public Controller(BDatabase db, MainMenu frame) {
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) // Les 3 fenetres s'ouvriront en meme temps (Pour le contexte du projet)
//this.pv = new ProfView(this.e, this.g, this); //this.pv = new ProfView(this.e, this.g, this);
@ -67,7 +70,7 @@ public class Controller implements ActionListener, ListSelectionListener {
* @param loca_y Localisation en y * @param loca_y Localisation en y
* @param liste La JTable * @param liste La JTable
* */ * */
private void Display(BFrame parent, String frameTitle, int size_x, int size_y, int loca_x, int loca_y, JTable liste) { private void Display(String frameTitle, int size_x, int size_y, int loca_x, int loca_y, JTable liste) {
JPanel forModal = new JPanel(); JPanel forModal = new JPanel();
ListSelectionModel lsm = liste.getSelectionModel(); ListSelectionModel lsm = liste.getSelectionModel();
@ -92,7 +95,7 @@ public class Controller implements ActionListener, ListSelectionListener {
* @param loca_y Localisation en y * @param loca_y Localisation en y
* @param liste La JTable * @param liste La JTable
* */ * */
private void DisplayWithListner(BFrame parent, String frameTitle, int size_x, int size_y, int loca_x, int loca_y, JTable liste) { private void DisplayWithListner(String frameTitle, int size_x, int size_y, int loca_x, int loca_y, JTable liste) {
JPanel forModal = new JPanel(); JPanel forModal = new JPanel();
ListSelectionModel lsm = liste.getSelectionModel(); ListSelectionModel lsm = liste.getSelectionModel();
@ -104,7 +107,7 @@ 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, parent, forModal); BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal);
} }
/** /**
@ -118,8 +121,8 @@ public class Controller implements ActionListener, ListSelectionListener {
* @param loca_y Localisation en y * @param loca_y Localisation en y
* @param forModal Le panel a mettre dans la fenetre (libre) * @param forModal Le panel a mettre dans la fenetre (libre)
* */ * */
private void DisplayModal(BFrame parent, String frameTitle, int size_x, int size_y, int loca_x, int loca_y, JPanel forModal) { private void DisplayModal(String frameTitle, int size_x, int size_y, int loca_x, int loca_y, JPanel forModal) {
this.currentModal = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, parent, forModal); this.currentModal = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal);
} }
@Override @Override
@ -152,7 +155,6 @@ public class Controller implements ActionListener, ListSelectionListener {
} }
Display( Display(
this.pv,
"Liste des etudiants", "Liste des etudiants",
350, 350,
400, 400,
@ -190,7 +192,6 @@ public class Controller implements ActionListener, ListSelectionListener {
} }
Display( Display(
this.pv,
"Liste d'eleve du " + groupeOption, "Liste d'eleve du " + groupeOption,
350, 350,
400, 400,
@ -242,7 +243,6 @@ public class Controller implements ActionListener, ListSelectionListener {
} }
Display( Display(
this.pv,
"Recherche", "Recherche",
350, 350,
400, 400,
@ -276,7 +276,6 @@ public class Controller implements ActionListener, ListSelectionListener {
} }
DisplayWithListner( DisplayWithListner(
this.av,
"Deplacer un etudiant", "Deplacer un etudiant",
350, 350,
400, 400,
@ -313,7 +312,6 @@ public class Controller implements ActionListener, ListSelectionListener {
String[][] stringArray = data.stream().map(u -> u.toArray(new String[0])).toArray(String[][]::new); String[][] stringArray = data.stream().map(u -> u.toArray(new String[0])).toArray(String[][]::new);
DisplayWithListner( DisplayWithListner(
this.av,
"Attribuer un groupe a un etudiant", "Attribuer un groupe a un etudiant",
350, 350,
400, 400,
@ -420,7 +418,6 @@ public class Controller implements ActionListener, ListSelectionListener {
forModal.add(moveBtn, settings); forModal.add(moveBtn, settings);
DisplayModal( DisplayModal(
this.av,
"Deplacer l'eleve : " "Deplacer l'eleve : "
+ tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1), + tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1),
500, 500,

View File

@ -30,14 +30,20 @@ public class MainMenu extends JFrame {
private void init() { private void init() {
BDatabase db = new BDatabase(); BDatabase db = new BDatabase();
Controller listener = new Controller(db); Controller listener = new Controller(db, this);
av = new AdminView(listener.getEtudiants(), listener.getGroupes(), listener); av = new AdminView(listener.getEtudiants(), listener.getGroupes(), listener);
pv = new ProfView(listener.getEtudiants(), listener.getGroupes(), listener); pv = new ProfView(listener.getEtudiants(), listener.getGroupes(), listener);
listener.setAv(av);
listener.setPv(pv);
this.setLayout(cards); this.setLayout(cards);
this.add(first()); this.add(first());
this.add(adminView()); this.add(adminView());
this.add(profView()); this.add(profView());
cards.first(this.getContentPane()); cards.first(this.getContentPane());
} }
@ -69,12 +75,16 @@ public class MainMenu extends JFrame {
private JPanel adminView() { private JPanel adminView() {
JPanel mainPanel = new JPanel JPanel mainPanel = new JPanel();
mainPanel.add(av);
return mainPanel;
} }
private JPanel profView() { private JPanel profView() {
JPanel mainPanel = new JPanel();
mainPanel.add(pv);
return mainPanel;
} }
@ -82,12 +92,13 @@ public class MainMenu extends JFrame {
JButton origin = (JButton) e.getSource(); JButton origin = (JButton) e.getSource();
System.out.println(origin.getText()); System.out.println(origin.getText());
if (origin.getText() == "Admin") { if (origin.getText() == "Admin") {
listener.createAdminView(); cards.next(this.getContentPane());
} else if (origin.getText() == "Prof") { } else if (origin.getText() == "Prof") {
listener.createProfView(); cards.next(this.getContentPane());
cards.next(this.getContentPane());
} else { } else {
JOptionPane.showMessageDialog(null, "En travaux"); JOptionPane.showMessageDialog(null, "En travaux");
} }