Transférer les fichiers vers 'src/Test'
This commit is contained in:
parent
1430f84f21
commit
e22ee64513
@ -5,21 +5,15 @@ import API.Groupe;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
public class AdminView extends BFrame {
|
public class AdminView extends JPanel {
|
||||||
private final ArrayList<Etudiant> e;
|
private final ArrayList<Etudiant> e;
|
||||||
private final ArrayList<Groupe> g;
|
private final ArrayList<Groupe> g;
|
||||||
private final Controller listener;
|
private final Controller listener;
|
||||||
|
|
||||||
public AdminView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
public AdminView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
||||||
super(
|
super();
|
||||||
"Vue Administrateur",
|
|
||||||
150,
|
|
||||||
300,
|
|
||||||
500,
|
|
||||||
500,
|
|
||||||
3
|
|
||||||
);
|
|
||||||
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.g = g;
|
this.g = g;
|
||||||
@ -47,8 +41,6 @@ public class AdminView extends BFrame {
|
|||||||
addStudGrup.setActionCommand("av::AddStudGrup");
|
addStudGrup.setActionCommand("av::AddStudGrup");
|
||||||
this.add(addStudGrup, settings);
|
this.add(addStudGrup, settings);
|
||||||
|
|
||||||
this.setResizable(false);
|
this.repaint();
|
||||||
this.openBFrame();
|
|
||||||
this.refreshBFrame();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class BDatabase {
|
|||||||
this.db_host = "jdbc:mariadb://dwarves.iut-fbleau.fr/";
|
this.db_host = "jdbc:mariadb://dwarves.iut-fbleau.fr/";
|
||||||
this.db_name = "brinet";
|
this.db_name = "brinet";
|
||||||
this.db_user = "brinet";
|
this.db_user = "brinet";
|
||||||
this.db_password = "Aignan41!";
|
this.db_password = "BIFERO77BuT+";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class.forName("org.mariadb.jdbc.Driver");
|
Class.forName("org.mariadb.jdbc.Driver");
|
||||||
|
@ -440,16 +440,26 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void createProfView () {
|
public void setAv (AdminView av) {
|
||||||
if (this.pv == null) {
|
if (this.av == null) {
|
||||||
this.pv = new ProfView(this.e, this.g, this);
|
this.av = av;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void createAdminView () {
|
public void setPv (ProfView pv) {
|
||||||
if (this.av == null) {
|
if (this.pv == null) {
|
||||||
this.av = new AdminView(this.e, this.g, this);
|
this.pv = pv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ArrayList<Etudiant> getEtudiants () {
|
||||||
|
return this.e;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ArrayList<Groupe> getGroupes() {
|
||||||
|
return this.g;
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,7 +5,12 @@ import java.awt.*;
|
|||||||
import java.awt.event.ActionEvent;
|
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 CardLayout cards = new CardLayout();
|
private CardLayout cards = new CardLayout();
|
||||||
|
private AdminView av;
|
||||||
|
private ProfView pv;
|
||||||
|
|
||||||
|
|
||||||
private JButton[] buttonTab = {
|
private JButton[] buttonTab = {
|
||||||
new JButton("Admin"),
|
new JButton("Admin"),
|
||||||
new JButton("Prof"),
|
new JButton("Prof"),
|
||||||
@ -17,11 +22,23 @@ public class MainMenu extends JFrame {
|
|||||||
super();
|
super();
|
||||||
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
this.setExtendedState(MAXIMIZED_BOTH);
|
this.setExtendedState(MAXIMIZED_BOTH);
|
||||||
//this.setUndecorated(true);
|
this.setMinimumSize(MINIMUM_SIZE);
|
||||||
|
init();
|
||||||
|
this.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
BDatabase db = new BDatabase();
|
||||||
|
Controller listener = new Controller(db);
|
||||||
|
av = new AdminView(listener.getEtudiants(), listener.getGroupes(), listener);
|
||||||
|
pv = new ProfView(listener.getEtudiants(), listener.getGroupes(), listener);
|
||||||
|
|
||||||
this.setLayout(cards);
|
this.setLayout(cards);
|
||||||
this.add(first());
|
this.add(first());
|
||||||
|
this.add(adminView());
|
||||||
|
this.add(profView());
|
||||||
cards.first(this.getContentPane());
|
cards.first(this.getContentPane());
|
||||||
this.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -51,11 +68,21 @@ public class MainMenu extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private JPanel adminView() {
|
||||||
|
JPanel mainPanel = new JPanel
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private JPanel profView() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void action(ActionEvent e) {
|
private void action(ActionEvent e) {
|
||||||
JButton origin = (JButton) e.getSource();
|
JButton origin = (JButton) e.getSource();
|
||||||
|
System.out.println(origin.getText());
|
||||||
|
|
||||||
|
|
||||||
BDatabase db = new BDatabase();
|
|
||||||
Controller listener = new Controller(db);
|
|
||||||
|
|
||||||
if (origin.getText() == "Admin") {
|
if (origin.getText() == "Admin") {
|
||||||
listener.createAdminView();
|
listener.createAdminView();
|
||||||
|
@ -6,6 +6,8 @@ import javax.swing.JComboBox;
|
|||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
@ -13,7 +15,7 @@ import java.awt.event.KeyAdapter;
|
|||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ProfView extends BFrame {
|
public class ProfView extends JPanel {
|
||||||
private final ArrayList<Etudiant> e;
|
private final ArrayList<Etudiant> e;
|
||||||
private final ArrayList<Groupe> g;
|
private final ArrayList<Groupe> g;
|
||||||
private final Controller listener;
|
private final Controller listener;
|
||||||
@ -21,14 +23,7 @@ public class ProfView extends BFrame {
|
|||||||
private JTextField text;
|
private JTextField text;
|
||||||
|
|
||||||
public ProfView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
public ProfView(ArrayList<Etudiant> e, ArrayList<Groupe> g, Controller listener) {
|
||||||
super(
|
super();
|
||||||
"Vue Professeur",
|
|
||||||
700,
|
|
||||||
300,
|
|
||||||
500,
|
|
||||||
500,
|
|
||||||
3
|
|
||||||
);
|
|
||||||
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.e = e;
|
this.e = e;
|
||||||
@ -116,8 +111,6 @@ public class ProfView extends BFrame {
|
|||||||
searchTLetters.setActionCommand("pv::SearchStudentPer3Letters");
|
searchTLetters.setActionCommand("pv::SearchStudentPer3Letters");
|
||||||
this.add(searchTLetters, settings);
|
this.add(searchTLetters, settings);
|
||||||
|
|
||||||
this.setResizable(false);
|
this.repaint();
|
||||||
this.openBFrame();
|
|
||||||
this.refreshBFrame();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user