Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b4cd384ece |
@@ -1,6 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="JAVA_MODULE" version="4">
|
<module type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
<component name="NewModuleRootManager">
|
||||||
|
<output url="file://$MODULE_DIR$/out/production/FIProjetIHM2022" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/out/test/FIProjetIHM2022" />
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
@@ -8,7 +10,7 @@
|
|||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="mariadb-connector" level="project" />
|
<orderEntry type="library" name="mariadb-connector" level="project" />
|
||||||
<orderEntry type="library" name="mariadb-connector2" level="project" />
|
<orderEntry type="library" name="FI_PRJ" level="project" />
|
||||||
<orderEntry type="library" name="mariadb-connector1" level="project" />
|
<orderEntry type="library" name="mariadb-connector1" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,8 +2,6 @@ package Test;
|
|||||||
|
|
||||||
import API.Etudiant;
|
import API.Etudiant;
|
||||||
import API.Groupe;
|
import API.Groupe;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@@ -17,8 +15,6 @@ public class AdminView extends JPanel {
|
|||||||
public AdminView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
public AdminView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.setLayout(new GridBagLayout());
|
|
||||||
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.g = g;
|
this.g = g;
|
||||||
this.e = e;
|
this.e = e;
|
||||||
|
@@ -219,19 +219,6 @@ public class BDatabase {
|
|||||||
return listGroupe;
|
return listGroupe;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Recuperer le nombre de membre d'un groupe
|
|
||||||
*
|
|
||||||
* @param groupe_id le groupes
|
|
||||||
* @return le nombre de membre
|
|
||||||
* */
|
|
||||||
public int getMemberCount(int groupe_id) {
|
|
||||||
ArrayList<String> forCount = this.fetchAll(
|
|
||||||
"SELECT nom FROM fi_eleves WHERE groupe=" + groupe_id);
|
|
||||||
|
|
||||||
return forCount.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recuperer l'hote courant.
|
* Recuperer l'hote courant.
|
||||||
@@ -264,4 +251,15 @@ public class BDatabase {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return this.db_host + "\n" + this.db_name + "\n" + this.db_user + "\n";
|
return this.db_host + "\n" + this.db_name + "\n" + this.db_user + "\n";
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Recuperer le nombre de membre d'un groupe
|
||||||
|
*
|
||||||
|
* @param groupe_id le groupes
|
||||||
|
* @return le nombre de membre
|
||||||
|
* */
|
||||||
|
public int getMemberCount(int groupe_id) {
|
||||||
|
ArrayList<String> forCount = this.fetchAll(
|
||||||
|
"SELECT nom FROM fi_eleves WHERE groupe=" + groupe_id);
|
||||||
|
return forCount.size();
|
||||||
|
}
|
||||||
}
|
}
|
@@ -108,7 +108,7 @@ public class BFrame extends JFrame {
|
|||||||
* @param daron La fenetre qui va etre bloquer
|
* @param daron La fenetre qui va etre bloquer
|
||||||
* @param content Contenu de la fenetre
|
* @param content Contenu de la fenetre
|
||||||
* */
|
* */
|
||||||
public BFrame(String title, int loca_x, int loca_y, int size_x, int size_y, JFrame daron, JPanel content) {
|
public BFrame(String title, int loca_x, int loca_y, int size_x, int size_y, BFrame daron, JPanel content) {
|
||||||
JDialog frame = new JDialog(daron, title, true);
|
JDialog frame = new JDialog(daron, title, true);
|
||||||
frame.setLocation(loca_x, loca_y);
|
frame.setLocation(loca_x, loca_y);
|
||||||
frame.setSize(size_x, size_y);
|
frame.setSize(size_x, size_y);
|
||||||
|
@@ -18,11 +18,11 @@ import java.util.Objects;
|
|||||||
public class Controller implements ActionListener, ListSelectionListener {
|
public class Controller implements ActionListener, ListSelectionListener {
|
||||||
private final BDatabase db;
|
private final BDatabase db;
|
||||||
|
|
||||||
private ProfView pv;
|
private ProfView pv = null;
|
||||||
private AdminView av;
|
private AdminView av = null;
|
||||||
private StudentView sv;
|
|
||||||
private BFrame currentModal;
|
private BFrame currentModal;
|
||||||
private JFrame parent;
|
|
||||||
|
private MainMenu parent;
|
||||||
|
|
||||||
private ArrayList<Etudiant> e;
|
private ArrayList<Etudiant> e;
|
||||||
private ArrayList<Groupe> g;
|
private ArrayList<Groupe> g;
|
||||||
@@ -32,15 +32,17 @@ 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;
|
||||||
|
|
||||||
this.sv = new StudentView(this.e, this.g, this);
|
// 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);
|
||||||
this.av = new AdminView(this.e, this.g, this);
|
//System.out.println("[+] Demarrage de la vue professeur -> " + this.pv);
|
||||||
this.parent = new MainMenu(this);
|
//this.av = new AdminView(this.e, this.g, this);
|
||||||
|
//System.out.println("[+] Demarrage de la vue Administrateur -> " + this.av);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,9 +58,11 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pour afficher une JTable sans listener
|
* Pour afficher une JTable sans listener
|
||||||
*
|
*
|
||||||
|
* @param parent La fenetre qui sera bloque
|
||||||
* @param frameTitle Le titre de la fenetre
|
* @param frameTitle Le titre de la fenetre
|
||||||
* @param size_x Taille en x
|
* @param size_x Taille en x
|
||||||
* @param size_y Taille en y
|
* @param size_y Taille en y
|
||||||
@@ -77,12 +81,13 @@ 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, this.parent, forModal);
|
BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, parent, forModal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pour afficher une JTable contenant un listener
|
* Pour afficher une JTable contenant un listener
|
||||||
*
|
*
|
||||||
|
* @param parent La fenetre qui sera bloque
|
||||||
* @param frameTitle Le titre de la fenetre
|
* @param frameTitle Le titre de la fenetre
|
||||||
* @param size_x Taille en x
|
* @param size_x Taille en x
|
||||||
* @param size_y Taille en y
|
* @param size_y Taille en y
|
||||||
@@ -108,6 +113,7 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
/**
|
/**
|
||||||
* Pour afficher une modale classique pour plus de liberte (panel a creer au prealable)
|
* Pour afficher une modale classique pour plus de liberte (panel a creer au prealable)
|
||||||
*
|
*
|
||||||
|
* @param parent La fenetre qui sera bloque
|
||||||
* @param frameTitle Le titre de la fenetre
|
* @param frameTitle Le titre de la fenetre
|
||||||
* @param size_x Taille en x
|
* @param size_x Taille en x
|
||||||
* @param size_y Taille en y
|
* @param size_y Taille en y
|
||||||
@@ -280,7 +286,7 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if(Objects.equals(command, "av::AddStudGrup")) {
|
else if(Objects.equals(command, "av::AddStudGrup")) {
|
||||||
ArrayList<ArrayList<String>> data = new ArrayList<>();
|
ArrayList<ArrayList<String>> data = new ArrayList();
|
||||||
|
|
||||||
String[] titre = {
|
String[] titre = {
|
||||||
"Nom",
|
"Nom",
|
||||||
@@ -430,16 +436,18 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfView getProfView() {
|
|
||||||
return this.pv;
|
public void setAv (AdminView av) {
|
||||||
|
if (this.av == null) {
|
||||||
|
this.av = av;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public StudentView getStudentView() {
|
|
||||||
return this.sv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AdminView getAdminView() {
|
public void setPv (ProfView pv) {
|
||||||
return this.av;
|
if (this.pv == null) {
|
||||||
|
this.pv = pv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -6,58 +6,50 @@ import java.awt.event.ActionEvent;
|
|||||||
|
|
||||||
public class MainMenu extends JFrame {
|
public class MainMenu extends JFrame {
|
||||||
private final static Dimension MINIMUM_SIZE = new Dimension(960, 540);
|
private final static Dimension MINIMUM_SIZE = new Dimension(960, 540);
|
||||||
private CardLayout cards;
|
private CardLayout cards = new CardLayout();
|
||||||
|
|
||||||
private AdminView av;
|
private AdminView av;
|
||||||
private StudentView sv;
|
|
||||||
private ProfView pv;
|
private ProfView pv;
|
||||||
|
|
||||||
private BLayout settings;
|
|
||||||
|
|
||||||
private final Controller listener;
|
private JButton[] buttonTab = {
|
||||||
|
new JButton("Admin"),
|
||||||
|
new JButton("Prof"),
|
||||||
|
new JButton("Student")
|
||||||
|
};
|
||||||
|
|
||||||
private JButton[] buttonTab;
|
|
||||||
|
|
||||||
public MainMenu(Controller listener) {
|
public MainMenu() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.av = listener.getAdminView();
|
|
||||||
this.pv = listener.getProfView();
|
|
||||||
this.sv = listener.getStudentView();
|
|
||||||
|
|
||||||
this.cards = new CardLayout();
|
|
||||||
|
|
||||||
this.listener = listener;
|
|
||||||
|
|
||||||
this.buttonTab = new JButton[] {
|
|
||||||
new JButton("Admin"),
|
|
||||||
new JButton("Prof"),
|
|
||||||
new JButton("Student")
|
|
||||||
};
|
|
||||||
|
|
||||||
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
this.setExtendedState(MAXIMIZED_BOTH);
|
this.setExtendedState(MAXIMIZED_BOTH);
|
||||||
this.setMinimumSize(MINIMUM_SIZE);
|
this.setMinimumSize(MINIMUM_SIZE);
|
||||||
this.init();
|
init();
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
this.setLayout(this.cards);
|
BDatabase db = new BDatabase();
|
||||||
|
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(first());
|
||||||
this.add(adminView());
|
this.add(adminView());
|
||||||
this.add(profView());
|
this.add(profView());
|
||||||
this.add(studentView());
|
|
||||||
|
|
||||||
this.cards.first(this.getContentPane());
|
cards.first(this.getContentPane());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private JPanel first() {
|
private JPanel first() {
|
||||||
JPanel mainPanel = new JPanel();
|
JPanel mainPanel = new JPanel(), centerPanel = new JPanel();
|
||||||
JPanel centerPanel = new JPanel();
|
|
||||||
Dimension buttonDimension = new Dimension(300, 50);
|
Dimension buttonDimension = new Dimension(300, 50);
|
||||||
|
|
||||||
mainPanel.setLayout(new BorderLayout());
|
mainPanel.setLayout(new BorderLayout());
|
||||||
@@ -83,22 +75,18 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
|
|
||||||
private JPanel adminView() {
|
private JPanel adminView() {
|
||||||
JPanel mainPanel = new JPanel(new GridBagLayout());
|
JPanel mainPanel = new JPanel();
|
||||||
mainPanel.add(this.av, this.settings);
|
mainPanel.add(av);
|
||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private JPanel profView() {
|
private JPanel profView() {
|
||||||
JPanel mainPanel = new JPanel(new GridBagLayout());
|
JPanel mainPanel = new JPanel();
|
||||||
mainPanel.add(this.pv, this.settings);
|
mainPanel.add(pv);
|
||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel studentView() {
|
|
||||||
JPanel mainPanel = new JPanel(new GridBagLayout());
|
|
||||||
mainPanel.add(this.sv, this.settings);
|
|
||||||
return mainPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void action(ActionEvent e) {
|
private void action(ActionEvent e) {
|
||||||
JButton origin = (JButton) e.getSource();
|
JButton origin = (JButton) e.getSource();
|
||||||
@@ -110,13 +98,8 @@ public class MainMenu extends JFrame {
|
|||||||
} else if (origin.getText() == "Prof") {
|
} else if (origin.getText() == "Prof") {
|
||||||
cards.next(this.getContentPane());
|
cards.next(this.getContentPane());
|
||||||
cards.next(this.getContentPane());
|
cards.next(this.getContentPane());
|
||||||
} else if (origin.getText() == "Student") {
|
|
||||||
cards.next(this.getContentPane());
|
|
||||||
cards.next(this.getContentPane());
|
|
||||||
cards.next(this.getContentPane());
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(null, "En travaux");
|
JOptionPane.showMessageDialog(null, "En travaux");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,9 @@ import javax.swing.JButton;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -23,8 +25,6 @@ public class ProfView extends JPanel {
|
|||||||
public ProfView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
public ProfView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.setLayout(new GridBagLayout());
|
|
||||||
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.e = e;
|
this.e = e;
|
||||||
this.g = g;
|
this.g = g;
|
||||||
|
@@ -8,7 +8,9 @@ import javax.swing.JButton;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -23,8 +25,6 @@ public class StudentView extends JPanel {
|
|||||||
public StudentView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
public StudentView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.setLayout(new GridBagLayout());
|
|
||||||
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.e = e;
|
this.e = e;
|
||||||
this.g = g;
|
this.g = g;
|
||||||
@@ -110,15 +110,6 @@ public class StudentView extends JPanel {
|
|||||||
searchTLetters.addActionListener(this.listener);
|
searchTLetters.addActionListener(this.listener);
|
||||||
searchTLetters.setActionCommand("pv::SearchStudentPer3Letters");
|
searchTLetters.setActionCommand("pv::SearchStudentPer3Letters");
|
||||||
this.add(searchTLetters, settings);
|
this.add(searchTLetters, settings);
|
||||||
settings.setAnchor(GridBagConstraints.CENTER);
|
|
||||||
|
|
||||||
settings.setPositionY(7);
|
|
||||||
this.add(new JLabel(" "), settings);
|
|
||||||
|
|
||||||
settings.setPositionY(8);
|
|
||||||
JButton changGrp = new JButton("Changer de groupe");
|
|
||||||
changGrp.addActionListener(this.listener);
|
|
||||||
this.add(changGrp, settings);
|
|
||||||
|
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user