ok
This commit is contained in:
parent
6c05981b8d
commit
c5cf0dd4f4
@ -103,6 +103,11 @@ ${BUILD}/Graphic/Util/BD.class : ${SRC}/Graphic/Util/BD.java
|
|||||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Util/BD.java
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Util/BD.java
|
||||||
|
|
||||||
## View ##
|
## View ##
|
||||||
|
${BUILD}/Graphic/View/JTreeGroupe.class : ${SRC}/Graphic/View/JTreeGroupe.java \
|
||||||
|
${BUILD}/Graphic/Controller/TreeSelectionListenerGroupe.class \
|
||||||
|
${BUILD}/Graphic/Controller/TreeSelectionEventGroupe.class
|
||||||
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/View/JTreeGroupe.java
|
||||||
|
|
||||||
${BUILD}/Graphic/View/FenetreGroupe.class : ${SRC}/Graphic/View/FenetreGroupe.java \
|
${BUILD}/Graphic/View/FenetreGroupe.class : ${SRC}/Graphic/View/FenetreGroupe.java \
|
||||||
${BUILD}/Graphic/Controller/ObservateurFenetre.class \
|
${BUILD}/Graphic/Controller/ObservateurFenetre.class \
|
||||||
${BUILD}/Graphic/Controller/ObservateurChangeGroupe.class \
|
${BUILD}/Graphic/Controller/ObservateurChangeGroupe.class \
|
||||||
@ -112,10 +117,12 @@ ${BUILD}/Graphic/View/FenetreGroupe.class : ${SRC}/Graphic/View/FenetreGroupe.ja
|
|||||||
${BUILD}/Graphic/View/FenetreEtudiant.class :${SRC}/Graphic/View/FenetreEtudiant.java \
|
${BUILD}/Graphic/View/FenetreEtudiant.class :${SRC}/Graphic/View/FenetreEtudiant.java \
|
||||||
${BUILD}/Graphic/Controller/ObservateurFenetre.class \
|
${BUILD}/Graphic/Controller/ObservateurFenetre.class \
|
||||||
${BUILD}/Graphic/Controller/ObservateurChangeGroupe.class \
|
${BUILD}/Graphic/Controller/ObservateurChangeGroupe.class \
|
||||||
${BUILD}/Graphic/View/PanelEtudiant.class
|
${BUILD}/Graphic/View/PanelEtudiant.class \
|
||||||
|
${BUILD}/Graphic/Controller/ActionListenerChangeEtu.class
|
||||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/View/FenetreEtudiant.java
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/View/FenetreEtudiant.java
|
||||||
|
|
||||||
${BUILD}/Graphic/View/PanelEtudiant.class : ${SRC}/Graphic/View/PanelEtudiant.java
|
${BUILD}/Graphic/View/PanelEtudiant.class : ${SRC}/Graphic/View/PanelEtudiant.java \
|
||||||
|
${BUILD}/Graphic/Controller/ActionListenerSuprEtu.class
|
||||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/View/PanelEtudiant.java
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/View/PanelEtudiant.java
|
||||||
|
|
||||||
${BUILD}/Graphic/View/Chargement.class : ${SRC}/Graphic/View/Chargement.java
|
${BUILD}/Graphic/View/Chargement.class : ${SRC}/Graphic/View/Chargement.java
|
||||||
@ -129,6 +136,14 @@ ${BUILD}/Graphic/View/FenetreSelectionEtu.class : ${SRC}/Graphic/View/FenetreSel
|
|||||||
|
|
||||||
|
|
||||||
## Controller ##
|
## Controller ##
|
||||||
|
${BUILD}/Graphic/Controller/ActionListenerChangeEtu.class : ${SRC}/Graphic/Controller/ActionListenerChangeEtu.java
|
||||||
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/ActionListenerChangeEtu.java
|
||||||
|
|
||||||
|
${BUILD}/Graphic/Controller/ActionListenerSuprEtu.class : ${SRC}/Graphic/Controller/ActionListenerSuprEtu.java \
|
||||||
|
${BUILD}/API/Etudiant.class
|
||||||
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/ActionListenerSuprEtu.java
|
||||||
|
|
||||||
|
|
||||||
${BUILD}/Graphic/Controller/ObservateurFenetre.class : ${SRC}/Graphic/Controller/ObservateurFenetre.java
|
${BUILD}/Graphic/Controller/ObservateurFenetre.class : ${SRC}/Graphic/Controller/ObservateurFenetre.java
|
||||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/ObservateurFenetre.java
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/ObservateurFenetre.java
|
||||||
|
|
||||||
@ -145,8 +160,12 @@ ${BUILD}/Graphic/Controller/SelecteurEtudiant.class : ${SRC}/Graphic/Controller/
|
|||||||
${BUILD}/Graphic/Controller/ActionListenerNouveauEtu.class : ${SRC}/Graphic/Controller/ActionListenerNouveauEtu.java
|
${BUILD}/Graphic/Controller/ActionListenerNouveauEtu.class : ${SRC}/Graphic/Controller/ActionListenerNouveauEtu.java
|
||||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/ActionListenerNouveauEtu.java
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/ActionListenerNouveauEtu.java
|
||||||
|
|
||||||
${BUILD}/Graphic/Controller/TreeSelectionListenerGroupe.class : ${SRC}/Graphic/Controller/TreeSelectionListenerGroupe.java
|
${BUILD}/Graphic/Controller/TreeSelectionListenerGroupe.class : ${SRC}/Graphic/Controller/TreeSelectionListenerGroupe.java \
|
||||||
|
${BUILD}/Graphic/Controller/TreeSelectionEventGroupe.class
|
||||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/TreeSelectionListenerGroupe.java
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/TreeSelectionListenerGroupe.java
|
||||||
|
|
||||||
|
${BUILD}/Graphic/Controller/TreeSelectionEventGroupe.class : ${SRC}/Graphic/Controller/TreeSelectionEventGroupe.java
|
||||||
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Controller/TreeSelectionEventGroupe.java
|
||||||
##....
|
##....
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +176,8 @@ ${BUILD}/Graphic/Model/Model.class : ${SRC}/Graphic/Model/Model.java \
|
|||||||
${BUILD}/Graphic/View/FenetreEtudiant.class \
|
${BUILD}/Graphic/View/FenetreEtudiant.class \
|
||||||
${BUILD}/Graphic/View/Chargement.class \
|
${BUILD}/Graphic/View/Chargement.class \
|
||||||
${BUILD}/Graphic/Util/BD.class \
|
${BUILD}/Graphic/Util/BD.class \
|
||||||
${BUILD}/Graphic/Controller/TreeSelectionListenerGroupe.class
|
${BUILD}/Graphic/Controller/TreeSelectionListenerGroupe.class \
|
||||||
|
${BUILD}/Graphic/View/JTreeGroupe.class
|
||||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Model/Model.java
|
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Graphic/Model/Model.java
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package fr.iutfbleau.projetIHM2022FI2.Graphic.Controller;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model.Model;
|
||||||
|
|
||||||
|
public class ActionListenerChangeEtu implements ActionListener {
|
||||||
|
public Etudiant etudiant;
|
||||||
|
public Model model;
|
||||||
|
public ActionListenerChangeEtu(Model m, Etudiant e){
|
||||||
|
this.model=m;
|
||||||
|
this.etudiant=e;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
System.out.println(this.etudiant.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package fr.iutfbleau.projetIHM2022FI2.Graphic.Controller;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model.Model;
|
||||||
|
public class ActionListenerSuprEtu implements ActionListener {
|
||||||
|
public Etudiant etudiant;
|
||||||
|
public Model model;
|
||||||
|
public ActionListenerSuprEtu(Model m, Etudiant e){
|
||||||
|
this.model=m;
|
||||||
|
this.etudiant=e;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if(this.model.deleteEtu(this.etudiant)==false){
|
||||||
|
JOptionPane.showMessageDialog(this.model.getFenetre(), "erreur trop peu d'etudiant dans le groupe/ les groupes fils", "erreur", JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package fr.iutfbleau.projetIHM2022FI2.Graphic.Controller;
|
||||||
|
|
||||||
|
import javax.swing.event.*;
|
||||||
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model.Model;
|
||||||
|
|
||||||
|
public class TreeSelectionEventGroupe extends TreeSelectionEvent{
|
||||||
|
private Groupe groupe;
|
||||||
|
private Model model;
|
||||||
|
public TreeSelectionEventGroupe(Object source, TreePath[] paths, boolean[] areNew, TreePath oldLeadSelectionPath,
|
||||||
|
TreePath newLeadSelectionPath, Groupe g, Model m) {
|
||||||
|
super(source, paths, areNew, oldLeadSelectionPath, newLeadSelectionPath);
|
||||||
|
this.groupe=g;
|
||||||
|
this.model=m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Groupe getGroupe() {
|
||||||
|
return groupe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Model getModel() {
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,18 +3,15 @@ package fr.iutfbleau.projetIHM2022FI2.Graphic.Controller;
|
|||||||
import javax.swing.event.TreeSelectionEvent;
|
import javax.swing.event.TreeSelectionEvent;
|
||||||
import javax.swing.event.TreeSelectionListener;
|
import javax.swing.event.TreeSelectionListener;
|
||||||
|
|
||||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
|
||||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model.Model;
|
|
||||||
|
|
||||||
public class TreeSelectionListenerGroupe implements TreeSelectionListener{
|
public class TreeSelectionListenerGroupe implements TreeSelectionListener{
|
||||||
private Model m;
|
public TreeSelectionListenerGroupe(){
|
||||||
public TreeSelectionListenerGroupe(Model m){
|
|
||||||
this.m=m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void valueChanged(TreeSelectionEvent e) {
|
public void valueChanged(TreeSelectionEvent e) {
|
||||||
Groupe g=(Groupe)e.getSource();
|
TreeSelectionEventGroupe k=(TreeSelectionEventGroupe)e;
|
||||||
m.showGroupe(g);
|
k.getModel().showGroupe(k.getGroupe());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import fr.iutfbleau.projetIHM2022FI2.Graphic.Util.BD;
|
|||||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.Chargement;
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.Chargement;
|
||||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.FenetreEtudiant;
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.FenetreEtudiant;
|
||||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.FenetreGroupe;
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.FenetreGroupe;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.View.JTreeGroupe;
|
||||||
import fr.iutfbleau.projetIHM2022FI2.MNP.AbstractGroupeFactoryNP;
|
import fr.iutfbleau.projetIHM2022FI2.MNP.AbstractGroupeFactoryNP;
|
||||||
import fr.iutfbleau.projetIHM2022FI2.MNP.GroupeNP;
|
import fr.iutfbleau.projetIHM2022FI2.MNP.GroupeNP;
|
||||||
|
|
||||||
@ -32,21 +33,20 @@ public class Model{
|
|||||||
private JFrame fenetre;
|
private JFrame fenetre;
|
||||||
private BD bd;
|
private BD bd;
|
||||||
public Model(){
|
public Model(){
|
||||||
|
this.fenetre=new JFrame();
|
||||||
|
this.fenetre.setSize(1200, 720);
|
||||||
this.bd=new BD(this.fenetre);
|
this.bd=new BD(this.fenetre);
|
||||||
Chargement ch=new Chargement();
|
Chargement ch=new Chargement(this.fenetre.getSize());
|
||||||
this.promo=this.getPromo(ch);
|
this.promo=this.getPromo(ch);
|
||||||
ch.dispose();
|
ch.dispose();
|
||||||
JTree tree=new JTree();
|
JTree tree=new JTree();
|
||||||
if(this.promo==null){
|
if(this.promo==null){
|
||||||
this.fenGr=new FenetreGroupe(null, this);
|
this.fenGr=new FenetreGroupe(null, this);
|
||||||
this.fenEtu=new FenetreEtudiant(null);
|
this.fenEtu=new FenetreEtudiant(null, this);
|
||||||
}else{
|
}else{
|
||||||
this.fenGr=new FenetreGroupe(this.promo.getPromotion(), this);
|
this.fenGr=new FenetreGroupe(this.promo.getPromotion(), this);
|
||||||
this.fenEtu=new FenetreEtudiant(this.promo.getPromotion());
|
this.fenEtu=new FenetreEtudiant(this.promo.getPromotion(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fenetre=new JFrame();
|
|
||||||
this.fenetre.setSize(1200, 720);
|
|
||||||
this.bd.setFenetre(this.fenetre);
|
this.bd.setFenetre(this.fenetre);
|
||||||
this.fenetre.setLocation(100,100);
|
this.fenetre.setLocation(100,100);
|
||||||
this.fenetre.addWindowListener(new ObservateurFenetre());
|
this.fenetre.addWindowListener(new ObservateurFenetre());
|
||||||
@ -62,9 +62,6 @@ public class Model{
|
|||||||
this.showGroupe(this.promo.getPromotion());
|
this.showGroupe(this.promo.getPromotion());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void nouvelleCible(TreePath e){
|
|
||||||
System.out.println(e.getLastPathComponent().toString());
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Fonction pour refresh/changer de groupe d'affichage
|
* Fonction pour refresh/changer de groupe d'affichage
|
||||||
* @param g le groupe a afficher
|
* @param g le groupe a afficher
|
||||||
@ -72,19 +69,19 @@ public class Model{
|
|||||||
public void showGroupe(Groupe g){
|
public void showGroupe(Groupe g){
|
||||||
if(g!=null)
|
if(g!=null)
|
||||||
g=this.bd.refreshALL(g);
|
g=this.bd.refreshALL(g);
|
||||||
DefaultMutableTreeNode mut=new DefaultMutableTreeNode(g);
|
/*
|
||||||
JTree arbre = new JTree(mut);
|
JTree arbre = new JTreeGroupe(g, this);
|
||||||
arbre.setEditable(true);
|
arbre.setEditable(true);
|
||||||
arbre.setShowsRootHandles(true);
|
arbre.setShowsRootHandles(true);
|
||||||
arbre.getSelectionModel().setSelectionMode(
|
arbre.getSelectionModel().setSelectionMode(
|
||||||
TreeSelectionModel.SINGLE_TREE_SELECTION);
|
TreeSelectionModel.SINGLE_TREE_SELECTION);
|
||||||
|
arbre.addTreeSelectionListener(new TreeSelectionListenerGroupe());
|
||||||
arbre.addTreeSelectionListener(new TreeSelectionListenerGroupe(this));
|
|
||||||
|
|
||||||
this.fenGr=new FenetreGroupe(g, this);
|
|
||||||
this.fenEtu=new FenetreEtudiant(g);
|
|
||||||
this.fenetre.getContentPane().removeAll();
|
|
||||||
this.fenetre.add(arbre);
|
this.fenetre.add(arbre);
|
||||||
|
*/
|
||||||
|
this.fenGr=new FenetreGroupe(g, this);
|
||||||
|
this.fenEtu=new FenetreEtudiant(g, this);
|
||||||
|
this.fenetre.getContentPane().removeAll();
|
||||||
|
this.fenetre.add(this.fenGr);
|
||||||
JScrollPane scroll=new JScrollPane(this.fenEtu);
|
JScrollPane scroll=new JScrollPane(this.fenEtu);
|
||||||
scroll.getVerticalScrollBar().setUnitIncrement(15);
|
scroll.getVerticalScrollBar().setUnitIncrement(15);
|
||||||
this.fenetre.add(scroll);
|
this.fenetre.add(scroll);
|
||||||
@ -136,7 +133,7 @@ public class Model{
|
|||||||
* @param name le nom des partition
|
* @param name le nom des partition
|
||||||
*/
|
*/
|
||||||
public void partition(Groupe g, int n, String name){
|
public void partition(Groupe g, int n, String name){
|
||||||
Chargement ch=new Chargement();
|
Chargement ch=new Chargement(this.fenetre.getSize());
|
||||||
this.promo.createPartition(g, name, n);
|
this.promo.createPartition(g, name, n);
|
||||||
//On recherche le groupe Partitionner pour le sauvegarder dans la BD
|
//On recherche le groupe Partitionner pour le sauvegarder dans la BD
|
||||||
|
|
||||||
@ -207,7 +204,7 @@ public class Model{
|
|||||||
|
|
||||||
|
|
||||||
public void addPromo(int min, int max, String name, Set<Etudiant> ajout){
|
public void addPromo(int min, int max, String name, Set<Etudiant> ajout){
|
||||||
Chargement ch=new Chargement();
|
Chargement ch=new Chargement(this.fenetre.getSize());
|
||||||
this.promo=new AbstractGroupeFactoryNP(name, min, max);
|
this.promo=new AbstractGroupeFactoryNP(name, min, max);
|
||||||
this.fenetre.setVisible(false);
|
this.fenetre.setVisible(false);
|
||||||
this.bd.saveGroupe(this.promo.getPromotion(), this.getTailleGroupe(this.promo.getPromotion()), ch);
|
this.bd.saveGroupe(this.promo.getPromotion(), this.getTailleGroupe(this.promo.getPromotion()), ch);
|
||||||
@ -313,4 +310,25 @@ public class Model{
|
|||||||
this.init(gr, pourcentage, ch);
|
this.init(gr, pourcentage, ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean deleteEtu(Etudiant e){
|
||||||
|
if(this.deleteEtutoChildren(e, this.fenGr.getG())){
|
||||||
|
this.bd.deleteEtu(e, this.fenGr.getG());
|
||||||
|
this.showGroupe(this.fenGr.getG());
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean deleteEtutoChildren(Etudiant e, Groupe g){
|
||||||
|
if(g.getMax()<g.getEtudiants().size()-1)
|
||||||
|
return false;
|
||||||
|
for(Groupe sous: g.getSousGroupes()){
|
||||||
|
if(this.deleteEtutoChildren(e, sous)==false){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,4 +372,37 @@ public class BD {
|
|||||||
public void setFenetre(JFrame fenetre) {
|
public void setFenetre(JFrame fenetre) {
|
||||||
this.fenetre = fenetre;
|
this.fenetre = fenetre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteEtu(Etudiant et, Groupe g){
|
||||||
|
Connection cnx=this.cnx();
|
||||||
|
try{
|
||||||
|
PreparedStatement pst=cnx.prepareStatement(
|
||||||
|
"DELETE FROM CONTIENT WHERE idGroupe=? AND idEt=?; "
|
||||||
|
);
|
||||||
|
pst.setInt(2, et.getId());
|
||||||
|
this.deleteEtu(pst, cnx, g);
|
||||||
|
pst.close();
|
||||||
|
}catch(SQLException e){
|
||||||
|
System.out.println(e.toString());
|
||||||
|
if(this.erreurSQL()){
|
||||||
|
this.deleteEtu(et, g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.close(cnx);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteEtu(PreparedStatement pst, Connection cnx, Groupe g){
|
||||||
|
try{
|
||||||
|
pst.setInt(1, g.getId());
|
||||||
|
pst.executeUpdate();
|
||||||
|
for(Groupe sous: g.getSousGroupes()){
|
||||||
|
this.deleteEtu(pst, cnx, sous);
|
||||||
|
}
|
||||||
|
}catch(SQLException e){
|
||||||
|
System.out.println(e.toString());
|
||||||
|
if(this.erreurSQL()){
|
||||||
|
this.deleteEtu(pst, cnx, g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,17 +14,16 @@ public class Chargement extends JComponent{
|
|||||||
private int pourcentage;
|
private int pourcentage;
|
||||||
private JFrame fenetre;
|
private JFrame fenetre;
|
||||||
|
|
||||||
public Chargement(){
|
public Chargement(Dimension n){
|
||||||
this.pourcentage=0;
|
this.pourcentage=0;
|
||||||
this.fenetre=new JFrame();
|
this.fenetre=new JFrame();
|
||||||
this.fenetre.setSize(1200, 720);
|
this.fenetre.setSize(n);
|
||||||
this.fenetre.setLocation(100,100);
|
this.fenetre.setLocation(100,100);
|
||||||
this.fenetre.add(this, BorderLayout.CENTER);
|
this.fenetre.add(this, BorderLayout.CENTER);
|
||||||
this.repaint();
|
this.repaint();
|
||||||
this.fenetre.setVisible(true);
|
this.fenetre.setVisible(true);
|
||||||
}
|
}
|
||||||
public void addPourcent(int n){
|
public void addPourcent(int n){
|
||||||
System.out.println(this.pourcentage+n);
|
|
||||||
this.pourcentage+=n;
|
this.pourcentage+=n;
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,17 @@ import java.util.Set;
|
|||||||
|
|
||||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ActionListenerChangeEtu;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.ActionListenerSuprEtu;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model.Model;
|
||||||
|
|
||||||
|
|
||||||
public class FenetreEtudiant extends JPanel{
|
public class FenetreEtudiant extends JPanel{
|
||||||
private Set<Etudiant> etu;
|
private Set<Etudiant> etu;
|
||||||
public FenetreEtudiant(Groupe g){
|
private Model m;
|
||||||
|
public FenetreEtudiant(Groupe g, Model m){
|
||||||
super();
|
super();
|
||||||
|
this.m=m;
|
||||||
if(g!=null){
|
if(g!=null){
|
||||||
this.etu=g.getEtudiants();
|
this.etu=g.getEtudiants();
|
||||||
}else{
|
}else{
|
||||||
@ -29,6 +34,8 @@ public class FenetreEtudiant extends JPanel{
|
|||||||
this.setLayout(new GridLayout(this.etu.size(), 1, 10, 0));
|
this.setLayout(new GridLayout(this.etu.size(), 1, 10, 0));
|
||||||
for(Etudiant e: this.etu){
|
for(Etudiant e: this.etu){
|
||||||
PanelEtudiant p=new PanelEtudiant(e);
|
PanelEtudiant p=new PanelEtudiant(e);
|
||||||
|
p.addActionDeleteListener(new ActionListenerSuprEtu(m, e));
|
||||||
|
p.addActionChangeListener(new ActionListenerChangeEtu(m, e));
|
||||||
this.add(p);
|
this.add(p);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
@ -3,17 +3,27 @@ package fr.iutfbleau.projetIHM2022FI2.Graphic.View;
|
|||||||
import javax.swing.JTree;
|
import javax.swing.JTree;
|
||||||
import javax.swing.event.TreeSelectionEvent;
|
import javax.swing.event.TreeSelectionEvent;
|
||||||
import javax.swing.event.TreeSelectionListener;
|
import javax.swing.event.TreeSelectionListener;
|
||||||
|
|
||||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.TreeSelectionEventGroupe;
|
||||||
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Controller.TreeSelectionListenerGroupe;
|
||||||
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model.Model;
|
import fr.iutfbleau.projetIHM2022FI2.Graphic.Model.Model;
|
||||||
|
|
||||||
public class JTreeGroupe extends JTree{
|
public class JTreeGroupe extends JTree{
|
||||||
private Groupe groupe;
|
private Groupe groupe;
|
||||||
private Model model;
|
private Model model;
|
||||||
|
public JTreeGroupe(Groupe g, Model m){
|
||||||
|
super();
|
||||||
|
this.groupe=g;
|
||||||
|
this.model=m;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void fireValueChanged(TreeSelectionEvent e) {
|
protected void fireValueChanged(TreeSelectionEvent e) {
|
||||||
|
e=new TreeSelectionEventGroupe(this, getSelectionPaths(), null, getLeadSelectionPath(), getLeadSelectionPath(), this.groupe, this.model);
|
||||||
TreeSelectionListener[] list=this.getTreeSelectionListeners();
|
TreeSelectionListener[] list=this.getTreeSelectionListeners();
|
||||||
list[0].valueChanged(e, g);
|
TreeSelectionListenerGroupe l=(TreeSelectionListenerGroupe) list[0];
|
||||||
|
l.valueChanged(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -7,21 +7,28 @@ import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
|||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
public class PanelEtudiant extends JPanel{
|
public class PanelEtudiant extends JPanel{
|
||||||
private Etudiant e;
|
|
||||||
private JButton supprimer;
|
private JButton supprimer;
|
||||||
private JButton deplacer;
|
private JButton deplacer;
|
||||||
public PanelEtudiant(Etudiant e){
|
public PanelEtudiant(Etudiant e){
|
||||||
super(new GridLayout(1,2,20,10));
|
super(new GridLayout(1,2,20,10));
|
||||||
this.e=e;
|
|
||||||
JLabel label=new JLabel(" "+e.getNom()+" "+e.getPrenom()+" "+e.getId(), JLabel.LEFT);
|
JLabel label=new JLabel(" "+e.getNom()+" "+e.getPrenom()+" "+e.getId(), JLabel.LEFT);
|
||||||
this.supprimer=new JButton("supr");
|
this.supprimer=new JButton("supr");
|
||||||
this.deplacer=new JButton("change");
|
this.deplacer=new JButton("change");
|
||||||
|
|
||||||
this.add(label);
|
this.add(label);
|
||||||
JPanel bouton=new JPanel(new GridLayout(1,2));
|
JPanel bouton=new JPanel(new GridLayout(1,2));
|
||||||
bouton.add(this.supprimer);
|
bouton.add(this.supprimer);
|
||||||
bouton.add(this.deplacer);
|
bouton.add(this.deplacer);
|
||||||
this.add(bouton);
|
this.add(bouton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addActionDeleteListener(ActionListener a){
|
||||||
|
this.supprimer.addActionListener(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addActionChangeListener(ActionListener a){
|
||||||
|
this.deplacer.addActionListener(a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user