Transférer les fichiers vers 'src/Test'
This commit is contained in:
parent
e22ee64513
commit
c40366e4e2
@ -22,6 +22,8 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
private AdminView av = null;
|
||||
private BFrame currentModal;
|
||||
|
||||
private MainMenu parent;
|
||||
|
||||
private ArrayList<Etudiant> e;
|
||||
private ArrayList<Groupe> g;
|
||||
|
||||
@ -30,10 +32,11 @@ 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;
|
||||
|
||||
// Les 3 fenetres s'ouvriront en meme temps (Pour le contexte du projet)
|
||||
//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 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();
|
||||
|
||||
ListSelectionModel lsm = liste.getSelectionModel();
|
||||
@ -92,7 +95,7 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
* @param loca_y Localisation en y
|
||||
* @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();
|
||||
|
||||
ListSelectionModel lsm = liste.getSelectionModel();
|
||||
@ -104,7 +107,7 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
|
||||
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 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) {
|
||||
this.currentModal = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, parent, 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, this.parent, forModal);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -152,7 +155,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
}
|
||||
|
||||
Display(
|
||||
this.pv,
|
||||
"Liste des etudiants",
|
||||
350,
|
||||
400,
|
||||
@ -190,7 +192,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
}
|
||||
|
||||
Display(
|
||||
this.pv,
|
||||
"Liste d'eleve du " + groupeOption,
|
||||
350,
|
||||
400,
|
||||
@ -242,7 +243,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
}
|
||||
|
||||
Display(
|
||||
this.pv,
|
||||
"Recherche",
|
||||
350,
|
||||
400,
|
||||
@ -276,7 +276,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
}
|
||||
|
||||
DisplayWithListner(
|
||||
this.av,
|
||||
"Deplacer un etudiant",
|
||||
350,
|
||||
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);
|
||||
|
||||
DisplayWithListner(
|
||||
this.av,
|
||||
"Attribuer un groupe a un etudiant",
|
||||
350,
|
||||
400,
|
||||
@ -420,7 +418,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
forModal.add(moveBtn, settings);
|
||||
|
||||
DisplayModal(
|
||||
this.av,
|
||||
"Deplacer l'eleve : "
|
||||
+ tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1),
|
||||
500,
|
||||
|
@ -30,14 +30,20 @@ public class MainMenu extends JFrame {
|
||||
|
||||
private void init() {
|
||||
BDatabase db = new BDatabase();
|
||||
Controller listener = new Controller(db);
|
||||
Controller listener = new Controller(db, this);
|
||||
|
||||
av = new AdminView(listener.getEtudiants(), listener.getGroupes(), listener);
|
||||
pv = new ProfView(listener.getEtudiants(), listener.getGroupes(), listener);
|
||||
|
||||
listener.setAv(av);
|
||||
listener.setPv(pv);
|
||||
|
||||
this.setLayout(cards);
|
||||
|
||||
this.add(first());
|
||||
this.add(adminView());
|
||||
this.add(profView());
|
||||
|
||||
cards.first(this.getContentPane());
|
||||
}
|
||||
|
||||
@ -69,12 +75,16 @@ public class MainMenu extends JFrame {
|
||||
|
||||
|
||||
private JPanel adminView() {
|
||||
JPanel mainPanel = new JPanel
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.add(av);
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
System.out.println(origin.getText());
|
||||
|
||||
|
||||
|
||||
if (origin.getText() == "Admin") {
|
||||
listener.createAdminView();
|
||||
cards.next(this.getContentPane());
|
||||
|
||||
} else if (origin.getText() == "Prof") {
|
||||
listener.createProfView();
|
||||
cards.next(this.getContentPane());
|
||||
cards.next(this.getContentPane());
|
||||
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "En travaux");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user