debut de la fin des changements, modif api et correction de bug
This commit is contained in:
parent
35696d3b14
commit
1fb3e881dc
java/APIGroupe
Makefile
src/fr/iutfbleau/projetIHM2022FI2
API
ETU
Controller
Model
View
MNP
Permanent
Controller
ActionListenerChangeEtu.javaControllerGroupeBChangement.javaObservateurChangeGroupe.javaObservateurFenetre.java
TestTexteMNP.javaROOT
@ -24,7 +24,7 @@ run : build\
|
||||
|
||||
# AUTRE BUTS
|
||||
doc :
|
||||
javadoc -d doc src/fr/iutfbleau/projetIHM2022FI2/API/*.java src/fr/iutfbleau/projetIHM2022FI2/MNP/*.java src/fr/iutfbleau/projetIHM2022FI2/ROOT/Controller/*.java src/fr/iutfbleau/projetIHM2022FI2/ROOT/View/*.java
|
||||
javadoc -d doc src/fr/iutfbleau/projetIHM2022FI2/API/*.java src/fr/iutfbleau/projetIHM2022FI2/MNP/*.java src/fr/iutfbleau/projetIHM2022FI2/ROOT/Controller/*.java src/fr/iutfbleau/projetIHM2022FI2/ROOT/View/*.java src/fr/iutfbleau/projetIHM2022FI2/ETU/Controller/*.java src/fr/iutfbleau/projetIHM2022FI2/ETU/View/*.java src/fr/iutfbleau/projetIHM2022FI2/ETU/Model/*.java src/fr/iutfbleau/projetIHM2022FI2/ROOTw/Model/*.java
|
||||
|
||||
clean :
|
||||
rm -rf ${BUILD}/* *.jar
|
||||
@ -35,6 +35,9 @@ clean :
|
||||
build :
|
||||
mkdir build
|
||||
## API ##
|
||||
${BUILD}/API/Model.class : ${SRC}/API/Model.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/API/Model.java
|
||||
|
||||
${BUILD}/API/MonPrint.class : ${SRC}/API/MonPrint.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/API/MonPrint.java
|
||||
|
||||
@ -94,28 +97,22 @@ ${BUILD}/MNP/AbstractChangementFactoryNP.class : ${SRC}/MNP/AbstractChangementFa
|
||||
${BUILD}/API/Changement.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/MNP/AbstractChangementFactoryNP.java
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## ROOT ##
|
||||
|
||||
|
||||
## View ##
|
||||
|
||||
${BUILD}/ROOT/View/FenetreGroupe.class : ${SRC}/ROOT/View/FenetreGroupe.java \
|
||||
${BUILD}/ROOT/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/ROOT/Controller/ObservateurChangeGroupe.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurChangeGroupe.class \
|
||||
${BUILD}/ROOT/Controller/ObservateurModifGroupe.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/View/FenetreGroupe.java
|
||||
|
||||
${BUILD}/ROOT/View/FenetreEtudiant.class :${SRC}/ROOT/View/FenetreEtudiant.java \
|
||||
${BUILD}/ROOT/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/ROOT/Controller/ObservateurChangeGroupe.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurChangeGroupe.class \
|
||||
${BUILD}/ROOT/View/PanelEtudiant.class \
|
||||
${BUILD}/ROOT/Controller/ActionListenerChangeEtu.class
|
||||
${BUILD}/Permanent/Controller/ActionListenerChangeEtu.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/View/FenetreEtudiant.java
|
||||
|
||||
${BUILD}/ROOT/View/PanelEtudiant.class : ${SRC}/ROOT/View/PanelEtudiant.java \
|
||||
@ -130,24 +127,16 @@ ${BUILD}/ROOT/View/FenetreSelectionEtu.class : ${SRC}/ROOT/View/FenetreSelection
|
||||
|
||||
|
||||
## Controller ##
|
||||
${BUILD}/ROOT/Controller/ActionListenerChangeEtu.class : ${SRC}/ROOT/Controller/ActionListenerChangeEtu.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ActionListenerChangeEtu.java
|
||||
|
||||
${BUILD}/ROOT/Controller/ActionListenerSuprEtu.class : ${SRC}/ROOT/Controller/ActionListenerSuprEtu.java \
|
||||
${BUILD}/API/Etudiant.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ActionListenerSuprEtu.java
|
||||
|
||||
|
||||
${BUILD}/ROOT/Controller/ObservateurFenetre.class : ${SRC}/ROOT/Controller/ObservateurFenetre.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ObservateurFenetre.java
|
||||
|
||||
${BUILD}/ROOT/Controller/ObservateurModifGroupe.class : ${SRC}/ROOT/Controller/ObservateurModifGroupe.java \
|
||||
${BUILD}/ROOT/View/FenetreSelectionEtu.class \
|
||||
${BUILD}/ROOT/Controller/SelecteurEtudiant.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ObservateurModifGroupe.java
|
||||
|
||||
${BUILD}/ROOT/Controller/ObservateurChangeGroupe.class : ${SRC}/ROOT/Controller/ObservateurChangeGroupe.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ObservateurChangeGroupe.java
|
||||
|
||||
${BUILD}/ROOT/Controller/SelecteurEtudiant.class : ${SRC}/ROOT/Controller/SelecteurEtudiant.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/SelecteurEtudiant.java
|
||||
@ -160,11 +149,12 @@ ${BUILD}/ROOT/Controller/ActionListenerNouveauEtu.class : ${SRC}/ROOT/Controller
|
||||
|
||||
## Model ###
|
||||
|
||||
${BUILD}/ROOT/Model/Model.class : ${SRC}/ROOT/Model/Model.java \
|
||||
${BUILD}/ROOT/Model/ModelRoot.class : ${SRC}/ROOT/Model/ModelRoot.java \
|
||||
${BUILD}/API/Model.class \
|
||||
${BUILD}/ROOT/View/FenetreGroupe.class \
|
||||
${BUILD}/ROOT/View/FenetreEtudiant.class \
|
||||
${BUILD}/Permanent/View/Chargement.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Model/Model.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Model/ModelRoot.java
|
||||
|
||||
|
||||
|
||||
@ -177,15 +167,15 @@ ${BUILD}/ROOT/Model/Model.class : ${SRC}/ROOT/Model/Model.java \
|
||||
## View ##
|
||||
|
||||
${BUILD}/ETU/View/FenetreGroupe.class : ${SRC}/ETU/View/FenetreGroupe.java \
|
||||
${BUILD}/ETU/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/ETU/Controller/ObservateurChangeGroupe.class
|
||||
${BUILD}/Permanent/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurChangeGroupe.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ETU/View/FenetreGroupe.java
|
||||
|
||||
${BUILD}/ETU/View/FenetreEtudiant.class :${SRC}/ETU/View/FenetreEtudiant.java \
|
||||
${BUILD}/ETU/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/ETU/Controller/ObservateurChangeGroupe.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurChangeGroupe.class \
|
||||
${BUILD}/ETU/View/PanelEtudiant.class \
|
||||
${BUILD}/ETU/Controller/ActionListenerChangeEtu.class
|
||||
${BUILD}/Permanent/Controller/ActionListenerChangeEtu.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ETU/View/FenetreEtudiant.java
|
||||
|
||||
${BUILD}/ETU/View/PanelEtudiant.class : ${SRC}/ETU/View/PanelEtudiant.java
|
||||
@ -194,29 +184,20 @@ ${BUILD}/ETU/View/PanelEtudiant.class : ${SRC}/ETU/View/PanelEtudiant.java
|
||||
|
||||
|
||||
## Controller ##
|
||||
${BUILD}/ETU/Controller/ActionListenerChangeEtu.class : ${SRC}/ETU/Controller/ActionListenerChangeEtu.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ETU/Controller/ActionListenerChangeEtu.java
|
||||
|
||||
${BUILD}/ETU/Controller/ControllerGroupeBChangement.class : ${SRC}/ETU/Controller/ControllerGroupeBChangement.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ETU/Controller/ControllerGroupeBChangement.java
|
||||
|
||||
${BUILD}/ETU/Controller/ObservateurFenetre.class : ${SRC}/ETU/Controller/ObservateurFenetre.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ETU/Controller/ObservateurFenetre.java
|
||||
|
||||
${BUILD}/ETU/Controller/ObservateurChangeGroupe.class : ${SRC}/ETU/Controller/ObservateurChangeGroupe.java \
|
||||
${BUILD}/ETU/Controller/ControllerGroupeBChangement.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ETU/Controller/ObservateurChangeGroupe.java
|
||||
|
||||
##....
|
||||
|
||||
|
||||
## Model ###
|
||||
|
||||
${BUILD}/ETU/Model/Model.class : ${SRC}/ETU/Model/Model.java \
|
||||
${BUILD}/ETU/Model/ModelEtu.class : ${SRC}/ETU/Model/ModelEtu.java \
|
||||
${BUILD}/API/Model.class \
|
||||
${BUILD}/ETU/View/FenetreGroupe.class \
|
||||
${BUILD}/ETU/View/FenetreEtudiant.class \
|
||||
${BUILD}/Permanent/View/Chargement.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ETU/Model/Model.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ETU/Model/ModelEtu.java
|
||||
|
||||
|
||||
## Permanent ##
|
||||
@ -230,8 +211,8 @@ ${BUILD}/ETU/Model/Model.class : ${SRC}/ETU/Model/Model.java \
|
||||
${BUILD}/MNP/ChangementNP.class \
|
||||
${BUILD}/MNP/AbstractGroupeFactoryNP.class \
|
||||
${BUILD}/MNP/AbstractChangementFactoryNP.class \
|
||||
${BUILD}/ROOT/Model/Model.class \
|
||||
${BUILD}/ETU/Model/Model.class \
|
||||
${BUILD}/ROOT/Model/ModelRoot.class \
|
||||
${BUILD}/ETU/Model/ModelEtu.class \
|
||||
${BUILD}/Permanent/View/Connexion.class \
|
||||
${BUILD}/Permanent/Util/User.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Permanent/TestTexteMNP.java
|
||||
@ -248,6 +229,21 @@ ${BUILD}/Permanent/View/Connexion.class : ${SRC}/Permanent/View/Connexion.java
|
||||
${BUILD}/Permanent/Util/User.class : ${SRC}/Permanent/Util/User.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Permanent/Util/User.java
|
||||
|
||||
## Controller ##
|
||||
|
||||
${BUILD}/Permanent/Controller/ObservateurFenetre.class : ${SRC}/Permanent/Controller/ObservateurFenetre.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Permanent/Controller/ObservateurFenetre.java
|
||||
|
||||
${BUILD}/Permanent/Controller/ObservateurChangeGroupe.class : ${SRC}/Permanent/Controller/ObservateurChangeGroupe.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Permanent/Controller/ObservateurChangeGroupe.java
|
||||
|
||||
${BUILD}/Permanent/Controller/ActionListenerChangeEtu.class : ${SRC}/Permanent/Controller/ActionListenerChangeEtu.java \
|
||||
${BUILD}/Permanent/Controller/ControllerGroupeBChangement.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Permanent/Controller/ActionListenerChangeEtu.java
|
||||
|
||||
${BUILD}/Permanent/Controller/ControllerGroupeBChangement.class : ${SRC}/Permanent/Controller/ControllerGroupeBChangement.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/Permanent/Controller/ControllerGroupeBChangement.java
|
||||
|
||||
# ## JARS ##
|
||||
|
||||
${JAR_MNP} : ${BUILD}/Permanent/TestTexteMNP.class
|
||||
|
@ -51,5 +51,19 @@ public interface AbstractChangementFactory {
|
||||
*
|
||||
*/
|
||||
public void createChangement(Groupe A, Etudiant e, Groupe B);
|
||||
|
||||
|
||||
/**
|
||||
* permet d'ajouter un nouveau changement de type 2
|
||||
*
|
||||
* @param A groupe actuel
|
||||
* @param B groupe demandé
|
||||
* @param e étudiant concerné par le changement
|
||||
*@param raison la raison du changement de type 2
|
||||
* @throws java.lang.NullPointerException si un argument est null
|
||||
* @throws java.lang.IllegalArgumentException si les groupes ou l'étudiant ne sont pas connus de la factory partenaire, ou e n'appartient pas à A ou A et B ne sont pas frères dans l'arbre des groupes.
|
||||
*
|
||||
*/
|
||||
public void createChangement(Groupe A, Etudiant e, Groupe B, String raison);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.API;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Une demande de changement de groupe
|
||||
* concerne un étudiant, qui est dans un groupe A et veut aller dans un groupe B.
|
||||
@ -33,6 +33,10 @@ public interface Changement extends MonPrint {
|
||||
public Etudiant getEtu();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getRaison();
|
||||
/**
|
||||
* @see MonPrint
|
||||
* NB. On n'utilise le mécanisme des méthodes par défaut pour donner du code dans une interface. C'est un petit peu laid et à contre-emploi mais pratique ici.
|
||||
|
111
java/APIGroupe/src/fr/iutfbleau/projetIHM2022FI2/API/Model.java
Normal file
111
java/APIGroupe/src/fr/iutfbleau/projetIHM2022FI2/API/Model.java
Normal file
@ -0,0 +1,111 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.API;
|
||||
|
||||
import java.util.Set;
|
||||
import javax.swing.JFrame;
|
||||
public interface Model {
|
||||
/**
|
||||
* Fonction pour refresh/changer de groupe d'affichage
|
||||
* @param g le groupe a afficher
|
||||
*/
|
||||
public void showGroupe(Groupe g);
|
||||
/**
|
||||
* getteur de la fenetre
|
||||
* @return JFrame la fenetre
|
||||
*/
|
||||
public JFrame getFenetre();
|
||||
|
||||
public Set<Etudiant> getEtudiant();
|
||||
|
||||
// ***********************
|
||||
// FONCTION POUR SUPRIMER UN ETUDIANT
|
||||
// ***********************
|
||||
|
||||
public boolean deleteEtu(Etudiant e);
|
||||
|
||||
|
||||
// ***********************
|
||||
// FONCTION POUR Ajouter UN ETUDIANT
|
||||
// ***********************
|
||||
|
||||
/**
|
||||
* Fonction pour ajouter un étudiant au groupe
|
||||
* @param g
|
||||
* @param e
|
||||
* @return boolean pour savoir si il a pus être ajouter
|
||||
*/
|
||||
public boolean addEtudiant(Groupe g, Etudiant e);
|
||||
|
||||
|
||||
|
||||
// ***********************
|
||||
// FONCTION POUR SUPRIMER UN GROUPE
|
||||
// ***********************
|
||||
|
||||
/**
|
||||
* Fonction pour supprimer un groupe
|
||||
* @param g le groupe a supprimer
|
||||
*/
|
||||
public void delete(Groupe g);
|
||||
|
||||
// ***********************
|
||||
// FONCTION POUR RENOMER UN GROUPE
|
||||
// ***********************
|
||||
|
||||
/**
|
||||
* Fonction pour renomer un groupe
|
||||
* @param name
|
||||
* @param g
|
||||
*/
|
||||
public void rename(String name, Groupe g);
|
||||
|
||||
|
||||
// **********************
|
||||
// FONCTION POUR CREER UN GROUPE
|
||||
// **********************
|
||||
|
||||
|
||||
/**
|
||||
* Fonction permetant de créer une partition d'un groupe
|
||||
* @param g le groupe a partitionner
|
||||
* @param n le nombre de partition
|
||||
* @param name le nom des partition
|
||||
*/
|
||||
public void partition(Groupe g, int n, String name);
|
||||
|
||||
/**
|
||||
* Fonction permettant de créer un sous-groupe d'un groupe
|
||||
* @param g le groupe parent
|
||||
* @param name le nom du sous-groupe
|
||||
* @param min le nombre min d'etudiant
|
||||
* @param max le nombre max d'etudiant
|
||||
* @param ajout la liste des étudiants a ajouter au groupe
|
||||
*/
|
||||
public void free(Groupe g, String name, int min, int max, Set<Etudiant> ajout);
|
||||
|
||||
/**
|
||||
* ajoute une nouvelle promotion
|
||||
* @param min le nombre min
|
||||
* @param max le nombre max
|
||||
* @param name le nom
|
||||
* @param ajout les etudiant a ajouter a la promo
|
||||
*/
|
||||
public void addPromo(int min, int max, String name, Set<Etudiant> ajout);
|
||||
|
||||
// **************************
|
||||
// FONCTION POUR LES CHANGEMENTS
|
||||
// ******************************
|
||||
|
||||
/**
|
||||
* Créer un changement depuis le groupe courant
|
||||
* @param e l'etudiant
|
||||
* @param b le groupe a changer
|
||||
*/
|
||||
public void changeGroupe(Etudiant e, Groupe b);
|
||||
|
||||
/**
|
||||
* Retourn les groupe auquel on peut demander a changer depuis le groupe courant
|
||||
*
|
||||
* @return la liste des groupes
|
||||
*/
|
||||
public Set<Groupe> getGroupePartition();
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ETU.Controller;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class ObservateurFenetre implements WindowListener{
|
||||
|
||||
public ObservateurFenetre(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
JFrame fenetre= (JFrame) e.getSource();
|
||||
int confirmation = JOptionPane.showConfirmDialog(fenetre.getContentPane(), "Voulez vous quitter?", "Quitter", JOptionPane.YES_NO_OPTION);
|
||||
if(confirmation == JOptionPane.YES_OPTION){
|
||||
fenetre.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeiconified(WindowEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowIconified(WindowEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -8,17 +8,18 @@ import fr.iutfbleau.projetIHM2022FI2.API.AbstractGroupeFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.MNP.AbstractChangementFactoryNP;
|
||||
import fr.iutfbleau.projetIHM2022FI2.MNP.AbstractGroupeFactoryNP;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.Controller.ObservateurFenetre;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.View.Chargement;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.Controller.ObservateurFenetre;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.View.FenetreEtudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.View.FenetreGroupe;
|
||||
|
||||
/**
|
||||
* Le Model de L'IHM
|
||||
*/
|
||||
public class Model{
|
||||
public class ModelEtu implements Model{
|
||||
|
||||
private JPanel panGroupe;
|
||||
private FenetreGroupe fenGr;
|
||||
@ -28,7 +29,7 @@ public class Model{
|
||||
private JFrame fenetre;
|
||||
private Etudiant Selected;
|
||||
|
||||
public Model(){
|
||||
public ModelEtu(){
|
||||
this.fenetre=new JFrame();
|
||||
this.fenetre.setSize(1200, 720);
|
||||
this.fenetre.setLocation(100,100);
|
||||
@ -62,25 +63,27 @@ public class Model{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fonction pour refresh/changer de groupe d'affichage
|
||||
* @param g le groupe a afficher
|
||||
*/
|
||||
public void showGroupe(Groupe g){
|
||||
if(g!=null)
|
||||
g=this.promo .refreshALL(g);
|
||||
this.panGroupe.removeAll();
|
||||
this.fenGr=new FenetreGroupe(g, this, this.promo.getGroupesOfEtudiant(this.Selected));
|
||||
this.fenEtu=new FenetreEtudiant(g, this.Selected, this);
|
||||
this.fenetre.getContentPane().removeAll();
|
||||
this.panGroupe.add(this.fenGr.getPan());
|
||||
this.panGroupe.revalidate();
|
||||
this.fenetre.add(this.panGroupe);
|
||||
JScrollPane scroll=new JScrollPane(this.fenEtu.getPan());
|
||||
scroll.getVerticalScrollBar().setUnitIncrement(15);
|
||||
this.fenetre.add(scroll);
|
||||
this.fenetre.revalidate();
|
||||
}
|
||||
@Override
|
||||
/**
|
||||
* Fonction pour refresh/changer de groupe d'affichage
|
||||
* @param g le groupe a afficher
|
||||
*/
|
||||
public void showGroupe(Groupe g){
|
||||
if(g!=null)
|
||||
g=this.promo .refreshALL(g);
|
||||
this.panGroupe.removeAll();
|
||||
this.fenGr=new FenetreGroupe(g, this, this.promo.getGroupesOfEtudiant(this.Selected));
|
||||
this.fenEtu=new FenetreEtudiant(g, this.Selected, this);
|
||||
this.fenetre.getContentPane().removeAll();
|
||||
this.panGroupe.add(this.fenGr.getPan());
|
||||
this.panGroupe.revalidate();
|
||||
this.fenetre.add(this.panGroupe);
|
||||
JScrollPane scroll=new JScrollPane(this.fenEtu.getPan());
|
||||
scroll.getVerticalScrollBar().setUnitIncrement(15);
|
||||
this.fenetre.add(scroll);
|
||||
this.fenetre.revalidate();
|
||||
}
|
||||
@Override
|
||||
/**
|
||||
* getteur de la fenetre
|
||||
* @return JFrame la fenetre
|
||||
@ -89,9 +92,10 @@ public void showGroupe(Groupe g){
|
||||
return fenetre;
|
||||
}
|
||||
|
||||
public Set<Etudiant> getEtudiant(){
|
||||
return this.promo.getPromotion().getEtudiants();
|
||||
}
|
||||
@Override
|
||||
public Set<Etudiant> getEtudiant(){
|
||||
return this.promo.getPromotion().getEtudiants();
|
||||
}
|
||||
|
||||
private void initEtu(String err){
|
||||
Set<Etudiant> liste=this.promo.getPromotion().getEtudiants();
|
||||
@ -127,18 +131,38 @@ public void showGroupe(Groupe g){
|
||||
// **************************
|
||||
// FONCTION POUR LES CHANGEMENTS
|
||||
// ******************************
|
||||
|
||||
@Override
|
||||
public void changeGroupe(Etudiant e, Groupe b){
|
||||
if(b==null)
|
||||
return;
|
||||
b=this.promo.refreshALL(b);
|
||||
if(b.getEtudiants()!=null && b.getMax()>b.getEtudiants().size()+1){
|
||||
this.changement.createChangement(this.fenGr.getG(), e, b);
|
||||
if(b.getEtudiants().size()>this.fenGr.getG().getEtudiants().size()){
|
||||
JPanel myPanel= new JPanel(new GridLayout(2,1));
|
||||
JTextField xField = new JTextField(100);
|
||||
xField.setMinimumSize(new Dimension(100, 100));
|
||||
xField.setPreferredSize(new Dimension(100,100));
|
||||
myPanel.add(new JLabel("Ce Groupe est plus grand que le votre raison du changement:"));
|
||||
myPanel.add(xField);
|
||||
if(JOptionPane.showConfirmDialog(this.fenetre, myPanel, "Changer dans quel Groupe ?", JOptionPane.OK_CANCEL_OPTION)==JOptionPane.OK_OPTION){
|
||||
//IL faut que l'etudiant detaile un minimun la raison
|
||||
if(xField.getText().length()>5){
|
||||
this.changement.createChangement(this.fenGr.getG(), e, b, xField.getText());
|
||||
}else{
|
||||
JOptionPane.showMessageDialog(this.fenetre, "veuillez detailler votre raison", "erreur", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this.changement.createChangement(this.fenGr.getG(), e, b);
|
||||
}
|
||||
}else{
|
||||
JOptionPane.showMessageDialog(this.fenetre, "impossible trop d'etudiant dans l'autre Groupe", "erreur", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
this.showGroupe(this.fenGr.getG());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Groupe> getGroupePartition(){
|
||||
this.promo.refreshALL(this.fenGr.getG().getPointPoint());
|
||||
Set<Groupe> retour=new HashSet<>();
|
||||
@ -152,4 +176,52 @@ public void showGroupe(Groupe g){
|
||||
return retour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addEtudiant(Groupe g, Etudiant e) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(Groupe g) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void rename(String name, Groupe g) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void partition(Groupe g, int n, String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void free(Groupe g, String name, int min, int max, Set<Etudiant> ajout) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addPromo(int min, int max, String name, Set<Etudiant> ajout) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean deleteEtu(Etudiant e) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -11,8 +11,8 @@ import java.util.Set;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.Model.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.Controller.ActionListenerChangeEtu;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.Controller.ActionListenerChangeEtu;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
|
||||
|
||||
public class FenetreEtudiant{
|
||||
|
@ -8,8 +8,9 @@ import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.Model.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.Controller.ObservateurChangeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.Controller.ObservateurChangeGroupe;
|
||||
|
||||
import java.util.Set;
|
||||
import java.awt.Color;
|
||||
|
||||
@ -54,9 +55,11 @@ public class FenetreGroupe{
|
||||
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()),JLabel.CENTER));
|
||||
this.pan.add(new JLabel("max= "+String.valueOf(g.getMax()),JLabel.CENTER));
|
||||
this.pan.add(new JLabel(g.getType().name(), 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));
|
||||
this.pan.add(refresh);
|
||||
this.pan.add(new JLabel("Type: "+g.getType().name(), 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));
|
||||
|
@ -24,6 +24,5 @@ public class PanelEtudiant extends JPanel{
|
||||
|
||||
public void addActionChangeListener(ActionListener a){
|
||||
this.deplacer.addActionListener(a);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -162,6 +162,55 @@ public class AbstractChangementFactoryNP implements AbstractChangementFactory {
|
||||
this.close(cnx);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* permet d'ajouter un nouveau changement. de type 2
|
||||
*
|
||||
* @param A groupe actuel
|
||||
* @param B groupe demandé
|
||||
* @param e étudiant concerné par le changement
|
||||
* @param raison la raison du changement de type 2
|
||||
* @throws java.lang.NullPointerException si un argument est null
|
||||
* @throws java.lang.IllegalArgumentException si les groupes ou l'étudiant ne sont pas connus de la factory partenaire, ou e n'appartient pas à A ou A et B ne sont pas frères dans l'arbre des groupes.
|
||||
*
|
||||
*/
|
||||
public void createChangement(Groupe A, Etudiant e, Groupe B, String raison){
|
||||
Objects.requireNonNull(A,"Le groupe d'origine ne peut pas être null");
|
||||
Objects.requireNonNull(B,"Le groupe d'arrivée ne peut pas être null");
|
||||
Objects.requireNonNull(e,"L'étudiant ne peut pas être null");
|
||||
Changement c = new ChangementNP(A,e,B, raison);
|
||||
this.brain.put(Integer.valueOf(c.getId()),c);
|
||||
Connection cnx=this.cnx();
|
||||
try{
|
||||
PreparedStatement pst=cnx.prepareStatement("SELECT * FROM `Changement` where `idGroupeA`=? AND `idGroupeB`=? AND `idEtudiant`=?; ");
|
||||
pst.setInt(1, A.getId());
|
||||
pst.setInt(2, B.getId());
|
||||
pst.setInt(3, e.getId());
|
||||
if(!pst.executeQuery().next()){
|
||||
pst.close();
|
||||
pst=cnx.prepareStatement("INSERT INTO `Changement` (`id`, `idGroupeA`, `idGroupeB`, `idEtudiant`, `Raison`) VALUES (?, ?, ?, ?, ?);");
|
||||
pst.setInt(1, c.getId());
|
||||
pst.setInt(2, A.getId());
|
||||
pst.setInt(3, B.getId());
|
||||
pst.setInt(4, e.getId());
|
||||
pst.setString(5, raison);
|
||||
pst.executeUpdate();
|
||||
pst.close();
|
||||
}else{
|
||||
pst.close();
|
||||
JOptionPane.showMessageDialog(this.fenetre, "Vous Avez deja demander a Chnager dans ce Groupe", "erreur", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}catch(SQLException er){
|
||||
System.out.println(er.toString());
|
||||
if(this.erreurSQL()){
|
||||
this.createChangement(A, e, B, raison);
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.close(cnx);
|
||||
}
|
||||
|
||||
|
||||
// **********************
|
||||
// FONCTION POUR SIMPLIFIER LES Modification BD
|
||||
@ -218,8 +267,12 @@ public class AbstractChangementFactoryNP implements AbstractChangementFactory {
|
||||
while(rs.next()){
|
||||
Groupe[] ab=new Groupe[2];
|
||||
this.getGroupe(rs.getInt(2), rs.getInt(3), ab, this.agf.getPromotion());
|
||||
Etudiant e=new EtudiantNP(rs.getString(5), rs.getString(6), rs.getInt(4));
|
||||
this.brain.put(rs.getInt(1), new ChangementNP(ab[0], e, ab[1], rs.getInt(1)));
|
||||
Etudiant e=new EtudiantNP(rs.getString(6), rs.getString(7), rs.getInt(4));
|
||||
if(rs.getString(5)!=null){
|
||||
this.brain.put(rs.getInt(1), new ChangementNP(ab[0], e, ab[1], rs.getInt(1), rs.getString(5)));
|
||||
}else{
|
||||
this.brain.put(rs.getInt(1), new ChangementNP(ab[0], e, ab[1], rs.getInt(1)));
|
||||
}
|
||||
}
|
||||
pst.close();
|
||||
}catch(SQLException e){
|
||||
|
@ -249,9 +249,30 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
*/
|
||||
public Set<Etudiant> getEtudiants(String nomEtu){
|
||||
Set<Etudiant> s=new LinkedHashSet<>();
|
||||
for(Etudiant e:this.getPromotion().getEtudiants()){
|
||||
if((e.getNom()).contains(nomEtu)){
|
||||
s.add(e);
|
||||
//on retourne tous les etudiants
|
||||
if(nomEtu==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;");
|
||||
ResultSet rs=pst.executeQuery();
|
||||
while(rs.next()){
|
||||
s.add(new EtudiantNP(rs.getString(2), rs.getString(3), rs.getInt(1)));
|
||||
}
|
||||
}catch(SQLException e){
|
||||
if(this.erreurCO())
|
||||
return this.getEtudiants(nomEtu);
|
||||
return null;
|
||||
}
|
||||
this.close(cnx);
|
||||
}else{
|
||||
for(Etudiant e:this.getPromotion().getEtudiants()){
|
||||
if((e.getNom()).contains(nomEtu)){
|
||||
s.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return s;
|
||||
@ -268,16 +289,21 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
public Set<Groupe> getGroupesOfEtudiant(Etudiant etu){
|
||||
if(etu==null)
|
||||
throw new NullPointerException();
|
||||
Collection<Groupe> s= this.brain.values();
|
||||
Set<Groupe> ret=new LinkedHashSet<Groupe>();
|
||||
for(Groupe g: s){
|
||||
for(Etudiant e: g.getEtudiants()){
|
||||
if(etu==e){
|
||||
ret.add(g);
|
||||
break;
|
||||
}
|
||||
Connection cnx=this.cnx();
|
||||
try{
|
||||
PreparedStatement pst=cnx.prepareStatement("SELECT `idGroupe` FROM CONTIENT where idEt=? Group by `idGroupe`;");
|
||||
pst.setInt(1, etu.getId());
|
||||
ResultSet rs=pst.executeQuery();
|
||||
while(rs.next()){
|
||||
ret.add(this.brain.get(rs.getInt(1)));
|
||||
}
|
||||
rs.close();
|
||||
pst.close();
|
||||
}catch(SQLException e){
|
||||
|
||||
}
|
||||
this.close(cnx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -541,29 +567,29 @@ private boolean saveEtu(Etudiant etudiant, Groupe g){
|
||||
*/
|
||||
private void addBDEtudiant(Groupe g, Connection cnx){
|
||||
try{
|
||||
//On récupère les etudiants contenue du groupe
|
||||
PreparedStatement pst;
|
||||
//Si c'est la promo
|
||||
pst= cnx.prepareStatement("SELECT Etudiant.nom, Etudiant.prenom, Etudiant.id FROM `CONTIENT` JOIN Etudiant on CONTIENT.idEt=Etudiant.id WHERE CONTIENT.idGroupe=? ORDER BY Etudiant.id ASC");
|
||||
pst.setInt(1, g.getId());
|
||||
ResultSet rs=pst.executeQuery();
|
||||
//Pour tous les étudiants
|
||||
while(rs.next()){
|
||||
boolean exist=false;
|
||||
//autrement on recupere l'etudiant
|
||||
for(Etudiant e: g.getPointPoint().getEtudiants()){
|
||||
if(e.getId()==rs.getInt(3)){
|
||||
exist=true;
|
||||
g.addEtudiant(e);
|
||||
break;
|
||||
//On récupère les etudiants contenue du groupe
|
||||
PreparedStatement pst;
|
||||
//Si c'est la promo
|
||||
pst= cnx.prepareStatement("SELECT Etudiant.nom, Etudiant.prenom, Etudiant.id FROM `CONTIENT` JOIN Etudiant on CONTIENT.idEt=Etudiant.id WHERE CONTIENT.idGroupe=? ORDER BY Etudiant.id ASC");
|
||||
pst.setInt(1, g.getId());
|
||||
ResultSet rs=pst.executeQuery();
|
||||
//Pour tous les étudiants
|
||||
while(rs.next()){
|
||||
boolean exist=false;
|
||||
//autrement on recupere l'etudiant
|
||||
for(Etudiant e: g.getPointPoint().getEtudiants()){
|
||||
if(e.getId()==rs.getInt(3)){
|
||||
exist=true;
|
||||
g.addEtudiant(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(exist==false){
|
||||
g.addEtudiant(new EtudiantNP(rs.getString(1), rs.getString(2), rs.getInt(3)));
|
||||
}
|
||||
}
|
||||
if(exist==false){
|
||||
g.addEtudiant(new EtudiantNP(rs.getString(1), rs.getString(2), rs.getInt(3)));
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
pst.close();
|
||||
rs.close();
|
||||
pst.close();
|
||||
}catch(SQLException e){
|
||||
if(this.erreurCO())
|
||||
this.addBDEtudiant(g, cnx);
|
||||
|
@ -12,7 +12,7 @@ public class ChangementNP implements Changement {
|
||||
|
||||
//auto-incrément des changements
|
||||
private static int nextId=0;
|
||||
|
||||
private String raison;
|
||||
private int id;
|
||||
private Groupe a,b;
|
||||
private Etudiant e;
|
||||
@ -21,7 +21,18 @@ public class ChangementNP implements Changement {
|
||||
Objects.requireNonNull(a,"On ne peut pas créer un changement avec un groupe à quitter null");
|
||||
Objects.requireNonNull(b,"On ne peut pas créer un changement avec un groupe à rejoindre null");
|
||||
Objects.requireNonNull(e,"On ne peut pas créer un changement concernant un étudiant null");
|
||||
this.raison=null;
|
||||
this.id=++this.nextId;
|
||||
this.a=a;
|
||||
this.b=b;
|
||||
this.e=e;
|
||||
}
|
||||
|
||||
public ChangementNP(Groupe a, Etudiant e, Groupe b, String raison){
|
||||
Objects.requireNonNull(a,"On ne peut pas créer un changement avec un groupe à quitter null");
|
||||
Objects.requireNonNull(b,"On ne peut pas créer un changement avec un groupe à rejoindre null");
|
||||
Objects.requireNonNull(e,"On ne peut pas créer un changement concernant un étudiant null");
|
||||
this.raison=raison;
|
||||
this.id=++this.nextId;
|
||||
this.a=a;
|
||||
this.b=b;
|
||||
@ -41,6 +52,20 @@ public class ChangementNP implements Changement {
|
||||
this.nextId=this.id;
|
||||
}
|
||||
}
|
||||
|
||||
public ChangementNP(Groupe a, Etudiant e, Groupe b, int id, String raison){
|
||||
Objects.requireNonNull(a,"On ne peut pas créer un changement avec un groupe à quitter null");
|
||||
Objects.requireNonNull(b,"On ne peut pas créer un changement avec un groupe à rejoindre null");
|
||||
Objects.requireNonNull(e,"On ne peut pas créer un changement concernant un étudiant null");
|
||||
this.raison=raison;
|
||||
this.id=id;
|
||||
this.a=a;
|
||||
this.b=b;
|
||||
this.e=e;
|
||||
if(this.id>this.nextId){
|
||||
this.nextId=this.id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* permet de récupérer l'identifiant du changement (référence interne sans intérêt irl).
|
||||
@ -73,4 +98,9 @@ public class ChangementNP implements Changement {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRaison() {
|
||||
return this.raison;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ETU.Controller;
|
||||
package fr.iutfbleau.projetIHM2022FI2.Permanent.Controller;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.HashSet;
|
||||
@ -13,7 +13,7 @@ import java.awt.GridLayout;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.Model.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
|
||||
public class ActionListenerChangeEtu implements ActionListener {
|
||||
private Etudiant etudiant;
|
@ -1,4 +1,4 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ETU.Controller;
|
||||
package fr.iutfbleau.projetIHM2022FI2.Permanent.Controller;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
@ -1,9 +1,9 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ETU.Controller;
|
||||
package fr.iutfbleau.projetIHM2022FI2.Permanent.Controller;
|
||||
|
||||
import java.awt.event.*;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ETU.Model.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
|
||||
public class ObservateurChangeGroupe implements ActionListener{
|
||||
private Model m;
|
@ -1,4 +1,4 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.Controller;
|
||||
package fr.iutfbleau.projetIHM2022FI2.Permanent.Controller;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
import javax.swing.JOptionPane;
|
@ -10,10 +10,10 @@ public class TestTexteMNP{
|
||||
User chois=Connexion.seConnecter();
|
||||
if(chois!=null){
|
||||
if(chois==User.ROOT){
|
||||
new fr.iutfbleau.projetIHM2022FI2.ROOT.Model.Model();
|
||||
new fr.iutfbleau.projetIHM2022FI2.ROOT.Model.ModelRoot();
|
||||
}
|
||||
if(chois==User.ETUDIANT){
|
||||
new fr.iutfbleau.projetIHM2022FI2.ETU.Model.Model();
|
||||
new fr.iutfbleau.projetIHM2022FI2.ETU.Model.ModelEtu();
|
||||
}
|
||||
if(chois==User.PROF){
|
||||
|
||||
|
@ -1,20 +0,0 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.Controller;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.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());
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,7 @@ import java.awt.event.ActionListener;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Model.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
public class ActionListenerSuprEtu implements ActionListener {
|
||||
public Etudiant etudiant;
|
||||
public Model model;
|
||||
|
@ -1,21 +0,0 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.Controller;
|
||||
|
||||
import java.awt.event.*;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Model.Model;
|
||||
|
||||
public class ObservateurChangeGroupe implements ActionListener{
|
||||
private Model m;
|
||||
private Groupe g;
|
||||
public ObservateurChangeGroupe(Model m, Groupe g){
|
||||
this.m=m;
|
||||
this.g=g;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
m.showGroupe(this.g);
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,7 @@ import java.util.LinkedHashSet;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.*;
|
||||
import javax.swing.JOptionPane;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Model.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.View.FenetreSelectionEtu;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -1,27 +1,34 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.Model;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.AbstractChangementFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.AbstractGroupeFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.MNP.AbstractChangementFactoryNP;
|
||||
import fr.iutfbleau.projetIHM2022FI2.MNP.AbstractGroupeFactoryNP;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.Controller.ObservateurFenetre;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.View.Chargement;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ObservateurFenetre;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.View.FenetreEtudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.View.FenetreGroupe;
|
||||
|
||||
/**
|
||||
* Le Model de L'IHM
|
||||
*/
|
||||
public class Model{
|
||||
public class ModelRoot implements Model{
|
||||
|
||||
private JPanel panGroupe;
|
||||
private FenetreGroupe fenGr;
|
||||
private FenetreEtudiant fenEtu;
|
||||
private AbstractGroupeFactory promo;
|
||||
private AbstractChangementFactory changement;
|
||||
private JFrame fenetre;
|
||||
public Model(){
|
||||
public ModelRoot(){
|
||||
this.fenetre=new JFrame();
|
||||
this.fenetre.setSize(1200, 720);
|
||||
this.fenetre.setLocation(100,100);
|
||||
@ -42,6 +49,7 @@ public class Model{
|
||||
}else{
|
||||
this.fenGr=new FenetreGroupe(this.promo.getPromotion(), this);
|
||||
this.fenEtu=new FenetreEtudiant(this.promo.getPromotion(), this);
|
||||
this.changement=new AbstractChangementFactoryNP(this.promo, this.fenetre);
|
||||
}
|
||||
this.panGroupe=new JPanel(new GridLayout(1,1));
|
||||
if(this.promo!=null){
|
||||
@ -51,25 +59,27 @@ public class Model{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction pour refresh/changer de groupe d'affichage
|
||||
* @param g le groupe a afficher
|
||||
*/
|
||||
public void showGroupe(Groupe g){
|
||||
if(g!=null)
|
||||
g=this.promo.refreshALL(g);
|
||||
this.panGroupe.removeAll();
|
||||
this.fenGr=new FenetreGroupe(g, this);
|
||||
this.fenEtu=new FenetreEtudiant(g, this);
|
||||
this.fenetre.getContentPane().removeAll();
|
||||
this.panGroupe.add(this.fenGr.getPan());
|
||||
this.panGroupe.revalidate();
|
||||
this.fenetre.add(this.panGroupe);
|
||||
JScrollPane scroll=new JScrollPane(this.fenEtu.getPan());
|
||||
scroll.getVerticalScrollBar().setUnitIncrement(15);
|
||||
this.fenetre.add(scroll);
|
||||
this.fenetre.revalidate();
|
||||
}
|
||||
@Override
|
||||
/**
|
||||
* Fonction pour refresh/changer de groupe d'affichage
|
||||
* @param g le groupe a afficher
|
||||
*/
|
||||
public void showGroupe(Groupe g){
|
||||
if(g!=null)
|
||||
g=this.promo.refreshALL(g);
|
||||
this.panGroupe.removeAll();
|
||||
this.fenGr=new FenetreGroupe(g, this);
|
||||
this.fenEtu=new FenetreEtudiant(g, this);
|
||||
this.fenetre.getContentPane().removeAll();
|
||||
this.panGroupe.add(this.fenGr.getPan());
|
||||
this.panGroupe.revalidate();
|
||||
this.fenetre.add(this.panGroupe);
|
||||
JScrollPane scroll=new JScrollPane(this.fenEtu.getPan());
|
||||
scroll.getVerticalScrollBar().setUnitIncrement(15);
|
||||
this.fenetre.add(scroll);
|
||||
this.fenetre.revalidate();
|
||||
}
|
||||
@Override
|
||||
/**
|
||||
* getteur de la fenetre
|
||||
* @return JFrame la fenetre
|
||||
@ -77,16 +87,17 @@ public void showGroupe(Groupe g){
|
||||
public JFrame getFenetre() {
|
||||
return fenetre;
|
||||
}
|
||||
|
||||
public Set<Etudiant> getEtudiant(){
|
||||
return this.promo.getPromotion().getEtudiants();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Etudiant> getEtudiant(){
|
||||
return this.promo.getEtudiants(null);
|
||||
}
|
||||
|
||||
// ***********************
|
||||
// FONCTION POUR SUPRIMER UN ETUDIANT
|
||||
// ***********************
|
||||
|
||||
|
||||
@Override
|
||||
public boolean deleteEtu(Etudiant e){
|
||||
if(this.deleteEtutoChildren(e, this.fenGr.getG())){
|
||||
this.promo.dropFromGroupe(this.fenGr.getG(), e);
|
||||
@ -112,7 +123,7 @@ public void showGroupe(Groupe g){
|
||||
// ***********************
|
||||
// FONCTION POUR Ajouter UN ETUDIANT
|
||||
// ***********************
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Fonction pour ajouter un étudiant au groupe
|
||||
* @param g
|
||||
@ -129,6 +140,7 @@ public void showGroupe(Groupe g){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fonction recursive pour ajouter l'etudiant a ses parents si il ne l'ont pas
|
||||
* @param g groupe
|
||||
@ -156,7 +168,7 @@ public void showGroupe(Groupe g){
|
||||
// ***********************
|
||||
// FONCTION POUR SUPRIMER UN GROUPE
|
||||
// ***********************
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Fonction pour supprimer un groupe
|
||||
* @param g le groupe a supprimer
|
||||
@ -183,6 +195,7 @@ public void showGroupe(Groupe g){
|
||||
// FONCTION POUR RENOMER UN GROUPE
|
||||
// ***********************
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Fonction pour renomer un groupe
|
||||
* @param name
|
||||
@ -198,7 +211,7 @@ public void showGroupe(Groupe g){
|
||||
// FONCTION POUR CREER UN GROUPE
|
||||
// **********************
|
||||
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Fonction permetant de créer une partition d'un groupe
|
||||
* @param g le groupe a partitionner
|
||||
@ -214,6 +227,7 @@ public void showGroupe(Groupe g){
|
||||
this.showGroupe(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Fonction permettant de créer un sous-groupe d'un groupe
|
||||
* @param g le groupe parent
|
||||
@ -255,9 +269,11 @@ public void showGroupe(Groupe g){
|
||||
this.showGroupe(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPromo(int min, int max, String name, Set<Etudiant> ajout){
|
||||
Chargement ch=new Chargement(this.fenetre);
|
||||
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();
|
||||
@ -270,4 +286,50 @@ public void showGroupe(Groupe g){
|
||||
this.showGroupe(this.promo.getPromotion());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void changeGroupe(Etudiant e, Groupe b){
|
||||
if(b==null)
|
||||
return;
|
||||
b=this.promo.refreshALL(b);
|
||||
if(b.getEtudiants()!=null && b.getMax()>b.getEtudiants().size()+1){
|
||||
if(b.getEtudiants().size()>this.fenGr.getG().getEtudiants().size()){
|
||||
JPanel myPanel= new JPanel(new GridLayout(2,1));
|
||||
JTextField xField = new JTextField(100);
|
||||
xField.setMinimumSize(new Dimension(100, 100));
|
||||
xField.setPreferredSize(new Dimension(100,100));
|
||||
myPanel.add(new JLabel("Ce Groupe est plus grand que le votre raison du changement:"));
|
||||
myPanel.add(xField);
|
||||
if(JOptionPane.showConfirmDialog(this.fenetre, myPanel, "Changer dans quel Groupe ?", JOptionPane.OK_CANCEL_OPTION)==JOptionPane.OK_OPTION){
|
||||
//IL faut que l'etudiant detaile un minimun la raison
|
||||
if(xField.getText().length()>5){
|
||||
this.changement.createChangement(this.fenGr.getG(), e, b, xField.getText());
|
||||
}else{
|
||||
JOptionPane.showMessageDialog(this.fenetre, "veuillez detailler votre raison", "erreur", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this.changement.createChangement(this.fenGr.getG(), e, b);
|
||||
}
|
||||
}else{
|
||||
JOptionPane.showMessageDialog(this.fenetre, "impossible trop d'etudiant dans l'autre Groupe", "erreur", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
this.showGroupe(this.fenGr.getG());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Groupe> getGroupePartition(){
|
||||
this.promo.refreshALL(this.fenGr.getG().getPointPoint());
|
||||
Set<Groupe> retour=new HashSet<Groupe>();
|
||||
if(this.fenGr.getG().getPointPoint().getType()!=TypeGroupe.PARTITION)
|
||||
throw new IllegalStateException("impossible de changer un étudiant d'un groupe ne provenant pas d'une partition");
|
||||
for(Groupe sous:this.fenGr.getG().getPointPoint().getSousGroupes()){
|
||||
if(sous.getId()!=this.fenGr.getG().getId()){
|
||||
retour.add(sous);
|
||||
}
|
||||
}
|
||||
return retour;
|
||||
}
|
||||
|
||||
}
|
@ -11,9 +11,9 @@ import java.util.Set;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ActionListenerChangeEtu;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.Controller.ActionListenerChangeEtu;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ActionListenerSuprEtu;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Model.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
|
||||
|
||||
public class FenetreEtudiant{
|
||||
|
@ -8,9 +8,9 @@ import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ObservateurChangeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.Controller.ObservateurChangeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ObservateurModifGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Model.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
|
||||
|
||||
public class FenetreGroupe{
|
||||
@ -65,9 +65,11 @@ public class FenetreGroupe{
|
||||
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()),JLabel.CENTER));
|
||||
this.pan.add(new JLabel("max= "+String.valueOf(g.getMax()),JLabel.CENTER));
|
||||
this.pan.add(new JLabel(g.getType().name(), 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));
|
||||
this.pan.add(refresh);
|
||||
this.pan.add(new JLabel("Type: "+g.getType().name(), 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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user