This commit is contained in:
pro.boooooo 2022-11-29 02:20:04 +01:00
parent a96049791d
commit f956c07bef
4 changed files with 45 additions and 7 deletions

View File

@ -44,7 +44,7 @@ public class AdminView extends BFrame {
settings.setPositionY(2); settings.setPositionY(2);
JButton addStudGrup = new JButton("Ajouter un etudiant dans un groupe"); JButton addStudGrup = new JButton("Ajouter un etudiant dans un groupe");
addStudGrup.addActionListener(this.listener); addStudGrup.addActionListener(this.listener);
addStudGrup.setActionCommand("TODO"); addStudGrup.setActionCommand("av::AddStudGrup");
this.add(addStudGrup, settings); this.add(addStudGrup, settings);
this.setResizable(false); this.setResizable(false);

View File

@ -36,10 +36,10 @@ public class Controller implements ActionListener, ListSelectionListener {
this.g = this.db.getGroupeList(); this.g = this.db.getGroupeList();
// 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(e, g, this); this.pv = new ProfView(this.e, this.g, this);
System.out.println("[+] Demarrage de la vue professeur -> " + pv); System.out.println("[+] Demarrage de la vue professeur -> " + this.pv);
this.av = new AdminView(e, g, this); this.av = new AdminView(this.e, this.g, this);
System.out.println("[+] Demarrage de la vue Administrateur -> " + av); System.out.println("[+] Demarrage de la vue Administrateur -> " + this.av);
} }
/** /**
@ -285,7 +285,41 @@ public class Controller implements ActionListener, ListSelectionListener {
); );
} }
else if(Objects.equals(command, "crtll::ActionMoveGrup")) { else if(Objects.equals(command, "av::AddStudGrup")) {
Object[][] data = new Object[this.e.size()][3];
String[] titre = {
"Nom",
"Prenom",
"Groupe",
"Action"
};
for(int i = 0; i <= this.e.size()-1; i++) {
if(this.e.get(i).getGroupe() == -1) {
Object[] info = {
this.e.get(i).getNom(),
this.e.get(i).getPrenom(),
String.valueOf(this.e.get(i).getGroupe()),
"[AJOUTER]"
};
data[i] = info;
}
}
DisplayWithListner(
this.av,
"Attriuer un groupe a un etudiant",
350,
400,
this.av.getX(),
this.av.getY(),
this.createJTable(data, titre)
);
}
else if(Objects.equals(command, "crtll::ActionAddAndMoveGrup")) {
this.tmpStud.add(String.valueOf(this.list.getSelectedIndex())); this.tmpStud.add(String.valueOf(this.list.getSelectedIndex()));
String query = String query =
@ -377,7 +411,7 @@ public class Controller implements ActionListener, ListSelectionListener {
settings.setPositionX(6); settings.setPositionX(6);
settings.setPositionY(0); settings.setPositionY(0);
JButton moveBtn = new JButton("Deplacer"); JButton moveBtn = new JButton("Deplacer");
moveBtn.setActionCommand("crtll::ActionMoveGrup"); moveBtn.setActionCommand("crtll::ActionAddAndMoveGrup");
moveBtn.addActionListener(this); moveBtn.addActionListener(this);
forModal.add(moveBtn, settings); forModal.add(moveBtn, settings);
@ -392,6 +426,10 @@ public class Controller implements ActionListener, ListSelectionListener {
forModal forModal
); );
} }
if(Objects.equals(value, "[AJOUTER]")) {
System.out.println("Ajout");
}
} }
} }
} }