$
This commit is contained in:
parent
dd088c00a2
commit
ef454e5a18
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -10,6 +10,7 @@ import java.awt.*;
|
|||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
import javax.swing.table.TableModel;
|
import javax.swing.table.TableModel;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -147,7 +148,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
String command = e.getActionCommand();
|
String command = e.getActionCommand();
|
||||||
this.e = this.db.getEtuList();
|
|
||||||
String groupeOption = this.pv.getComboSelection();
|
String groupeOption = this.pv.getComboSelection();
|
||||||
int groupeIndex = 0;
|
int groupeIndex = 0;
|
||||||
String text = this.pv.getSearchStud();
|
String text = this.pv.getSearchStud();
|
||||||
@ -432,6 +432,8 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
type = 2;
|
type = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.db.updateRow("ALTER TABLE fi_demandes AUTO_INCREMENT = " + this.r.size());
|
||||||
|
|
||||||
if (this.db.insertRow("fi_demandes", new String[] {
|
if (this.db.insertRow("fi_demandes", new String[] {
|
||||||
"id_eleve", "id_groupe", "message", "type" },
|
"id_eleve", "id_groupe", "message", "type" },
|
||||||
new String[] {
|
new String[] {
|
||||||
@ -632,7 +634,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i <= this.r.size() - 1; i++) {
|
for (int i = 0; i <= this.r.size() - 1; i++) {
|
||||||
System.out.println(this.getGroupeById(this.r.get(i).getWitchGroupe()));
|
|
||||||
Object[] info = {
|
Object[] info = {
|
||||||
this.getEtuNameById(this.r.get(i).getEtuId()),
|
this.getEtuNameById(this.r.get(i).getEtuId()),
|
||||||
this.getGroupeById(this.r.get(i).getWitchGroupe()),
|
this.getGroupeById(this.r.get(i).getWitchGroupe()),
|
||||||
@ -837,6 +838,9 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JTable initTable() {
|
public JTable initTable() {
|
||||||
|
this.e = this.db.getEtuList();
|
||||||
|
this.g = this.db.getGroupeList();
|
||||||
|
|
||||||
Object[][] data = new Object[this.e.size()][3];
|
Object[][] data = new Object[this.e.size()][3];
|
||||||
String[] title = {
|
String[] title = {
|
||||||
"Nom",
|
"Nom",
|
||||||
@ -893,6 +897,22 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
return this.g;
|
return this.g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BDatabase getDatabase() {
|
||||||
|
return this.db;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEtudiants(ArrayList<Etudiant> e) {
|
||||||
|
this.e = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupes(ArrayList<Groupe> g) {
|
||||||
|
this.g = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequest(ArrayList<Requete> r) {
|
||||||
|
this.r = r;
|
||||||
|
}
|
||||||
|
|
||||||
public void setMainMenu(MainMenu m) {
|
public void setMainMenu(MainMenu m) {
|
||||||
this.parent = m;
|
this.parent = m;
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,11 @@ public class MainMenu extends JFrame {
|
|||||||
public static final int MENU = 0, ADMIN = 1, PROF = 2, STUDENT = 3;
|
public static final int MENU = 0, ADMIN = 1, PROF = 2, STUDENT = 3;
|
||||||
private static final int FULL = 4, WINDOW = 5;
|
private static final int FULL = 4, WINDOW = 5;
|
||||||
private final static Dimension MINIMUM_SIZE = new Dimension(960, 600);
|
private final static Dimension MINIMUM_SIZE = new Dimension(960, 600);
|
||||||
private final CardLayout cards = new CardLayout(), adminCards = new CardLayout(), profCards = new CardLayout(), studentCards = new CardLayout();
|
private final CardLayout cards = new CardLayout(), adminCards = new CardLayout(), profCards = new CardLayout(),
|
||||||
|
studentCards = new CardLayout();
|
||||||
private final JPanel adminPanel = new JPanel(), profPanel = new JPanel(), studentPanel = new JPanel();
|
private final JPanel adminPanel = new JPanel(), profPanel = new JPanel(), studentPanel = new JPanel();
|
||||||
private final Color adminColor = new Color(255, 2, 2);
|
private final Color adminColor = new Color(255, 2, 2);
|
||||||
private final Color profColor = new Color(182, 2, 189);
|
private final Color profColor = new Color(182, 2, 189);
|
||||||
private final Color studentColor = new Color(53, 242, 242);
|
private final Color studentColor = new Color(53, 242, 242);
|
||||||
private int screenStatus = WINDOW;
|
private int screenStatus = WINDOW;
|
||||||
private int currentView = MENU;
|
private int currentView = MENU;
|
||||||
@ -26,7 +27,7 @@ public class MainMenu extends JFrame {
|
|||||||
private JTable table;
|
private JTable table;
|
||||||
private int cardIndex = 0;
|
private int cardIndex = 0;
|
||||||
private boolean uniqueView = false;
|
private boolean uniqueView = false;
|
||||||
private String[] viewName = {"Administrateur", "Professeur", "Etudiant"};
|
private String[] viewName = { "Administrateur", "Professeur", "Etudiant" };
|
||||||
private final CustomJButton[] buttonTab = {
|
private final CustomJButton[] buttonTab = {
|
||||||
new CustomJButton(viewName[0]),
|
new CustomJButton(viewName[0]),
|
||||||
new CustomJButton(viewName[1]),
|
new CustomJButton(viewName[1]),
|
||||||
@ -35,6 +36,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur de base
|
* Constructeur de base
|
||||||
|
*
|
||||||
* @param listener controller initialisé dans le main
|
* @param listener controller initialisé dans le main
|
||||||
*/
|
*/
|
||||||
public MainMenu(Controller listener) {
|
public MainMenu(Controller listener) {
|
||||||
@ -60,10 +62,12 @@ public class MainMenu extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construit un objet MainMenu sur la vue sélectionnée et le mode d'affichage choisi
|
* Construit un objet MainMenu sur la vue sélectionnée et le mode d'affichage
|
||||||
* @param listener controller initialisé dans le main
|
* choisi
|
||||||
|
*
|
||||||
|
* @param listener controller initialisé dans le main
|
||||||
* @param selectedView vue à afficher
|
* @param selectedView vue à afficher
|
||||||
* @param screenStyle disposition d'affichage plein écran ou fenêtré
|
* @param screenStyle disposition d'affichage plein écran ou fenêtré
|
||||||
*/
|
*/
|
||||||
public MainMenu(Controller listener, int selectedView, int screenStyle) {
|
public MainMenu(Controller listener, int selectedView, int screenStyle) {
|
||||||
super();
|
super();
|
||||||
@ -82,6 +86,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise les paramètres de la fenêtre
|
* Initialise les paramètres de la fenêtre
|
||||||
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
private void init(Controller listener) {
|
private void init(Controller listener) {
|
||||||
@ -106,6 +111,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Action réalisée par les boutons du menu principal
|
* Action réalisée par les boutons du menu principal
|
||||||
|
*
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
private void action(ActionEvent e) {
|
private void action(ActionEvent e) {
|
||||||
@ -127,16 +133,16 @@ public class MainMenu extends JFrame {
|
|||||||
JMenu menu = new JMenu("Menu"), view = new JMenu("Affichage");
|
JMenu menu = new JMenu("Menu"), view = new JMenu("Affichage");
|
||||||
|
|
||||||
if (!uniqueView) {
|
if (!uniqueView) {
|
||||||
JMenuItem adminMenuItem = new JMenuItem("Vue "+viewName[0]);
|
JMenuItem adminMenuItem = new JMenuItem("Vue " + viewName[0]);
|
||||||
adminMenuItem.addActionListener((event) -> changeView(1));
|
adminMenuItem.addActionListener((event) -> changeView(1));
|
||||||
|
|
||||||
JMenuItem profMenuItem = new JMenuItem("Vue "+viewName[1]);
|
JMenuItem profMenuItem = new JMenuItem("Vue " + viewName[1]);
|
||||||
profMenuItem.addActionListener((event) -> changeView(2));
|
profMenuItem.addActionListener((event) -> changeView(2));
|
||||||
|
|
||||||
JMenuItem studentMenuItem = new JMenuItem("Vue "+viewName[2]);
|
JMenuItem studentMenuItem = new JMenuItem("Vue " + viewName[2]);
|
||||||
studentMenuItem.addActionListener((event) -> changeView(3));
|
studentMenuItem.addActionListener((event) -> changeView(3));
|
||||||
|
|
||||||
JMenuItem mainMenuItem = new JMenuItem("Retourner au menu principal");
|
JMenuItem mainMenuItem = new JMenuItem("Retourner au menu principal");
|
||||||
mainMenuItem.addActionListener(this::backtoMainMenu);
|
mainMenuItem.addActionListener(this::backtoMainMenu);
|
||||||
|
|
||||||
menu.add(adminMenuItem);
|
menu.add(adminMenuItem);
|
||||||
@ -145,13 +151,13 @@ public class MainMenu extends JFrame {
|
|||||||
menu.add(mainMenuItem);
|
menu.add(mainMenuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
JMenuItem fullScreenMenuItem = new JMenuItem("Plein écran");
|
JMenuItem fullScreenMenuItem = new JMenuItem("Plein écran");
|
||||||
fullScreenMenuItem.addActionListener(this::setFullScreen);
|
fullScreenMenuItem.addActionListener(this::setFullScreen);
|
||||||
|
|
||||||
JMenuItem notFullScreenMenuItem = new JMenuItem("Fenêtré");
|
JMenuItem notFullScreenMenuItem = new JMenuItem("Fenêtré");
|
||||||
notFullScreenMenuItem.addActionListener(this::unsetFullScreen);
|
notFullScreenMenuItem.addActionListener(this::unsetFullScreen);
|
||||||
|
|
||||||
JMenuItem quitMenuItem = new JMenuItem("Quitter");
|
JMenuItem quitMenuItem = new JMenuItem("Quitter");
|
||||||
quitMenuItem.addActionListener((event) -> System.exit(0));
|
quitMenuItem.addActionListener((event) -> System.exit(0));
|
||||||
|
|
||||||
menu.add(quitMenuItem);
|
menu.add(quitMenuItem);
|
||||||
@ -165,9 +171,9 @@ public class MainMenu extends JFrame {
|
|||||||
this.setJMenuBar(menuBar);
|
this.setJMenuBar(menuBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Crée une vue avec le résultat de la base de données à côté
|
* Crée une vue avec le résultat de la base de données à côté
|
||||||
|
*
|
||||||
* @param sidePanel actions relatives à l'utilisateur
|
* @param sidePanel actions relatives à l'utilisateur
|
||||||
* @param origin
|
* @param origin
|
||||||
* @return panel contenant les boutons et la table
|
* @return panel contenant les boutons et la table
|
||||||
@ -178,17 +184,14 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
panel.setLayout(new GridLayout(1, 2));
|
panel.setLayout(new GridLayout(1, 2));
|
||||||
|
|
||||||
if (origin.equals(viewName[0])){
|
if (origin.equals(viewName[0])) {
|
||||||
sidePanel.setBackground(adminColor);
|
sidePanel.setBackground(adminColor);
|
||||||
System.out.println("admin");
|
|
||||||
|
|
||||||
} else if (origin.equals(viewName[1])) {
|
} else if (origin.equals(viewName[1])) {
|
||||||
sidePanel.setBackground(profColor);
|
sidePanel.setBackground(profColor);
|
||||||
System.out.println("prof");
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sidePanel.setBackground(studentColor);
|
sidePanel.setBackground(studentColor);
|
||||||
System.out.println("student");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
panel.add(sidePanel);
|
panel.add(sidePanel);
|
||||||
@ -201,6 +204,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Permet de naviguer entre les vues
|
* Permet de naviguer entre les vues
|
||||||
|
*
|
||||||
* @param index index de la vue
|
* @param index index de la vue
|
||||||
*/
|
*/
|
||||||
private void changeView(int index) {
|
private void changeView(int index) {
|
||||||
@ -224,7 +228,7 @@ public class MainMenu extends JFrame {
|
|||||||
this.profCards.next(this.profPanel);
|
this.profCards.next(this.profPanel);
|
||||||
this.menuBar.setBackground(this.profColor);
|
this.menuBar.setBackground(this.profColor);
|
||||||
|
|
||||||
} else if (index == 3){
|
} else if (index == 3) {
|
||||||
this.cardIndex = index;
|
this.cardIndex = index;
|
||||||
this.currentView = STUDENT;
|
this.currentView = STUDENT;
|
||||||
this.setTitle(this.viewName[2]);
|
this.setTitle(this.viewName[2]);
|
||||||
@ -239,6 +243,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Met à jour la table de cet objet
|
* Met à jour la table de cet objet
|
||||||
|
*
|
||||||
* @param table nouvelle table
|
* @param table nouvelle table
|
||||||
*/
|
*/
|
||||||
public void updateTable(JTable table) {
|
public void updateTable(JTable table) {
|
||||||
@ -259,6 +264,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Crée le menu principal
|
* Crée le menu principal
|
||||||
|
*
|
||||||
* @return panel contenant le menu principal
|
* @return panel contenant le menu principal
|
||||||
*/
|
*/
|
||||||
private JPanel firstCard() {
|
private JPanel firstCard() {
|
||||||
@ -272,7 +278,7 @@ public class MainMenu extends JFrame {
|
|||||||
GridBagConstraints gbc = new GridBagConstraints();
|
GridBagConstraints gbc = new GridBagConstraints();
|
||||||
gbc.insets = insets;
|
gbc.insets = insets;
|
||||||
gbc.gridwidth = 1;
|
gbc.gridwidth = 1;
|
||||||
gbc.gridx = 0;
|
gbc.gridx = 0;
|
||||||
|
|
||||||
for (int i = 0; i < buttonTab.length; i++) {
|
for (int i = 0; i < buttonTab.length; i++) {
|
||||||
gbc.gridy = i;
|
gbc.gridy = i;
|
||||||
@ -288,6 +294,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise la vue sélectionnée
|
* Initialise la vue sélectionnée
|
||||||
|
*
|
||||||
* @param index index de la vue choisie
|
* @param index index de la vue choisie
|
||||||
*/
|
*/
|
||||||
private void initView(int index) {
|
private void initView(int index) {
|
||||||
@ -331,6 +338,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Crée la vue administrateur
|
* Crée la vue administrateur
|
||||||
|
*
|
||||||
* @return panel contenant la vue admin
|
* @return panel contenant la vue admin
|
||||||
*/
|
*/
|
||||||
private JPanel adminView() {
|
private JPanel adminView() {
|
||||||
@ -342,6 +350,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Crée la vue professeur
|
* Crée la vue professeur
|
||||||
|
*
|
||||||
* @return panel contenant la vue professeur
|
* @return panel contenant la vue professeur
|
||||||
*/
|
*/
|
||||||
private JPanel profView() {
|
private JPanel profView() {
|
||||||
@ -353,6 +362,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Crée la vue étudiant
|
* Crée la vue étudiant
|
||||||
|
*
|
||||||
* @return panel contenant la vue étudiant
|
* @return panel contenant la vue étudiant
|
||||||
*/
|
*/
|
||||||
private JPanel studentView() {
|
private JPanel studentView() {
|
||||||
@ -361,7 +371,7 @@ public class MainMenu extends JFrame {
|
|||||||
mainPanel.add(this.sv, BorderLayout.CENTER);
|
mainPanel.add(this.sv, BorderLayout.CENTER);
|
||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void travelThroughCards(int index) {
|
private void travelThroughCards(int index) {
|
||||||
cards.first(this.getContentPane());
|
cards.first(this.getContentPane());
|
||||||
|
|
||||||
@ -372,6 +382,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Change le mode d'affichage
|
* Change le mode d'affichage
|
||||||
|
*
|
||||||
* @param screenStyle
|
* @param screenStyle
|
||||||
*/
|
*/
|
||||||
private void setScreenStyle(int screenStyle) {
|
private void setScreenStyle(int screenStyle) {
|
||||||
@ -387,6 +398,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Passe la fenêtre en plein écran
|
* Passe la fenêtre en plein écran
|
||||||
|
*
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
private void setFullScreen(ActionEvent e) {
|
private void setFullScreen(ActionEvent e) {
|
||||||
@ -398,6 +410,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Passe la fenêtre en fenêtré
|
* Passe la fenêtre en fenêtré
|
||||||
|
*
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
private void unsetFullScreen(ActionEvent e) {
|
private void unsetFullScreen(ActionEvent e) {
|
||||||
@ -409,6 +422,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoie au menu principal
|
* Renvoie au menu principal
|
||||||
|
*
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
private void backtoMainMenu(ActionEvent e) {
|
private void backtoMainMenu(ActionEvent e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user