POssibiliter Grupe: Renomer, supprimer, créer, ajouter des Etudiant

This commit is contained in:
2022-11-13 19:50:53 +01:00
parent e9fac29412
commit 323c6e43e2
13 changed files with 355 additions and 14 deletions

View File

@@ -37,6 +37,7 @@ public class Chargement extends JComponent{
FontMetrics metrics = secondPinceau.getFontMetrics(secondPinceau.getFont());
secondPinceau.drawString("CHARGEMENT", (this.getWidth()/2-metrics.stringWidth("CHARGEMENT")/2), (this.getHeight()-metrics.getHeight())/3+metrics.getAscent());
secondPinceau.drawRect(this.getWidth()/10, this.getHeight()/2, this.getWidth()/10*8, this.getHeight()/10);
secondPinceau.fillRect(this.getWidth()/10, this.getHeight()/2, this.getWidth()/10*8/100*pourcentage, this.getHeight()/10);
float stat=(int) 8.F/100.F*(pourcentage);
secondPinceau.fillRect(this.getWidth()/10, this.getHeight()/2, this.getWidth()/10*((int) stat), this.getHeight()/10);
}
}

View File

@@ -4,7 +4,7 @@ package fr.iutfbleau.projetIHM2022FI2.Graphic.View;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.GridLayout;
import java.awt.*;
import java.util.Set;
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
@@ -16,10 +16,11 @@ public class FenetreEtudiant extends JPanel{
public FenetreEtudiant(Groupe g){
super();
if(g!=null){
this.setLayout(new GridLayout(57, 1));
this.etu=g.getEtudiants();
this.setLayout(new GridLayout(this.etu.size(), 1, 10, 0));
for(Etudiant e: this.etu){
this.add(new JLabel(e.monPrint()));
PanelEtudiant p=new PanelEtudiant(e);
this.add(p);
}
}else{
this.add(new JLabel("Il n'y a pas d'étudiant"));

View File

@@ -6,8 +6,10 @@ import javax.swing.JPanel;
import java.awt.GridLayout;
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model;
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ObservateurChangeGroupe;
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ObservateurModifGroupe;
public class FenetreGroupe extends JPanel{
@@ -16,7 +18,7 @@ public class FenetreGroupe extends JPanel{
super();
this.g=g;
if(g!=null){
this.setLayout(new GridLayout(15, 1));
this.setLayout(new GridLayout(11+g.getSousGroupes().size(), 1));
JButton bout=new JButton("point point");
bout.addActionListener(new ObservateurChangeGroupe(m, this.g.getPointPoint()));
this.add(bout);
@@ -24,12 +26,27 @@ public class FenetreGroupe extends JPanel{
this.add(new JLabel("id= "+String.valueOf(g.getId())));
this.add(new JLabel("min= "+String.valueOf(g.getMin())));
this.add(new JLabel("max= "+String.valueOf(g.getMax())));
this.add(new JLabel(g.getType().name()));
this.add(new JLabel("Sous groupe"));
for(Groupe gr: g.getSousGroupes()){
JButton b=new JButton(gr.getName());
b.addActionListener(new ObservateurChangeGroupe(m, gr));
this.add(b);
}
JButton supprimer=new JButton("suprimer ce groupe");
supprimer.addActionListener(new ObservateurModifGroupe(m, g));
this.add(supprimer);
if(g.getType()!=TypeGroupe.PARTITION){
JButton creer=new JButton("créer un sous groupe");
creer.addActionListener(new ObservateurModifGroupe(m, g));
this.add(creer);
}
JButton renomer=new JButton("renomer");
renomer.addActionListener(new ObservateurModifGroupe(m, g));
this.add(renomer);
JButton ajouter=new JButton("ajouter");
ajouter.addActionListener(new ObservateurModifGroupe(m, g));
this.add(ajouter);
}else{
this.add(new JLabel("Il n'y a pas encore de Groupe"));
}

View File

@@ -0,0 +1,48 @@
package fr.iutfbleau.projetIHM2022FI2.Graphic.View;
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.SelecteurEtudiant;
import java.util.Set;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
public class FenetreSelectionEtu extends JPanel{
private Set<Etudiant> liste;
private Groupe racine;
public FenetreSelectionEtu(Groupe g, Set<Etudiant> liste){
super(new GridLayout(g.getEtudiants().size()/3, 3));
this.racine=g;
this.liste=liste;
int index=0;
for(Etudiant e:g.getEtudiants()){
JButton lab=new JButton(e.getNom()+" "+e.getPrenom()+" "+e.getId());
lab.addMouseListener(new SelecteurEtudiant(index, this));
this.add(lab);
index++;
}
}
public void addList(int index){
int i=0;
for(Etudiant e:racine.getEtudiants()){
if(i==index){
this.liste.add(e);
return;
}
i++;
}
}
public void removeList(int index){
int i=0;
for(Etudiant e:racine.getEtudiants()){
if(i==index){
this.liste.remove(e);
return;
}
i++;
}
}
}

View File

@@ -0,0 +1,41 @@
package fr.iutfbleau.projetIHM2022FI2.Graphic.View;
import javax.swing.JLabel;
import javax.swing.JPanel;
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
import javax.swing.JButton;
import java.awt.*;
public class PanelEtudiant extends JPanel{
private JLabel nom;
private Etudiant e;
private JButton renomer;
private JButton supprimer;
private JButton deplacer;
public PanelEtudiant(Etudiant e){
super(new GridBagLayout());
this.nom=new JLabel(e.getNom()+" "+e.getPrenom()+" "+e.getId(), JLabel.LEFT);
this.renomer=new JButton("r");
this.supprimer=new JButton("-");
this.deplacer=new JButton("c");
GridBagConstraints cbg=new GridBagConstraints();
cbg.gridy=0;
cbg.anchor=GridBagConstraints.EAST;
cbg.fill=GridBagConstraints.BOTH;
this.add(this.nom, cbg);
cbg.gridwidth=0;
cbg.gridheight=0;
cbg.anchor=GridBagConstraints.EAST;
cbg.fill=GridBagConstraints.NONE;
this.add(this.renomer, cbg);
this.add(this.supprimer, cbg);
this.add(this.deplacer, cbg);
}
}