Fin des Fonctionnalités demander, debut debogage et simplification
This commit is contained in:
parent
4e087ad4ba
commit
8dd7db7396
@ -102,6 +102,15 @@ ${BUILD}/MNP/AbstractChangementFactoryNP.class : ${SRC}/MNP/AbstractChangementFa
|
||||
|
||||
## View ##
|
||||
|
||||
${BUILD}/ROOT/View/FindBarFenetre.class : ${SRC}/ROOT/View/FindBarFenetre.java\
|
||||
${BUILD}/ROOT/Controller/ListenerFindBar.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/View/FindBarFenetre.java
|
||||
|
||||
|
||||
${BUILD}/ROOT/View/FenetreChangement.class : ${SRC}/ROOT/View/FenetreChangement.java \
|
||||
${BUILD}/ROOT/Controller/ActionChangement.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/View/FenetreChangement.java
|
||||
|
||||
${BUILD}/ROOT/View/FenetreGroupe.class : ${SRC}/ROOT/View/FenetreGroupe.java \
|
||||
${BUILD}/Permanent/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurChangeGroupe.class \
|
||||
@ -112,7 +121,8 @@ ${BUILD}/ROOT/View/FenetreEtudiant.class :${SRC}/ROOT/View/FenetreEtudiant.java
|
||||
${BUILD}/Permanent/Controller/ObservateurFenetre.class \
|
||||
${BUILD}/Permanent/Controller/ObservateurChangeGroupe.class \
|
||||
${BUILD}/ROOT/View/PanelEtudiant.class \
|
||||
${BUILD}/Permanent/Controller/ActionListenerChangeEtu.class
|
||||
${BUILD}/Permanent/Controller/ActionListenerChangeEtu.class \
|
||||
${BUILD}/ROOT/Controller/ActionListChange.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/View/FenetreEtudiant.java
|
||||
|
||||
${BUILD}/ROOT/View/PanelEtudiant.class : ${SRC}/ROOT/View/PanelEtudiant.java \
|
||||
@ -127,11 +137,16 @@ ${BUILD}/ROOT/View/FenetreSelectionEtu.class : ${SRC}/ROOT/View/FenetreSelection
|
||||
|
||||
|
||||
## Controller ##
|
||||
${BUILD}/ROOT/Controller/ListenerFindBar.class : ${SRC}/ROOT/Controller/ListenerFindBar.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ListenerFindBar.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/ActionChangement.class : ${SRC}/ROOT/Controller/ActionChangement.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ActionChangement.java
|
||||
|
||||
${BUILD}/ROOT/Controller/ObservateurModifGroupe.class : ${SRC}/ROOT/Controller/ObservateurModifGroupe.java \
|
||||
${BUILD}/ROOT/View/FenetreSelectionEtu.class \
|
||||
@ -144,6 +159,9 @@ ${BUILD}/ROOT/Controller/SelecteurEtudiant.class : ${SRC}/ROOT/Controller/Select
|
||||
${BUILD}/ROOT/Controller/ActionListenerNouveauEtu.class : ${SRC}/ROOT/Controller/ActionListenerNouveauEtu.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ActionListenerNouveauEtu.java
|
||||
|
||||
${BUILD}/ROOT/Controller/ActionListChange.class : ${SRC}/ROOT/Controller/ActionListChange.java
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Controller/ActionListChange.java
|
||||
|
||||
##....
|
||||
|
||||
|
||||
@ -153,7 +171,9 @@ ${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
|
||||
${BUILD}/Permanent/View/Chargement.class \
|
||||
${BUILD}/ROOT/View/FenetreChangement.class \
|
||||
${BUILD}/ROOT/View/FindBarFenetre.class
|
||||
${JAVAC} ${JAVAC_OPTIONS} ${SRC}/ROOT/Model/ModelRoot.java
|
||||
|
||||
|
||||
|
@ -108,4 +108,51 @@ public void showGroupe(Groupe g);
|
||||
* @return la liste des groupes
|
||||
*/
|
||||
public Set<Groupe> getGroupePartition();
|
||||
|
||||
/**
|
||||
* Fonction pour afficher une fenetre listnatn les changements
|
||||
*
|
||||
*/
|
||||
public void listChange();
|
||||
|
||||
|
||||
/**
|
||||
* Fonction pour effectuer un changement
|
||||
* @param Changement le changement a effecteur
|
||||
*/
|
||||
public void change(Changement change);
|
||||
|
||||
/**
|
||||
* Fonction supprimant un changement
|
||||
*
|
||||
* @param to_delete la changement a delete
|
||||
*/
|
||||
public void deleteChange(Changement to_delete);
|
||||
|
||||
|
||||
/**
|
||||
* Fonction affichant les raison d'un changement
|
||||
*
|
||||
* @param change le changement
|
||||
*/
|
||||
public void showRaisonChange(Changement change);
|
||||
|
||||
|
||||
/**
|
||||
* Fonction affichant une fentre pour trouver un etudiant et tous ses groupes asociée
|
||||
*/
|
||||
public void findEtu();
|
||||
|
||||
/**
|
||||
* Fonction pour recuperer les etudiant avec ce nom
|
||||
* @param name le nom de(s) etudiants
|
||||
* @return la liste
|
||||
*/
|
||||
public Set<Etudiant> getEtu(String name);
|
||||
|
||||
/**
|
||||
*affiche les groupe d'un etudiant
|
||||
* @param e l'etudiant
|
||||
*/
|
||||
public void showGroupOfEtudiant(Etudiant e);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.AbstractChangementFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.AbstractGroupeFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Changement;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
@ -224,4 +225,52 @@ public class ModelEtu implements Model{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listChange() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void change(Changement change) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteChange(Changement to_delete) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void showRaisonChange(Changement change) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void findEtu() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<Etudiant> getEtu(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void showGroupOfEtudiant(Etudiant e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,8 +57,6 @@ public class FenetreGroupe{
|
||||
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()+"\t || \t id="+String.valueOf(g.getId()), JLabel.CENTER));
|
||||
this.pan.add(new JLabel("Sous groupe:",JLabel.CENTER));
|
||||
|
@ -56,6 +56,7 @@ public class AbstractChangementFactoryNP implements AbstractChangementFactory {
|
||||
* @return l'ensemble de tous les changements en attente
|
||||
*/
|
||||
public Set<Changement> getAllChangements(){
|
||||
this.refresh();
|
||||
// la méthode value() d'un hashmap retourne la collection des valeurs.
|
||||
// Il faut transformer la collection en Set.
|
||||
// Un constructeur de HashSet permet de faire cette opération.
|
||||
@ -85,7 +86,12 @@ public class AbstractChangementFactoryNP implements AbstractChangementFactory {
|
||||
agf.dropFromGroupe(a,e);
|
||||
agf.addToGroupe(b,e);
|
||||
// En cas de succès, on enlève le changement du cerveau
|
||||
this.brain.remove(Integer.valueOf(c.getId()));
|
||||
this.deleteChangement(c);
|
||||
for(Changement ch: this.getAllChangements()){
|
||||
if(ch.getB().getSize()+1==ch.getB().getMax()){
|
||||
this.deleteChangement(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -297,5 +303,10 @@ public class AbstractChangementFactoryNP implements AbstractChangementFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private void refresh(){
|
||||
this.brain=new HashMap<Integer,Changement>();
|
||||
this.getChange();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -265,6 +265,7 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
s.add(new EtudiantNP(rs.getString(2), rs.getString(3), rs.getInt(1)));
|
||||
}
|
||||
}catch(SQLException e){
|
||||
System.out.println(e.toString());
|
||||
if(this.erreurCO())
|
||||
return this.getEtudiants(nomEtu);
|
||||
return null;
|
||||
@ -323,6 +324,7 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
"chaignea", "Chaigneauphpmyadmin");
|
||||
return cnx;
|
||||
}catch(Exception e){
|
||||
System.out.println(e.toString());
|
||||
if(this.erreurCO()==true){
|
||||
return this.cnx();
|
||||
}
|
||||
@ -390,6 +392,7 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
try{
|
||||
clos.close();
|
||||
}catch(Exception e){
|
||||
System.out.println(e.toString());
|
||||
if(this.erreurCO()==true)
|
||||
this.close(clos);
|
||||
}
|
||||
@ -503,7 +506,6 @@ private boolean saveEtu(Etudiant etudiant, Groupe g){
|
||||
"SELECT `id`, `nom`, `min`, `max`, `value`, `id-parent` FROM `Groupe` join `TYPE` on Groupe.Type=TYPE.name ORDER BY Groupe.id ASC;");
|
||||
ResultSet rs = pst.executeQuery();
|
||||
rs=pst.executeQuery();
|
||||
try{
|
||||
//Si il existe bien une promotion
|
||||
if(rs.next()){
|
||||
//On créer le groupe de promo
|
||||
@ -520,11 +522,12 @@ private boolean saveEtu(Etudiant etudiant, Groupe g){
|
||||
//Si aucune ligne et donc pas de promo:
|
||||
this.promo=null;
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
rs.close();
|
||||
pst.close();
|
||||
}catch(SQLException e){
|
||||
System.out.println(e.toString());
|
||||
if(this.erreurCO())
|
||||
this.init();
|
||||
}
|
||||
this.close(cnx);
|
||||
}
|
||||
@ -557,6 +560,7 @@ private boolean saveEtu(Etudiant etudiant, Groupe g){
|
||||
}
|
||||
rs.close();
|
||||
}catch(SQLException e){
|
||||
System.out.println(e);
|
||||
if(this.erreurCO())
|
||||
this.addSousGroupe(g, cnx);
|
||||
}
|
||||
@ -593,6 +597,7 @@ private boolean saveEtu(Etudiant etudiant, Groupe g){
|
||||
rs.close();
|
||||
pst.close();
|
||||
}catch(SQLException e){
|
||||
System.out.println(e.toString());
|
||||
if(this.erreurCO())
|
||||
this.addBDEtudiant(g, cnx);
|
||||
}
|
||||
@ -640,7 +645,7 @@ private boolean saveEtu(Etudiant etudiant, Groupe g){
|
||||
for(Etudiant gr:et){
|
||||
g.removeEtudiant(gr);
|
||||
}
|
||||
this.addSousGroupe(g, cnx);
|
||||
this.addSousGroupePasRecursif(g, cnx);
|
||||
}else{
|
||||
if(g==g.getPointPoint()){
|
||||
g=null;
|
||||
@ -650,6 +655,7 @@ private boolean saveEtu(Etudiant etudiant, Groupe g){
|
||||
}
|
||||
rs.close();
|
||||
}catch(SQLException e){
|
||||
System.out.println(e.toString());
|
||||
if(this.erreurCO())
|
||||
this.refreshGroupe(g, cnx);
|
||||
}
|
||||
@ -675,4 +681,38 @@ private boolean saveEtu(Etudiant etudiant, Groupe g){
|
||||
this.close(cnx);
|
||||
return g;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fonction recursive permettant de récuperrer les sous groupe a partir de la BD
|
||||
* @param g le groupe
|
||||
* @param cnx la connection a la BD (evite de la surcharger)
|
||||
* @param pourcent le pourcentage de ce groupe dans le chargement
|
||||
*/
|
||||
private void addSousGroupePasRecursif(Groupe g, Connection cnx){
|
||||
try{
|
||||
//On récupere les Groupe qui ont le parent :g
|
||||
PreparedStatement pst= cnx.prepareStatement(
|
||||
"SELECT `id`, `nom`, `min`, `max`, `value`, `id-parent` FROM `Groupe` join `TYPE` on Groupe.Type=TYPE.name where Groupe.`id-parent`=? and Groupe.id!=Groupe.`id-parent`;");
|
||||
pst.setString(1, String.valueOf(g.getId()));
|
||||
ResultSet rs=pst.executeQuery();
|
||||
rs=pst.executeQuery();
|
||||
//autrement si le groupe as des sous groupe
|
||||
while(rs.next()){
|
||||
//on les ajoute
|
||||
Groupe nouveau=new GroupeNP(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), TypeGroupe.getType(rs.getString(5)), g);
|
||||
//Si one le connait pas
|
||||
if(this.brain.get(nouveau.getId())==null){
|
||||
this.brain.put(nouveau.getId(), nouveau);
|
||||
}
|
||||
g.addSousGroupe(nouveau);
|
||||
//on ajoute les sous groupe des sous-groupe
|
||||
}
|
||||
rs.close();
|
||||
}catch(SQLException e){
|
||||
System.out.println(e.toString());
|
||||
if(this.erreurCO())
|
||||
this.addSousGroupe(g, cnx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class Connexion extends JOptionPane{
|
||||
JComboBox<User> combo=new JComboBox<User>(use);
|
||||
|
||||
JPanel myPanel = new JPanel();
|
||||
JTextField password = new JTextField(15);
|
||||
JTextField password = new JPasswordField(20);
|
||||
myPanel.add(new JLabel("Password:"));
|
||||
myPanel.add(password);
|
||||
panel.add(combo);
|
||||
@ -80,7 +80,7 @@ public class Connexion extends JOptionPane{
|
||||
JComboBox<User> combo=new JComboBox<User>(use);
|
||||
|
||||
JPanel myPanel = new JPanel();
|
||||
JTextField password = new JTextField(15);
|
||||
JTextField password = new JPasswordField(20);
|
||||
myPanel.add(new JLabel("Password:"));
|
||||
myPanel.add(password);
|
||||
JLabel erre=new JLabel("mdp incorect", SwingConstants.RIGHT);
|
||||
|
@ -0,0 +1,30 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.Controller;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Changement;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
public class ActionChangement implements ActionListener{
|
||||
private Model m;
|
||||
private Changement change;
|
||||
public ActionChangement(Model m, Changement change){
|
||||
this.m=m;
|
||||
this.change=change;
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String text=((JButton)e.getSource()).getText();
|
||||
if(text.equals("Supprimer")){
|
||||
this.m.deleteChange(change);
|
||||
}
|
||||
if(text.equals("Valider")){
|
||||
this.m.change(change);
|
||||
}
|
||||
if(text.equals("Raison")){
|
||||
this.m.showRaisonChange(change);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.Controller;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
|
||||
public class ActionListChange implements ActionListener{
|
||||
private Model m;
|
||||
public ActionListChange(Model m){
|
||||
this.m=m;
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String text=((JButton)e.getSource()).getText();
|
||||
if(text.equals("Changement")){
|
||||
this.m.listChange();
|
||||
}
|
||||
if(text.equals("Find Etu")){
|
||||
this.m.findEtu();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.Controller;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.View.FindBarFenetre;
|
||||
|
||||
public class ListenerFindBar implements ActionListener{
|
||||
private FindBarFenetre fenetre;
|
||||
private Etudiant et;
|
||||
public ListenerFindBar(FindBarFenetre fenetre, Etudiant e){
|
||||
this.fenetre=fenetre;
|
||||
this.et=e;
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String text=((JButton)e.getSource()).getText();
|
||||
if(text.equals("->"))
|
||||
this.fenetre.search(((JTextField)((JButton)e.getSource()).getParent()).getText());
|
||||
else{
|
||||
this.fenetre.showGroupe(et);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -6,16 +6,20 @@ import java.awt.*;
|
||||
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.AbstractChangementFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.AbstractGroupeFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Changement;
|
||||
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.ObservateurChangeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.Controller.ObservateurFenetre;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.View.Chargement;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.View.FenetreChangement;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.View.FenetreEtudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.View.FenetreGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.View.FindBarFenetre;
|
||||
|
||||
/**
|
||||
* Le Model de L'IHM
|
||||
@ -27,6 +31,7 @@ public class ModelRoot implements Model{
|
||||
private FenetreEtudiant fenEtu;
|
||||
private AbstractGroupeFactory promo;
|
||||
private AbstractChangementFactory changement;
|
||||
private FenetreChangement fenChange;
|
||||
private JFrame fenetre;
|
||||
public ModelRoot(){
|
||||
this.fenetre=new JFrame();
|
||||
@ -54,6 +59,7 @@ public class ModelRoot implements Model{
|
||||
}else{
|
||||
this.showGroupe(null);
|
||||
}
|
||||
this.fenChange=null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -325,4 +331,66 @@ public class ModelRoot implements Model{
|
||||
return retour;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.iutfbleau.projetIHM2022FI2.API.Model#listChange()
|
||||
*/
|
||||
@Override
|
||||
public void listChange() {
|
||||
this.fenChange=new FenetreChangement(changement, this);
|
||||
JOptionPane.showMessageDialog(this.fenetre, new JScrollPane(this.fenChange), "liste des changements", JOptionPane.OK_OPTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void change(Changement change) {
|
||||
this.changement.applyChangement(change);
|
||||
this.fenChange.refresh();
|
||||
if(change.getA()==this.fenGr.getG()){
|
||||
this.showGroupe(this.fenGr.getG());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteChange(Changement to_delete) {
|
||||
this.changement.deleteChangement(to_delete);
|
||||
this.fenChange.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showRaisonChange(Changement change) {
|
||||
JOptionPane.showMessageDialog(this.fenetre, new JLabel(change.getRaison()), "Raison de la demande", JOptionPane.OK_OPTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findEtu() {
|
||||
JScrollPane scroll=new JScrollPane(new FindBarFenetre(this).getPanel());
|
||||
scroll.getVerticalScrollBar().setUnitIncrement(5);
|
||||
JOptionPane.showMessageDialog(this.fenetre, scroll, "chercher un etudiant", JOptionPane.OK_OPTION);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.iutfbleau.projetIHM2022FI2.API.Model#getEtu(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Set<Etudiant> getEtu(String name) {
|
||||
return this.promo.getEtudiants(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showGroupOfEtudiant(Etudiant e){
|
||||
Set<Groupe> liste=this.promo.getGroupesOfEtudiant(e);
|
||||
JPanel myPanel;
|
||||
if(liste!=null && liste.size()>0){
|
||||
myPanel=new JPanel(new GridLayout(liste.size()/2+1, 2, 20, 20));
|
||||
for(Groupe g:liste){
|
||||
JButton bout=new JButton(g.getName());
|
||||
bout.addActionListener(new ObservateurChangeGroupe(this, g));
|
||||
myPanel.add(bout);
|
||||
}
|
||||
}else{
|
||||
myPanel=new JPanel(new GridLayout(2, 2, 20, 20));
|
||||
myPanel.add(new JLabel("Cet Etudiant n'appartient encore a aucun groupe"));
|
||||
}
|
||||
JOptionPane.showMessageDialog(this.fenChange, myPanel, "groupe de l'etudiant", JOptionPane.OK_OPTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.View;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.FlowLayout;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.AbstractChangementFactory;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Changement;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ActionChangement;
|
||||
|
||||
public class FenetreChangement extends JPanel{
|
||||
private AbstractChangementFactory change;
|
||||
private Model m;
|
||||
public FenetreChangement(AbstractChangementFactory list, Model m){
|
||||
this.change=list;
|
||||
this.m=m;
|
||||
this.draw();
|
||||
}
|
||||
|
||||
public void draw(){
|
||||
if(this.change==null || this.change.getAllChangements().size()==0){
|
||||
this.setBackground(Color.RED);
|
||||
this.setLayout(new FlowLayout());
|
||||
JLabel text=new JLabel("Aucune Demande de changement effectuer");
|
||||
text.setMinimumSize(this.getSize());
|
||||
this.add(text);
|
||||
}else{
|
||||
this.setLayout(new GridLayout(this.change.getAllChangements().size(), 6, 20, 0));
|
||||
for(Changement ch: this.change.getAllChangements()){
|
||||
this.add(new JLabel("L'etudiant "+ch.getEtu().getNom()+" "+ch.getEtu().getPrenom()));
|
||||
this.add(new JLabel("veut passer du groupe "+ch.getA().getName()));
|
||||
this.add(new JLabel(" au groupe "+ch.getB().getName()));
|
||||
JButton raison;
|
||||
if(ch.getRaison()==null){
|
||||
raison=new JButton("Type 1");
|
||||
}else{
|
||||
raison=new JButton("Raison");
|
||||
raison.addActionListener(new ActionChangement(this.m, ch));
|
||||
}
|
||||
this.add(raison);
|
||||
JButton supr=new JButton("Supprimer");
|
||||
supr.addActionListener(new ActionChangement(this.m, ch));
|
||||
JButton val=new JButton("Valider");
|
||||
val.addActionListener(new ActionChangement(this.m, ch));
|
||||
supr.setBackground(Color.RED);
|
||||
val.setBackground(Color.GREEN);
|
||||
this.add(val);
|
||||
this.add(supr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh(){
|
||||
this.removeAll();
|
||||
this.draw();
|
||||
this.revalidate();
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.View;
|
||||
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
@ -12,6 +13,7 @@ import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Groupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.TypeGroupe;
|
||||
import fr.iutfbleau.projetIHM2022FI2.Permanent.Controller.ActionListenerChangeEtu;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ActionListChange;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ActionListenerSuprEtu;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
|
||||
@ -36,7 +38,16 @@ public class FenetreEtudiant{
|
||||
|
||||
private void draw(){
|
||||
if(this.etu.size()!=0){
|
||||
this.pan.setLayout(new GridLayout(this.etu.size(), 1, 10, 0));
|
||||
this.pan.setLayout(new GridLayout(this.etu.size()+1, 1, 10, 0));
|
||||
JPanel bouton=new JPanel(new GridLayout(1, 2));
|
||||
JButton boutChange=new JButton("Changement");
|
||||
boutChange.addActionListener(new ActionListChange(this.m));
|
||||
JButton boutFind=new JButton("Find Etu");
|
||||
boutFind.addActionListener(new ActionListChange(this.m));
|
||||
bouton.add(boutChange);
|
||||
bouton.add(boutFind);
|
||||
this.pan.add(bouton);
|
||||
|
||||
for(Etudiant e: this.etu){
|
||||
PanelEtudiant p;
|
||||
if(type!=null && type==TypeGroupe.PARTITION){
|
||||
@ -62,4 +73,8 @@ public class FenetreEtudiant{
|
||||
public JPanel getPan() {
|
||||
return pan;
|
||||
}
|
||||
|
||||
public void listChange(){
|
||||
this.m.listChange();
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class FenetreGroupe{
|
||||
tache.add(ajouter);
|
||||
JButton supprimer=new JButton("supr");
|
||||
supprimer.addActionListener(new ObservateurModifGroupe(m, g));
|
||||
supprimer.setBackground(Color.RED);
|
||||
supprimer.setForeground(Color.RED);
|
||||
tache.add(supprimer);
|
||||
if(g.getType()!=TypeGroupe.PARTITION){
|
||||
JButton creer=new JButton("new Groupe");
|
||||
@ -70,8 +70,6 @@ public class FenetreGroupe{
|
||||
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()+"\t || \t id="+String.valueOf(g.getId()), JLabel.CENTER));
|
||||
this.pan.add(new JLabel("Sous groupe:",JLabel.CENTER));
|
||||
|
@ -0,0 +1,65 @@
|
||||
package fr.iutfbleau.projetIHM2022FI2.ROOT.View;
|
||||
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import java.awt.GridLayout;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Etudiant;
|
||||
import fr.iutfbleau.projetIHM2022FI2.API.Model;
|
||||
import fr.iutfbleau.projetIHM2022FI2.ROOT.Controller.ListenerFindBar;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.Set;
|
||||
|
||||
public class FindBarFenetre {
|
||||
private JPanel mypanel;
|
||||
private Model m;
|
||||
private Set<Etudiant> liste;
|
||||
|
||||
public FindBarFenetre(Model m){
|
||||
this.liste=null;
|
||||
this.m=m;
|
||||
this.mypanel=new JPanel();
|
||||
this.draw();
|
||||
}
|
||||
|
||||
private void draw(){
|
||||
JTextField searchField = new JTextField(30);
|
||||
searchField.setLayout(new BorderLayout());
|
||||
JButton label = new JButton("->");
|
||||
label.addActionListener(new ListenerFindBar(this, null));
|
||||
searchField.add(label, BorderLayout.LINE_END);
|
||||
if(this.liste!=null && this.liste.size()>0){
|
||||
this.mypanel.setLayout(new GridLayout(this.liste.size()+1, 1));
|
||||
this.mypanel.add(searchField);
|
||||
for(Etudiant e: this.liste){
|
||||
JButton etu=new JButton(e.getNom()+" "+e.getPrenom()+" "+e.getId());
|
||||
etu.addActionListener(new ListenerFindBar(this, e));
|
||||
this.mypanel.add(etu);
|
||||
}
|
||||
}else{
|
||||
this.mypanel.setLayout(new GridLayout(4, 1));
|
||||
this.mypanel.add(searchField);
|
||||
JLabel text=new JLabel("Aucun Etudiant Selectionné");
|
||||
this.mypanel.add(text);
|
||||
}
|
||||
mypanel.setSize(new Dimension(500, 500));
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return mypanel;
|
||||
}
|
||||
|
||||
public void search(String name){
|
||||
this.liste=this.m.getEtu(name);
|
||||
this.mypanel.removeAll();
|
||||
this.draw();
|
||||
this.mypanel.revalidate();
|
||||
}
|
||||
|
||||
public void showGroupe(Etudiant toshow){
|
||||
this.m.showGroupOfEtudiant(toshow);
|
||||
}
|
||||
}
|
@ -16,7 +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.supprimer.setForeground(Color.RED);
|
||||
this.deplacer=new JButton("change");
|
||||
if(change==true){
|
||||
bouton.add(this.deplacer);
|
||||
|
Loading…
Reference in New Issue
Block a user