2022-11-13 04:01:11 +01:00
|
|
|
package fr.iutfbleau.projetIHM2022FI2.Graphic.View;
|
|
|
|
|
|
|
|
import javax.swing.JButton;
|
|
|
|
import javax.swing.JLabel;
|
|
|
|
import javax.swing.JPanel;
|
|
|
|
|
|
|
|
import java.awt.GridLayout;
|
|
|
|
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
2022-11-13 19:50:53 +01:00
|
|
|
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
2022-11-13 04:01:11 +01:00
|
|
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model;
|
|
|
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ObservateurChangeGroupe;
|
2022-11-13 19:50:53 +01:00
|
|
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ObservateurModifGroupe;
|
2022-11-13 04:01:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
public class FenetreGroupe extends JPanel{
|
|
|
|
private Groupe g;
|
|
|
|
public FenetreGroupe(Groupe g, Model m){
|
2022-11-13 15:46:15 +01:00
|
|
|
super();
|
2022-11-13 04:01:11 +01:00
|
|
|
this.g=g;
|
2022-11-13 15:46:15 +01:00
|
|
|
if(g!=null){
|
2022-11-13 19:50:53 +01:00
|
|
|
this.setLayout(new GridLayout(11+g.getSousGroupes().size(), 1));
|
2022-11-13 15:46:15 +01:00
|
|
|
JButton bout=new JButton("point point");
|
|
|
|
bout.addActionListener(new ObservateurChangeGroupe(m, this.g.getPointPoint()));
|
|
|
|
this.add(bout);
|
|
|
|
this.add(new JLabel(g.getName()));
|
|
|
|
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())));
|
2022-11-13 19:50:53 +01:00
|
|
|
this.add(new JLabel(g.getType().name()));
|
2022-11-13 15:46:15 +01:00
|
|
|
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);
|
|
|
|
}
|
2022-11-13 19:50:53 +01:00
|
|
|
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);
|
2022-11-13 20:02:46 +01:00
|
|
|
if(g.getType()!=TypeGroupe.ROOT){
|
|
|
|
JButton ajouter=new JButton("ajouter");
|
|
|
|
ajouter.addActionListener(new ObservateurModifGroupe(m, g));
|
|
|
|
this.add(ajouter);
|
|
|
|
}
|
2022-11-13 15:46:15 +01:00
|
|
|
}else{
|
|
|
|
this.add(new JLabel("Il n'y a pas encore de Groupe"));
|
2022-11-13 04:01:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|