$
This commit is contained in:
parent
3df45f3f87
commit
8c76e54ea9
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -116,7 +116,6 @@ public class BFrame extends JFrame {
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
frame.getContentPane().add(scrollPane);
|
||||
scrollPane.setViewportView(content);
|
||||
|
||||
frame.setResizable(false);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
@ -174,6 +173,13 @@ public class BFrame extends JFrame {
|
||||
this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fermer une fenetre modal
|
||||
* */
|
||||
public void closeMBframe() {
|
||||
this.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rafraichir la fenetre
|
||||
*/
|
||||
|
@ -17,11 +17,20 @@ import java.util.Objects;
|
||||
|
||||
public class Controller implements ActionListener, ListSelectionListener {
|
||||
private final BDatabase db;
|
||||
|
||||
private final ProfView pv;
|
||||
private final AdminView av;
|
||||
|
||||
private BFrame lastModal;
|
||||
private BFrame currentModal;
|
||||
|
||||
private final ArrayList<Etudiant> e;
|
||||
private final ArrayList<Groupe> g;
|
||||
|
||||
private JTable currentJTableUse;
|
||||
private JComboBox<String> list;
|
||||
|
||||
private String[] tmpStud;
|
||||
|
||||
public Controller(ArrayList<Etudiant> e, ArrayList<Groupe> g) {
|
||||
this.e = e;
|
||||
@ -108,8 +117,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, Object... data) {
|
||||
BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, parent, forModal);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -273,6 +282,18 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
this.createJTable(data, titre)
|
||||
);
|
||||
}
|
||||
|
||||
else if(Objects.equals(command, "crtll::ActionMoveGrup")) {
|
||||
// TODO: CHANGE GROUPE
|
||||
db.updateRow("UPDATE fi_eleves SET ");
|
||||
|
||||
JOptionPane.showMessageDialog(
|
||||
this.currentModal,
|
||||
this.tmpStud[0] + " " + this.tmpStud[1] + " a bien ete deplace dans le " + this.list.getSelectedItem(),
|
||||
"Deplacement effectue",
|
||||
JOptionPane.INFORMATION_MESSAGE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -291,25 +312,63 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
if(Objects.equals(value, "[DEPLACER]")) {
|
||||
JPanel forModal = new JPanel(new GridBagLayout());
|
||||
BLayout settings = new BLayout();
|
||||
this.tmpStud = new String[] {
|
||||
(String) tm.getValueAt(cell[0], 0),
|
||||
(String) tm.getValueAt(cell[0], 1)
|
||||
};
|
||||
|
||||
JLabel l = new JLabel("test");
|
||||
forModal.add(l);
|
||||
settings.setPositionX(0);
|
||||
settings.setPositionY(0);
|
||||
JLabel intro = new JLabel(
|
||||
"Deplacer " + tm.getValueAt(cell[0], 0) + " " +
|
||||
tm.getValueAt(cell[0], 1) +
|
||||
" dans le groupe : "
|
||||
);
|
||||
forModal.add(intro, settings);
|
||||
|
||||
settings.setPositionX(1);
|
||||
settings.setPositionY(0);
|
||||
forModal.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionX(2);
|
||||
settings.setPositionY(0);
|
||||
forModal.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionX(3);
|
||||
settings.setPositionY(0);
|
||||
|
||||
this.list = new JComboBox<>();
|
||||
|
||||
for (Groupe groupe : this.g) {
|
||||
this.list.addItem(groupe.getName());
|
||||
}
|
||||
|
||||
forModal.add(list, settings);
|
||||
|
||||
settings.setPositionX(4);
|
||||
settings.setPositionY(0);
|
||||
forModal.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionX(5);
|
||||
settings.setPositionY(0);
|
||||
forModal.add(new JLabel(" "), settings);
|
||||
|
||||
settings.setPositionX(6);
|
||||
settings.setPositionY(0);
|
||||
JButton moveBtn = new JButton("Deplacer");
|
||||
moveBtn.setActionCommand("crtll::ActionMoveGrup");
|
||||
moveBtn.addActionListener(this);
|
||||
forModal.add(moveBtn, settings);
|
||||
|
||||
DisplayModal(
|
||||
this.av,
|
||||
"Deplacer l'eleve : " + tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1),
|
||||
"Deplacer l'eleve : "
|
||||
+ tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1),
|
||||
500,
|
||||
250,
|
||||
this.av.getX(),
|
||||
this.av.getY(),
|
||||
forModal,
|
||||
|
||||
/**
|
||||
* Position toujours similaire { cell[0] = Nom (String), cell[1] = Prenom (String), cell[2] = Groupe (String) }
|
||||
*/
|
||||
tm.getValueAt(cell[0], 0),
|
||||
tm.getValueAt(cell[0], 1),
|
||||
tm.getValueAt(cell[0], 2)
|
||||
forModal
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user