Transférer les fichiers vers 'src/Test' #1
@ -255,12 +255,12 @@ public class BDatabase {
|
||||
* Recupere le nombre d'etudiant par groupe
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<NBGroupe> getNbrEtuGroupes() {
|
||||
/*public ArrayList<NBGroupe> getNbrEtuGroupes() {
|
||||
ArrayList<NBGroupe> NGroupe = new ArrayList<>();
|
||||
ArrayList<String> groupeNB = this.fetchAll("SELECT COUNT(DISTINCT groupe) FROM fi_eleves;");
|
||||
for(int i = 0; i <= NGroupe.Goupe(groupeNB); i++) {
|
||||
ArrayList<String> grpnb = this.fetchAll("Select count(id) from fi_eleves where groupe="+i+";");
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
@ -62,7 +62,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
/**
|
||||
* Pour afficher une JTable sans listener
|
||||
*
|
||||
* @param parent La fenetre qui sera bloque
|
||||
* @param frameTitle Le titre de la fenetre
|
||||
* @param size_x Taille en x
|
||||
* @param size_y Taille en y
|
||||
@ -81,13 +80,12 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pour afficher une JTable contenant un listener
|
||||
*
|
||||
* @param parent La fenetre qui sera bloque
|
||||
* @param frameTitle Le titre de la fenetre
|
||||
* @param size_x Taille en x
|
||||
* @param size_y Taille en y
|
||||
@ -113,7 +111,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
/**
|
||||
* 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 size_x Taille en x
|
||||
* @param size_y Taille en y
|
||||
@ -437,6 +434,29 @@ public class Controller implements ActionListener, ListSelectionListener {
|
||||
}
|
||||
|
||||
|
||||
public JTable initTable() {
|
||||
Object[][] data = new Object[this.e.size()][3];
|
||||
String[] title = {
|
||||
"Nom",
|
||||
"Prenom",
|
||||
"Groupe",
|
||||
};
|
||||
|
||||
for(int i = 0; i <= this.e.size()-1; i++) {
|
||||
Object[] info = {
|
||||
this.e.get(i).getNom(),
|
||||
this.e.get(i).getPrenom(),
|
||||
String.valueOf(this.e.get(i).getGroupe()),
|
||||
"[DEPLACER]"
|
||||
};
|
||||
|
||||
data[i] = info;
|
||||
}
|
||||
|
||||
return createJTable(data, title);
|
||||
}
|
||||
|
||||
|
||||
public void setAv (AdminView av) {
|
||||
if (this.av == null) {
|
||||
this.av = av;
|
||||
|
@ -9,6 +9,7 @@ public class MainMenu extends JFrame {
|
||||
private CardLayout cards = new CardLayout();
|
||||
private AdminView av;
|
||||
private ProfView pv;
|
||||
private JTable table;
|
||||
|
||||
|
||||
private JButton[] buttonTab = {
|
||||
@ -32,22 +33,36 @@ public class MainMenu extends JFrame {
|
||||
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);
|
||||
this.av = new AdminView(listener.getEtudiants(), listener.getGroupes(), listener);
|
||||
this.pv = new ProfView(listener.getEtudiants(), listener.getGroupes(), listener);
|
||||
|
||||
listener.setAv(av);
|
||||
listener.setPv(pv);
|
||||
|
||||
this.table = listener.initTable();
|
||||
|
||||
this.setLayout(cards);
|
||||
|
||||
this.add(first());
|
||||
this.add(adminView());
|
||||
this.add(profView());
|
||||
this.add(cardWithTable(adminView()));
|
||||
//this.add(cardWithTable(profView()));
|
||||
|
||||
cards.first(this.getContentPane());
|
||||
}
|
||||
|
||||
|
||||
private JPanel cardWithTable(JPanel sidePanel) {
|
||||
JPanel panel = new JPanel();
|
||||
JTable tempTable = this.table;
|
||||
|
||||
panel.setLayout(new GridLayout(1, 2));
|
||||
panel.add(sidePanel);
|
||||
panel.add(tempTable);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
|
||||
private JPanel first() {
|
||||
JPanel mainPanel = new JPanel(), centerPanel = new JPanel();
|
||||
Dimension buttonDimension = new Dimension(300, 50);
|
||||
|
@ -8,11 +8,12 @@ public class TestTexteMNP {
|
||||
/**
|
||||
* Objet de la base de donnee contenant des methodes utile a notre developpement
|
||||
* */
|
||||
BDatabase db = new BDatabase();
|
||||
//BDatabase db = new BDatabase();
|
||||
|
||||
/**
|
||||
* Demarrage de l'appli
|
||||
* */
|
||||
Controller listener = new Controller(db);
|
||||
//Controller listener = new Controller(db);
|
||||
new MainMenu();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user