ajout selection etudiant BD, et petite modif Visuelle
This commit is contained in:
parent
1fb3e881dc
commit
4e087ad4ba
@ -41,8 +41,8 @@ public class FenetreGroupe{
|
||||
if(g.getType()==TypeGroupe.PARTITION || g.getType()==TypeGroupe.ROOT)
|
||||
taille--;
|
||||
if(g.getSousGroupes().size()>0)
|
||||
this.pan.setLayout(new GridLayout(8, 1));
|
||||
else{this.pan.setLayout(new GridLayout(7, 1));}
|
||||
this.pan.setLayout(new GridLayout(7, 1));
|
||||
else{this.pan.setLayout(new GridLayout(6, 1));}
|
||||
JPanel tache=new JPanel(new GridLayout(1,taille));
|
||||
|
||||
if(g.getType()!=TypeGroupe.ROOT){
|
||||
@ -51,15 +51,16 @@ public class FenetreGroupe{
|
||||
tache.add(bout);
|
||||
}
|
||||
this.pan.add(tache);
|
||||
JLabel titre=new JLabel("Group : "+g.getName(), JLabel.CENTER);
|
||||
JLabel titre=new JLabel("Groupe : "+g.getName(), JLabel.CENTER);
|
||||
titre.setFont(new Font(Font.SERIF, Font.BOLD, titre.getFont().getSize()+10));
|
||||
this.pan.add(titre);
|
||||
this.pan.add(new JLabel("id= "+String.valueOf(g.getId()),JLabel.CENTER));
|
||||
this.pan.add(new JLabel("min= "+String.valueOf(g.getMin())+"\t || \t max= "+String.valueOf(g.getMax()),JLabel.CENTER));
|
||||
JButton refresh= new JButton("Resfresh");
|
||||
refresh.addActionListener(new ObservateurChangeGroupe(m, g));
|
||||
refresh.setBackground(Color.BLACK);
|
||||
refresh.setForeground(Color.WHITE);
|
||||
this.pan.add(refresh);
|
||||
this.pan.add(new JLabel("Type: "+g.getType().name(), JLabel.CENTER));
|
||||
this.pan.add(new JLabel("Type: "+g.getType().name()+"\t || \t id="+String.valueOf(g.getId()), JLabel.CENTER));
|
||||
this.pan.add(new JLabel("Sous groupe:",JLabel.CENTER));
|
||||
if(g.getSousGroupes().size()>0){
|
||||
JPanel sous=new JPanel(new GridLayout(g.getSousGroupes().size(), 1));
|
||||
|
@ -251,13 +251,15 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
Set<Etudiant> s=new LinkedHashSet<>();
|
||||
//on retourne tous les etudiants
|
||||
if(nomEtu==null){
|
||||
if(this.getPromotion()!=null){
|
||||
for(Etudiant et:this.getPromotion().getEtudiants()){
|
||||
s.add(et);
|
||||
}
|
||||
}
|
||||
//ceux qui sont connu mais pas dans la promo
|
||||
Connection cnx=this.cnx();
|
||||
try{
|
||||
PreparedStatement pst=cnx.prepareStatement("SELECT * FROM Etudiant natural join CONTIENT where Etudiant.id NOT IN (SELECT CONTIENT.idEt FROM CONTIENT) Group by Etudiant.id;");
|
||||
PreparedStatement pst=cnx.prepareStatement("SELECT * FROM Etudiant where Etudiant.id NOT IN (SELECT CONTIENT.idEt FROM CONTIENT) Group by Etudiant.id;");
|
||||
ResultSet rs=pst.executeQuery();
|
||||
while(rs.next()){
|
||||
s.add(new EtudiantNP(rs.getString(2), rs.getString(3), rs.getInt(1)));
|
||||
|
@ -20,9 +20,6 @@ public class Chargement extends JComponent{
|
||||
this.fenetre.add(this, BorderLayout.CENTER);
|
||||
this.fenetre.setVisible(true);
|
||||
}
|
||||
public void addPourcent(int n){
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public void dispose(){
|
||||
this.fenetre.dispose();
|
||||
|
@ -38,12 +38,9 @@ public class ModelRoot implements Model{
|
||||
this.fenetre.setMinimumSize(this.fenetre.getSize());
|
||||
Chargement ch=new Chargement(this.fenetre);
|
||||
this.promo=new AbstractGroupeFactoryNP(this.fenetre);
|
||||
if(this.promo.getPromotion()==null){
|
||||
this.promo=null;
|
||||
}
|
||||
ch.dispose();
|
||||
this.fenetre.setVisible(true);
|
||||
if(this.promo==null){
|
||||
if(this.promo.getPromotion()==null){
|
||||
this.fenGr=new FenetreGroupe(null, this);
|
||||
this.fenEtu=new FenetreEtudiant(null, this);
|
||||
}else{
|
||||
@ -52,7 +49,7 @@ public class ModelRoot implements Model{
|
||||
this.changement=new AbstractChangementFactoryNP(this.promo, this.fenetre);
|
||||
}
|
||||
this.panGroupe=new JPanel(new GridLayout(1,1));
|
||||
if(this.promo!=null){
|
||||
if(this.promo.getPromotion()!=null){
|
||||
this.showGroupe(this.promo.getPromotion());
|
||||
}else{
|
||||
this.showGroupe(null);
|
||||
@ -177,8 +174,7 @@ public class ModelRoot implements Model{
|
||||
//On ne peut pas supprimer la promo normallement
|
||||
if(g==this.promo.getPromotion()){
|
||||
if(JOptionPane.showConfirmDialog(this.fenetre, "Attention ête vous sûr de vouloir supprimer la promo", "Attention", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION){
|
||||
this.promo.deleteGroupe(g);
|
||||
this.promo=null;
|
||||
this.promo.deleteGroupe(this.promo.getPromotion());
|
||||
this.showGroupe(null);
|
||||
}else{
|
||||
return;
|
||||
@ -275,11 +271,8 @@ public class ModelRoot implements Model{
|
||||
this.promo=new AbstractGroupeFactoryNP(name, min, max, this.fenetre);
|
||||
this.changement=new AbstractChangementFactoryNP(this.promo, this.fenetre);
|
||||
this.fenetre.setVisible(false);
|
||||
ch.addPourcent(20);
|
||||
int pourcent=85/ajout.size();
|
||||
for(Etudiant e:ajout){
|
||||
this.addEtudiant(this.promo.getPromotion(), e);
|
||||
ch.addPourcent(pourcent);
|
||||
}
|
||||
ch.dispose();
|
||||
this.fenetre.setVisible(true);
|
||||
|
@ -4,6 +4,8 @@ import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
@ -38,8 +40,8 @@ public class FenetreGroupe{
|
||||
if(g.getType()==TypeGroupe.PARTITION || g.getType()==TypeGroupe.ROOT)
|
||||
taille--;
|
||||
if(g.getSousGroupes().size()>0)
|
||||
this.pan.setLayout(new GridLayout(8, 1));
|
||||
else{this.pan.setLayout(new GridLayout(7, 1));}
|
||||
this.pan.setLayout(new GridLayout(7, 1));
|
||||
else{this.pan.setLayout(new GridLayout(6, 1));}
|
||||
JPanel tache=new JPanel(new GridLayout(1,taille));
|
||||
if(g.getType()!=TypeGroupe.ROOT){
|
||||
JButton bout=new JButton(g.getPointPoint().getName());
|
||||
@ -54,6 +56,7 @@ public class FenetreGroupe{
|
||||
tache.add(ajouter);
|
||||
JButton supprimer=new JButton("supr");
|
||||
supprimer.addActionListener(new ObservateurModifGroupe(m, g));
|
||||
supprimer.setBackground(Color.RED);
|
||||
tache.add(supprimer);
|
||||
if(g.getType()!=TypeGroupe.PARTITION){
|
||||
JButton creer=new JButton("new Groupe");
|
||||
@ -61,15 +64,16 @@ public class FenetreGroupe{
|
||||
tache.add(creer);
|
||||
}
|
||||
this.pan.add(tache);
|
||||
JLabel titre=new JLabel("Group : "+g.getName(), JLabel.CENTER);
|
||||
JLabel titre=new JLabel("Groupe : "+g.getName(), JLabel.CENTER);
|
||||
titre.setFont(new Font(Font.SERIF, Font.BOLD, titre.getFont().getSize()+10));
|
||||
this.pan.add(titre);
|
||||
this.pan.add(new JLabel("id= "+String.valueOf(g.getId()),JLabel.CENTER));
|
||||
this.pan.add(new JLabel("min= "+String.valueOf(g.getMin())+"\t || \t max= "+String.valueOf(g.getMax()),JLabel.CENTER));
|
||||
JButton refresh= new JButton("Resfresh");
|
||||
refresh.addActionListener(new ObservateurChangeGroupe(m, g));
|
||||
refresh.setBackground(Color.BLACK);
|
||||
refresh.setForeground(Color.WHITE);
|
||||
this.pan.add(refresh);
|
||||
this.pan.add(new JLabel("Type: "+g.getType().name(), JLabel.CENTER));
|
||||
this.pan.add(new JLabel("Type: "+g.getType().name()+"\t || \t id="+String.valueOf(g.getId()), JLabel.CENTER));
|
||||
this.pan.add(new JLabel("Sous groupe:",JLabel.CENTER));
|
||||
if(g.getSousGroupes().size()>0){
|
||||
JPanel sous=new JPanel(new GridLayout(g.getSousGroupes().size(), 1));
|
||||
|
@ -16,6 +16,7 @@ public class PanelEtudiant extends JPanel{
|
||||
JPanel bouton=new JPanel(new GridLayout(1,2));
|
||||
JLabel label=new JLabel(" "+e.getNom()+" "+e.getPrenom()+" "+e.getId(), JLabel.LEFT);
|
||||
this.supprimer=new JButton("supr");
|
||||
this.supprimer.setBackground(Color.RED);
|
||||
this.deplacer=new JButton("change");
|
||||
if(change==true){
|
||||
bouton.add(this.deplacer);
|
||||
|
Loading…
Reference in New Issue
Block a user