ok
This commit is contained in:
@@ -34,7 +34,7 @@ public class Model{
|
||||
this.bd=new BD(this.fenetre);
|
||||
Chargement ch=new Chargement();
|
||||
this.promo=this.getPromo(ch);
|
||||
|
||||
ch.dispose();
|
||||
if(this.promo==null){
|
||||
this.fenGr=new FenetreGroupe(null, this);
|
||||
this.fenEtu=new FenetreEtudiant(null);
|
||||
@@ -66,7 +66,8 @@ public class Model{
|
||||
* @param g le groupe a afficher
|
||||
*/
|
||||
public void showGroupe(Groupe g){
|
||||
g=this.bd.refreshALL(g);
|
||||
if(g!=null)
|
||||
g=this.bd.refreshALL(g);
|
||||
this.fenGr=new FenetreGroupe(g, this);
|
||||
this.fenEtu=new FenetreEtudiant(g);
|
||||
this.fenetre.getContentPane().removeAll();
|
||||
@@ -88,9 +89,12 @@ public class Model{
|
||||
* @param g le groupe a supprimer
|
||||
*/
|
||||
public void delete(Groupe g){
|
||||
//On ne peut pas supprimer la promo
|
||||
//On ne peut pas supprimer la promo avec la factory
|
||||
if(g==this.promo.getPromotion()){
|
||||
JOptionPane.showMessageDialog(this.fenetre, "impossible de supprimer la promotion", "alerte", JOptionPane.ERROR_MESSAGE);
|
||||
this.promo=null;
|
||||
this.bd.suprGroupe(g);
|
||||
this.showGroupe(null);
|
||||
//JOptionPane.showMessageDialog(this.fenetre, "impossible de supprimer la promotion", "alerte", JOptionPane.ERROR_MESSAGE);
|
||||
}else{
|
||||
//autrement on récupere les groupe a supprimer par ordre avec une fonction recursive
|
||||
//elle contiendra les sous-groupe remontant j'usqau groupe a supprimer
|
||||
@@ -123,6 +127,7 @@ public class Model{
|
||||
if(gr.getSousGroupes().size()>0 && gr.getSousGroupes().iterator().next().getName().contains(name)){
|
||||
this.fenetre.setVisible(false);
|
||||
this.bd.saveGroupe(gr, 100/this.getTailleGroupe(gr)+1, ch);
|
||||
ch.dispose();
|
||||
this.fenetre.setVisible(true);
|
||||
break;
|
||||
}
|
||||
@@ -154,6 +159,7 @@ public class Model{
|
||||
this.bd.createGroupe(creer);
|
||||
//on y ajoute les étudiant
|
||||
int n=0;
|
||||
int size=100/ajout.size()+1;
|
||||
for(Etudiant e:ajout){
|
||||
if(this.addEtudiant(creer, e)==false)
|
||||
n++;
|
||||
@@ -189,6 +195,7 @@ public class Model{
|
||||
this.promo=new AbstractGroupeFactoryNP(name, min, max);
|
||||
this.fenetre.setVisible(false);
|
||||
this.bd.saveGroupe(this.promo.getPromotion(), this.getTailleGroupe(this.promo.getPromotion()), ch);
|
||||
ch.dispose();
|
||||
this.fenetre.setVisible(true);
|
||||
this.showGroupe(this.bd.refreshALL(this.promo.getPromotion()));
|
||||
}
|
||||
|
Reference in New Issue
Block a user