presque fini MPD
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.Graphic;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Objects;
|
||||
import java.sql.Connection;
|
||||
@@ -29,6 +30,13 @@ public class Graphic{
|
||||
this.fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.getPromo();
|
||||
this.fenetre.setVisible(true);
|
||||
/*
|
||||
System.out.println(this.agf.getPromotion().monPrint());
|
||||
Groupe racineDeLaPartition = agf.getPromotion().getSousGroupes().iterator().next();
|
||||
System.out.println(racineDeLaPartition.monPrint());
|
||||
for(Groupe g : racineDeLaPartition.getSousGroupes()){
|
||||
System.out.println(g.monPrint());
|
||||
}*/
|
||||
}
|
||||
|
||||
private void getPromo(){
|
||||
@@ -47,16 +55,15 @@ public class Graphic{
|
||||
try{
|
||||
if(rs.first()){
|
||||
Groupe promo=new GroupeNP(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), TypeGroupe.getType(rs.getString(5)), null);
|
||||
this.agf=new AbstractGroupeFactoryNP(promo);
|
||||
this.addSousGroupe(promo);
|
||||
}
|
||||
while(rs.next()){
|
||||
System.out.println(rs.getString(1));
|
||||
//valeur sentinel pour pas de groupe parent : -1
|
||||
if(rs.getInt(6)!=-1){
|
||||
//ll.add(new GroupeNP(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), TypeGroupe.getType(rs.getString(5)), ll.get(rs.getInt(6))));
|
||||
}else{
|
||||
//ll.add(new GroupeNP(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), TypeGroupe.getType(rs.getString(5)), null));
|
||||
Groupe g=new GroupeNP(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), TypeGroupe.getType(rs.getString(5)), null);
|
||||
if(agf.knows(g)==false){
|
||||
agf.addGroupe(g);
|
||||
this.addSousGroupe(g);
|
||||
}
|
||||
//il reste a add les étudiants et mettre le sous groupe
|
||||
}
|
||||
}catch(SQLException e){
|
||||
System.out.println("erreur dans la prise de resultat");
|
||||
@@ -86,17 +93,25 @@ public class Graphic{
|
||||
"chaignea", "Chaigneauphpmyadmin");
|
||||
try{
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT `id`, `nom`, `min`, `max`, `value`, `id-parent` FROM `Groupe` join `TYPE` on Groupe.Type=TYPE.name where Groupe.`id-parent`=?; ");
|
||||
"SELECT `id`, `nom`, `min`, `max`, `value`, `id-parent` FROM `Groupe` join `TYPE` on Groupe.Type=TYPE.name where Groupe.`id-parent`=? and Groupe.id!=Groupe.`id-parent`;");
|
||||
try{
|
||||
|
||||
pst.setInt(g.getId(), 1);
|
||||
ResultSet rs=pst.executeQuery();
|
||||
try{
|
||||
|
||||
while(rs.next()){
|
||||
System.out.println(g.getName()+" "+rs.getString(2));
|
||||
Groupe nouveau=new GroupeNP(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), TypeGroupe.getType(rs.getString(5)), g);
|
||||
this.agf.addGroupe(nouveau);
|
||||
g.addSousGroupe(nouveau);
|
||||
this.addSousGroupe(nouveau);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
System.out.println("erreur dans la prise de resultat");
|
||||
}
|
||||
rs.close();
|
||||
}catch(SQLException e){
|
||||
System.out.println("erreur dans le resultat");
|
||||
//ils n'ont pas de sous groupe
|
||||
System.out.println(g.getId() + "est le pere");
|
||||
}
|
||||
pst.close();
|
||||
}catch(SQLException e){
|
||||
|
Reference in New Issue
Block a user