diff --git a/.classpath b/.classpath
index 05fa0d7..536158a 100644
--- a/.classpath
+++ b/.classpath
@@ -6,11 +6,9 @@
-
-
-
-
-
-
+
+
+
+
diff --git a/.gitignore b/.gitignore
index a1c2a23..37a3418 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,6 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
+
+Thumbs.db
+.DS_Store
\ No newline at end of file
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index cd95bae..0000000
--- a/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,15 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=16
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=16
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
-org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=16
diff --git a/JavaApp Doc/Capture1.PNG b/JavaApp Doc/Capture1.PNG
new file mode 100644
index 0000000..5d10e7e
Binary files /dev/null and b/JavaApp Doc/Capture1.PNG differ
diff --git a/JavaApp Doc/Capture2.PNG b/JavaApp Doc/Capture2.PNG
new file mode 100644
index 0000000..65d2042
Binary files /dev/null and b/JavaApp Doc/Capture2.PNG differ
diff --git a/JavaApp Doc/Capture3.PNG b/JavaApp Doc/Capture3.PNG
new file mode 100644
index 0000000..7e8c9df
Binary files /dev/null and b/JavaApp Doc/Capture3.PNG differ
diff --git a/JavaApp Doc/Capture4.PNG b/JavaApp Doc/Capture4.PNG
new file mode 100644
index 0000000..8a119cd
Binary files /dev/null and b/JavaApp Doc/Capture4.PNG differ
diff --git a/JavaApp Doc/Capture5.PNG b/JavaApp Doc/Capture5.PNG
new file mode 100644
index 0000000..5285b2c
Binary files /dev/null and b/JavaApp Doc/Capture5.PNG differ
diff --git a/JavaApp Doc/Capture6.PNG b/JavaApp Doc/Capture6.PNG
new file mode 100644
index 0000000..2fdc83e
Binary files /dev/null and b/JavaApp Doc/Capture6.PNG differ
diff --git a/JavaApp Doc/Capture7.PNG b/JavaApp Doc/Capture7.PNG
new file mode 100644
index 0000000..4095a06
Binary files /dev/null and b/JavaApp Doc/Capture7.PNG differ
diff --git a/JavaApp Doc/Capture8.PNG b/JavaApp Doc/Capture8.PNG
new file mode 100644
index 0000000..78860e2
Binary files /dev/null and b/JavaApp Doc/Capture8.PNG differ
diff --git a/bin/images/Thumbs.db b/bin/images/Thumbs.db
deleted file mode 100644
index 29ab3fe..0000000
Binary files a/bin/images/Thumbs.db and /dev/null differ
diff --git a/src/controleur/Article.java b/src/controleur/Article.java
index 87bcec0..aa6fdbb 100644
--- a/src/controleur/Article.java
+++ b/src/controleur/Article.java
@@ -1,16 +1,17 @@
package controleur;
public class Article {
- private int id, prix, qtestock;
+ private int id, prix, qtestock, idcategorie;
private String reference, categorie, description, libelle, imagearticle;
public Article() {//ALL
- this.id=this.prix=this.qtestock=0;
+ this.id=this.idcategorie=this.prix=this.qtestock=0;
this.reference=this.categorie=this.description=this.libelle="";
}
- public Article (int id, String reference, String categorie, String description, String libelle, int prix, int qtestock, String imagearticle)
+ public Article (int id, String reference, int idcategorie, String categorie, String description, String libelle, int prix, int qtestock, String imagearticle)
{//ALL
this.id= id;
this.reference= reference;
+ this.idcategorie= idcategorie;
this.categorie= categorie;
this.description = description;
this.libelle = libelle;
@@ -18,10 +19,10 @@ public class Article {
this.qtestock = qtestock;
this.imagearticle = imagearticle;
}
- public Article (String reference, String categorie, String description, String libelle, int prix, int qtestock)
+ public Article (String reference, int idcategorie, String description, String libelle, int prix, int qtestock)
{//ADD & Modify
this.reference = reference;
- this.categorie= categorie;
+ this.idcategorie= idcategorie;
this.description = description;
this.libelle = libelle;
this.prix = prix;
@@ -30,8 +31,14 @@ public class Article {
public Article (String reference) {//DELETE
this.reference = reference;
}
+ public Article (int idcategorie,String libelle)
+ {// Categories
+ this.idcategorie= idcategorie;
+ this.libelle = libelle;
+ }
public int getId() { return id; }
public String getReference() { return reference; }
+ public int getidCategorie() { return idcategorie; }
public String getCategorie() { return categorie; }
public int getPrix() { return prix; }
public String getDescription() { return description; }
@@ -40,6 +47,7 @@ public class Article {
public String getImageArticle() { return imagearticle; }
public void setid(int id) { this.id = id; }
public void setReference(String reference) { this.reference = reference; }
+ public void setidCategorie(int idcategorie) { this.idcategorie = idcategorie; }
public void setCategorie(String categorie) { this.categorie = categorie; }
public void setPrix(int prix) { this.prix = prix; }
public void setDescription(String description) { this.description = description; }
diff --git a/src/controleur/Cheval.java b/src/controleur/Cheval.java
index 427808b..9c31498 100644
--- a/src/controleur/Cheval.java
+++ b/src/controleur/Cheval.java
@@ -34,6 +34,10 @@ public class Cheval {
{//DELETE
this.nom = nom;
}
+ public Cheval (int id, String nom) {
+ this.id= id;
+ this.nom= nom;
+ }
public int getId() { return id; }
public String getNom() { return nom; }
public String getSexe() { return sexe; }
diff --git a/src/controleur/Cours.java b/src/controleur/Cours.java
index 07047ae..8427f79 100644
--- a/src/controleur/Cours.java
+++ b/src/controleur/Cours.java
@@ -2,49 +2,71 @@ package controleur;
public class Cours
{
- private int idcours;
- private String datecours, heuredebut, heurefin;
+ private int idcours, ideleve, idcheval, idformateur;
+ private String datecours, heure, heuredebut, heurefin, note, prenomformateur, nomformateur, nomeleve, prenomeleve, nomcheval, formateur, eleve;
public Cours()
{
- this.idcours=0;
- this.datecours = this.heuredebut=this.heurefin="";
+ this.idcours=this.ideleve=this.idcheval=this.idformateur=0;
+ this.datecours=this.heure=this.heuredebut=this.heurefin=this.note=this.formateur=this.prenomformateur=this.nomformateur=this.eleve=this.nomeleve=this.prenomeleve=this.nomcheval="";
}
- public Cours (int idcours, String datecours, String heuredebut, String heurefin)
+ public Cours (int idcours, int ideleve, int idcheval, int idformateur, String datecours, String note, String heuredebut, String heurefin, String heure,String formateur, String eleve, String nomcheval)
{
- this.idcours= idcours;
- this.datecours = datecours;
- this.heuredebut = heuredebut;
- this.heurefin = heurefin;
- }
- public Cours ( String datecours, String heuredebut, String heurefin)
- {
- this.idcours= 0;
- this.datecours = datecours;
- this.heuredebut = heuredebut;
- this.heurefin = heurefin;
- }
- public int getIdCours() {
- return idcours;
- }
- public void setIdCours(int idcours) {
this.idcours = idcours;
- }
- public String getDateCours() {
- return datecours;
- }
- public void setDateCours(String datecours) {
+ this.ideleve = ideleve;
+ this.idcheval = idcheval;
+ this.idformateur = idformateur;
this.datecours = datecours;
- }
- public String getHeureDebut() {
- return heuredebut;
- }
- public void setHeureDebut(String heuredebut) {
+ this.note = note;
this.heuredebut = heuredebut;
- }
- public String getHeureFin() {
- return heurefin;
- }
- public void setHeureFin(String heurefin) {
this.heurefin = heurefin;
+ this.heure = heure;
+ this.datecours = datecours;
+ this.formateur = formateur;
+ this.eleve = eleve;
+ this.nomcheval = nomcheval;
+
}
-}
+ public Cours (int idcours, String datecours, String heuredebut, String heurefin, String note)
+ {
+ this.idcours= idcours;
+ this.datecours = datecours;
+ this.heuredebut = heuredebut;
+ this.heurefin = heurefin;
+ this.note = note;
+ }
+
+ public int getIdCours() {return idcours;}
+ public int getIdFormateur() {return idformateur;}
+ public int getIdEleve() {return ideleve;}
+ public int getIdCheval() {return idcheval;}
+ public String getDateCours() {return datecours;}
+ public String getHeure() {return heure;}
+ public String getHeureDebut() {return heuredebut;}
+ public String getHeureFin() {return heurefin;}
+ public String getNote() {return note;}
+ public String getFormateur() {return formateur;}
+ public String getprenomFormateur() {return prenomformateur;}
+ public String getnomFormateur() {return nomformateur;}
+ public String getEleve() {return eleve;}
+ public String getnomEleve() {return nomeleve;}
+ public String getprenomEleve() {return prenomeleve;}
+ public String getnomCheval() {return nomcheval;}
+
+ public void setIdCours(int idcours) {this.idcours = idcours;}
+ public void setIdFormateur(int idformateur) {this.idformateur = idformateur;}
+ public void setIdEleve(int ideleve) {this.ideleve = ideleve;}
+ public void setIdCheval(int idcheval) {this.idcheval = idcheval;}
+ public void setDateCours(String datecours) {this.datecours = datecours;}
+ public void setHeure(String heure) {this.heure = heure;}
+ public void setHeureDebut(String heuredebut) {this.heuredebut = heuredebut;}
+ public void setHeureFin(String heurefin) {this.heurefin = heurefin;}
+ public void setNote(String note) {this.note = note;}
+ public void setprenomFormateur(String prenomformateur) {this.prenomformateur = prenomformateur;}
+ public void setFormateur(String formateur) {this.formateur = formateur;}
+ public void setnomFormateur(String nomformateur) {this.nomformateur = nomformateur;}
+ public void setEleve(String eleve) {this.eleve = eleve;}
+ public void setnomEleve(String nomeleve) {this.nomeleve = nomeleve;}
+ public void setprenomEleve(String prenomeleve) {this.prenomeleve = prenomeleve;}
+ public void setnomCheval(String nomcheval) {this.nomcheval = nomcheval;}
+
+}
\ No newline at end of file
diff --git a/src/controleur/Eleve.java b/src/controleur/Eleve.java
index e73fe74..f81f4fa 100644
--- a/src/controleur/Eleve.java
+++ b/src/controleur/Eleve.java
@@ -1,14 +1,19 @@
package controleur;
+import java.util.Date;
+
public class Eleve
{
private int id, privilege, age, galop;
- private String record, pseudo, prenom, nom, sexe, adresse, mdp, mail, imageeleve;
+ public String pseudo, prenom, nom, sexe, adresse, mdp, mail, imageeleve;
+ public String eleve;
+ private Date record;
public Eleve() {//ALL
this.id=this.privilege=this.age=this.galop=0;
- this.record=this.pseudo=this.prenom=this.nom=this.sexe=this.adresse=this.mail="";
+ this.pseudo=this.prenom=this.nom=this.sexe=this.adresse=this.mail=this.eleve="";
+ this.record=null;
}
- public Eleve (int id, int privilege, String record, String pseudo, String prenom, String nom, String sexe, int age, String adresse, String mdp, String mail, int galop, String imageeleve)
+ public Eleve (int id, int privilege, Date record, String pseudo, String prenom, String nom, String sexe, int age, String adresse, String mdp, String mail, int galop, String imageeleve, String eleve)
{//ALL
this.id= id;
this.privilege = privilege;
@@ -23,6 +28,7 @@ public class Eleve
this.mail = mail;
this.galop = galop;
this.imageeleve = imageeleve;
+ this.eleve = eleve;
}
public Eleve (String prenom, String nom, String sexe, int age, String adresse, String mail, int galop)
{//ADD & Modify
@@ -37,9 +43,13 @@ public class Eleve
public Eleve (String mail) {//DELETE
this.mail = mail;
}
+ public Eleve (int id, String eleve) {
+ this.id= id;
+ this.eleve= eleve;
+ }
public int getId() { return id; }
public int getPrivilege() { return privilege; }
- public String getRecord() { return record; }
+ public Date getRecord() { return record; }
public String getPseudo() { return pseudo; }
public String getPrenom() { return prenom; }
public String getNom() { return nom; }
@@ -50,9 +60,10 @@ public class Eleve
public String getMail() { return mail; }
public int getGalop() { return galop; }
public String getImageEleve() { return imageeleve; }
+ public String getEleve() {return eleve;}
public void setid(int id) { this.id = id; }
public void setPrivilege(int privilege) { this.privilege = privilege; }
- public void setrecord(String record) { this.record = record; }
+ public void setrecord(Date record) { this.record = record; }
public void setPseudo(String pseudo) { this.pseudo = pseudo; }
public void setPrenom(String prenom) { this.prenom = prenom; }
public void setNom(String nom) { this.nom = nom; }
@@ -63,4 +74,4 @@ public class Eleve
public void setMail(String mail) { this.mail = mail; }
public void setGalop(int galop) { this.galop = galop; }
public void setImageEleve(String imageeleve) { this.imageeleve = imageeleve; }
-}
\ No newline at end of file
+ public void setEleve(String eleve) {this.eleve = eleve;}}
\ No newline at end of file
diff --git a/src/controleur/Event.java b/src/controleur/Event.java
index 0a1f1a6..697369b 100644
--- a/src/controleur/Event.java
+++ b/src/controleur/Event.java
@@ -1,16 +1,18 @@
package controleur;
public class Event {
- private int id, prix;
+ private int id, idcategorie, prix;
private String reference, categorie, description, libelle, imageevent, lieu, date;
public Event() {//ALL
- this.id=this.prix=0;
- this.reference=this.categorie=this.description=this.libelle=this.lieu=this.date="";
+ this.id=this.idcategorie=this.prix=0;
+ this.reference=this.categorie=this.description=this.libelle=this.lieu="";
+ this.date=null;
}
- public Event (int id, String reference, String categorie, String description, String libelle, int prix, String lieu, String date, String imageevent)
+ public Event (int id, String reference, int idcategorie, String categorie, String description, String libelle, int prix, String lieu, String date, String imageevent)
{//ALL
this.id= id;
this.reference= reference;
+ this.idcategorie= idcategorie;
this.categorie= categorie;
this.description = description;
this.libelle = libelle;
@@ -19,10 +21,10 @@ public class Event {
this.date = date;
this.imageevent = imageevent;
}
- public Event (String reference, String categorie, String description, String libelle, int prix, String lieu, String date)
+ public Event (String reference, int idcategorie, String description, String libelle, int prix, String lieu, String date)
{//ADD & Modify
this.reference = reference;
- this.categorie= categorie;
+ this.idcategorie= idcategorie;
this.description = description;
this.libelle = libelle;
this.prix = prix;
@@ -32,8 +34,14 @@ public class Event {
public Event (String reference) {//DELETE
this.reference = reference;
}
+ public Event (int idcategorie, String libelle)
+ {//ALL C
+ this.idcategorie= idcategorie;
+ this.libelle = libelle;
+ }
public int getId() { return id; }
public String getReference() { return reference; }
+ public int getidCategorie() { return idcategorie; }
public String getCategorie() { return categorie; }
public int getPrix() { return prix; }
public String getDescription() { return description; }
@@ -43,6 +51,7 @@ public class Event {
public String getImageEvent() { return imageevent; }
public void setid(int id) { this.id = id; }
public void setReference(String reference) { this.reference = reference; }
+ public void setidCategorie(int idcategorie) { this.idcategorie = idcategorie; }
public void setCategorie(String categorie) { this.categorie = categorie; }
public void setPrix(int prix) { this.prix = prix; }
public void setDescription(String description) { this.description = description; }
diff --git a/src/controleur/Formateur.java b/src/controleur/Formateur.java
index 685d64f..580750f 100644
--- a/src/controleur/Formateur.java
+++ b/src/controleur/Formateur.java
@@ -3,16 +3,15 @@ package controleur;
public class Formateur
{
private int idformateur, privilege, age, galop;
- private String login, prenom, nom, sexe, mail, mdp ;
+ public String prenom, nom, sexe, mail, mdp, formateur ;
public Formateur()
{//ALL
this.idformateur=this.privilege=this.age=this.galop=0;
- this.login=this.prenom=this.nom=this.sexe=this.mail=this.mdp="";
+ this.prenom=this.nom=this.sexe=this.mail=this.mdp=this.formateur="";
}
- public Formateur (int idformateur, String login, int privilege, String prenom, String nom, int age, int galop, String sexe, String mail, String mdp)
+ public Formateur (int idformateur, int privilege, String prenom, String nom, int age, int galop, String sexe, String mail, String mdp, String formateur)
{//ALL
this.idformateur= idformateur;
- this.login = login;
this.privilege = privilege;
this.prenom = prenom;
this.nom = nom;
@@ -21,6 +20,7 @@ public class Formateur
this.sexe = sexe;
this.mail = mail;
this.mdp = mdp;
+ this.formateur = formateur;
}
public Formateur(String prenom,String nom, int age, int galop, String sexe, String mail, String mdp)
{//ADD
@@ -36,8 +36,11 @@ public class Formateur
{//DELETE
this.mail = mail;
}
+ public Formateur (int idformateur, String formateur) {
+ this.idformateur= idformateur;
+ this.formateur= formateur;
+ }
public int getId() { return idformateur; }
- public String getLogin() { return login; }
public int getPrivilege() { return privilege; }
public String getPrenom() { return prenom; }
public String getNom() { return nom; }
@@ -46,8 +49,9 @@ public class Formateur
public String getSexe() {return sexe;}
public String getMail() { return mail; }
public String getMdp() { return mdp; }
+ public String getFormateur() { return formateur; }
+
public void setId(int idformateur) { this.idformateur = idformateur; }
- public void setLogin(String login) { this.login = login; }
public void setPrivilege(int privilege) { this.privilege = privilege; }
public void setPrenom(String prenom) { this.prenom = prenom; }
public void setNom(String nom) { this.nom = nom; }
@@ -56,4 +60,6 @@ public class Formateur
public void setSexe(String sexe) {this.sexe = sexe; }
public void setMail(String mail) { this.mail = mail; }
public void setMdp(String mdp) { this.mdp = mdp; }
+ public void setFormateur(String formateur) {this.formateur = formateur;}
+
}
\ No newline at end of file
diff --git a/src/controleur/Gestion.java b/src/controleur/Gestion.java
index d36a88b..6793745 100644
--- a/src/controleur/Gestion.java
+++ b/src/controleur/Gestion.java
@@ -1,24 +1,43 @@
package controleur;
+import java.awt.Color;
+import java.awt.Font;
+import javax.swing.UIManager;
+
import vue.Connexion;
public class Gestion
-{/*GESTION N EST PAS UTILISER CAR INCOMPREHENSIBLE POUR CCB - ALL IS IN Connexion*/
+{
private static Connexion uneConnexion;
public Gestion()
{
uneConnexion = new Connexion();
uneConnexion.rendreVisible(true);
}
-
public static void rendreVisible(boolean val)
{
uneConnexion.rendreVisible(val);
}
-
public static void main(String[] args)
{
+ /*FORMS Font*/
+ UIManager.put("Label.font", new Font("Book Antiqua", Font.BOLD, 23));
+ UIManager.put("Button.font",new Font("Book Antiqua", Font.BOLD, 20));
+ UIManager.put("OptionPane.messageFont", new Font("Book Antiqua", Font.BOLD, 18));
+ UIManager.put("OptionPane.buttonFont", new Font("Book Antiqua", Font.BOLD, 18));
+ UIManager.put("TextField.font",new Font("Bodoni MT", Font.BOLD, 23));
+ UIManager.put("ComboBox.font",new Font("Bodoni MT", Font.BOLD, 23));
+ UIManager.put("TextPane.font",new Font("Bodoni MT", Font.BOLD, 23));
+ UIManager.put("PasswordField.font",new Font("Bodoni MT", Font.BOLD, 23));
+ UIManager.put("RadioButton.font",new Font("Bodoni MT", Font.BOLD, 23));
+ /*JPANE & BACKGROUND*/
+ UIManager.put("OptionPane.background", new Color(222,220,203));
+ UIManager.put("OptionPane.messagebackground", new Color(222,220,203));
+ UIManager.put("RadioButton.background",new Color(222,220,203));
+ UIManager.put("Panel.background", new Color(222,220,203));
+ /*JTABLE*/
+ UIManager.put("TableHeader.font", new Font("Verdana", Font.PLAIN, 20));
+ UIManager.put("Table.font", new Font("Arial Unicode MS", Font.PLAIN, 18));
new Gestion();
}
-
}
\ No newline at end of file
diff --git a/src/image/article.png b/src/image/article.png
new file mode 100644
index 0000000..25666a1
Binary files /dev/null and b/src/image/article.png differ
diff --git a/src/image/cheval.png b/src/image/cheval.png
new file mode 100644
index 0000000..e1fa7f3
Binary files /dev/null and b/src/image/cheval.png differ
diff --git a/bin/images/choix1.png b/src/image/choix1.png
similarity index 100%
rename from bin/images/choix1.png
rename to src/image/choix1.png
diff --git a/bin/images/choix2.png b/src/image/choix2.png
similarity index 100%
rename from bin/images/choix2.png
rename to src/image/choix2.png
diff --git a/bin/images/choosemyday_logo.png b/src/image/choosemyday_logo.png
similarity index 100%
rename from bin/images/choosemyday_logo.png
rename to src/image/choosemyday_logo.png
diff --git a/src/image/cours.png b/src/image/cours.png
new file mode 100644
index 0000000..6debda2
Binary files /dev/null and b/src/image/cours.png differ
diff --git a/src/image/eleve.png b/src/image/eleve.png
new file mode 100644
index 0000000..3320a65
Binary files /dev/null and b/src/image/eleve.png differ
diff --git a/src/image/event.png b/src/image/event.png
new file mode 100644
index 0000000..72ecf0d
Binary files /dev/null and b/src/image/event.png differ
diff --git a/src/image/event2.png b/src/image/event2.png
new file mode 100644
index 0000000..9236e45
Binary files /dev/null and b/src/image/event2.png differ
diff --git a/bin/images/favicon.png b/src/image/favicon.png
similarity index 100%
rename from bin/images/favicon.png
rename to src/image/favicon.png
diff --git a/bin/images/favicon2.png b/src/image/favicon2.png
similarity index 100%
rename from bin/images/favicon2.png
rename to src/image/favicon2.png
diff --git a/src/image/formateur.png b/src/image/formateur.png
new file mode 100644
index 0000000..71f846c
Binary files /dev/null and b/src/image/formateur.png differ
diff --git a/src/image/home.png b/src/image/home.png
new file mode 100644
index 0000000..ba5e4b7
Binary files /dev/null and b/src/image/home.png differ
diff --git a/bin/images/logo.png b/src/image/logo.png
similarity index 100%
rename from bin/images/logo.png
rename to src/image/logo.png
diff --git a/src/images/Thumbs.db b/src/images/Thumbs.db
deleted file mode 100644
index b18b688..0000000
Binary files a/src/images/Thumbs.db and /dev/null differ
diff --git a/src/images/choix1.png b/src/images/choix1.png
deleted file mode 100644
index 5264cda..0000000
Binary files a/src/images/choix1.png and /dev/null differ
diff --git a/src/images/choix2.png b/src/images/choix2.png
deleted file mode 100644
index 8b44952..0000000
Binary files a/src/images/choix2.png and /dev/null differ
diff --git a/src/images/choosemyday_logo.png b/src/images/choosemyday_logo.png
deleted file mode 100644
index b886521..0000000
Binary files a/src/images/choosemyday_logo.png and /dev/null differ
diff --git a/src/images/favicon.png b/src/images/favicon.png
deleted file mode 100644
index 7767104..0000000
Binary files a/src/images/favicon.png and /dev/null differ
diff --git a/src/images/favicon2.png b/src/images/favicon2.png
deleted file mode 100644
index 5910ac0..0000000
Binary files a/src/images/favicon2.png and /dev/null differ
diff --git a/src/images/logo.png b/src/images/logo.png
deleted file mode 100644
index df6c1dd..0000000
Binary files a/src/images/logo.png and /dev/null differ
diff --git a/src/modele/BDD.java b/src/modele/BDD.java
index 9e0b65a..7f6175d 100644
--- a/src/modele/BDD.java
+++ b/src/modele/BDD.java
@@ -9,20 +9,20 @@ public class BDD {
private Connection maConnexion;
public BDD() {
- this.serveur = "nasccb:3307";
+ this.serveur = "serveur:port";
this.nombdd = "Ecurie";
- this.user = "christian";
- this.mdp = "F8orP#NRqd#oKLQ#";
+ this.user = "user";
+ this.mdp = "mdp";
this.maConnexion = null;
}
public void chargerPilote() {
- // vérifie la présence du pilote JDBC MySQL
+ // v�rifie la pr�sence du pilote JDBC MySQL
try {
Class.forName("org.mariadb.jdbc.Driver");
}
catch(ClassNotFoundException exp) {
System.out.println("Abscence du pilote JDBC !");
- System.out.println("Vérifier Project -> Build Path -> Configure -> Libraries -> Add External JARs");
+ System.out.println("V�rifier Project -> Build Path -> Configure -> Libraries -> Add External JARs");
}
}
public void seConnecter() {
@@ -33,16 +33,16 @@ public class BDD {
this.maConnexion = DriverManager.getConnection(url, this.user, this.mdp);
}
catch(SQLException exp) {
- System.out.println("Impossible de se connecter à " + url);
+ System.out.println("Impossible de se connecter � " + url);
}
}
public void seDeconnecter() {
- // déconnexion au serveur de la BDD
+ // d�connexion au serveur de la BDD
try {
if(this.maConnexion != null) this.maConnexion.close();
}
catch(SQLException exp) {
- System.out.println("La déconnexion a échoué !");
+ System.out.println("La d�connexion a �chou� !");
}
}
public Connection getMaConnexion()
diff --git a/src/modele/ModeleArticle.java b/src/modele/ModeleArticle.java
index 6dd04df..ea33a09 100644
--- a/src/modele/ModeleArticle.java
+++ b/src/modele/ModeleArticle.java
@@ -10,7 +10,7 @@ import controleur.Article;
public class ModeleArticle {
public static ArrayList selectAll() {
ArrayList lesArticles = new ArrayList();
- String requete = "select * from Article;";
+ String requete = "SELECT * FROM Article AS a INNER JOIN CategorieArticle AS ca ON a.idcategorie = ca.idcategorie;";
try {
BDD uneBDD = new BDD();
uneBDD.seConnecter();
@@ -19,13 +19,14 @@ public class ModeleArticle {
while(unRes.next()) {
int id = unRes.getInt("idarticle");
String reference = unRes.getString("reference");
- String categorie = unRes.getString("idcategorie");
+ int idcategorie = unRes.getInt("a.idcategorie");
+ String categorie = unRes.getString("ca.libelle");
String description = unRes.getString("description");
- String libelle = unRes.getString("libelle");
+ String libelle = unRes.getString("a.libelle");
int prix = unRes.getInt("prix");
int qtestock = unRes.getInt("qtestock");
String image = unRes.getString("imagearticle");
- Article unArticle = new Article(id, reference, categorie, description, libelle, prix, qtestock, image);
+ Article unArticle = new Article(id, reference, idcategorie, categorie, description, libelle, prix, qtestock, image);
lesArticles.add(unArticle);
}
unStat.close();
@@ -38,7 +39,7 @@ public class ModeleArticle {
return lesArticles;
}
public static Article selectWhere(String reference) {
- String requete = "select * from Article where reference='" + reference + "';";
+ String requete = "SELECT * FROM Article AS a INNER JOIN CategorieArticle AS ca ON a.idcategorie = ca.idcategorie where reference='" + reference + "';";
Article unArticle = null;
try {
BDD uneBDD = new BDD();
@@ -47,13 +48,14 @@ public class ModeleArticle {
ResultSet unRes = unStat.executeQuery(requete);
if(unRes.next()) {
int id = unRes.getInt("idarticle");
- String categorie = unRes.getString("idcategorie");
+ int idcategorie = unRes.getInt("a.idcategorie");
+ String categorie = unRes.getString("ca.libelle");
String description = unRes.getString("description");
- String libelle = unRes.getString("libelle");
+ String libelle = unRes.getString("a.libelle");
int prix = unRes.getInt("prix");
int qtestock = unRes.getInt("qtestock");
String image = unRes.getString("imagearticle");
- unArticle = new Article(id, reference, categorie, description, libelle, prix, qtestock, image);
+ unArticle = new Article(id, reference, idcategorie, categorie, description, libelle, prix, qtestock, image);
}
unStat.close();
unRes.close();
@@ -67,7 +69,7 @@ public class ModeleArticle {
public static void insert(Article unArticle) {
String requete = "insert into Article (reference, idcategorie, description, libelle, prix, qtestock, imagearticle) values ('"
+ unArticle.getReference() + "', '"
- + unArticle.getCategorie() + "', '"
+ + unArticle.getidCategorie() + "', '"
+ unArticle.getDescription() + "', '"
+ unArticle.getLibelle() + "', "
+ unArticle.getPrix() + ", "
@@ -87,13 +89,13 @@ public class ModeleArticle {
}
}
public static void update(Article unArticle, String reference) {
- String valueCategorie = unArticle.getCategorie();
+ String valueidCategorie = String.valueOf(unArticle.getidCategorie());
String valueDescription = unArticle.getDescription();
String valueLibelle = unArticle.getLibelle();
String valuePrix = String.valueOf(unArticle.getPrix());
String valueQtestock = String.valueOf(unArticle.getQtestock());
- if (unArticle.getCategorie().equals("")) { valueCategorie = ""; }
- else { valueCategorie = " idcategorie = '"+ unArticle.getCategorie() +"'"; }
+ if (String.valueOf(unArticle.getidCategorie()).equals(0)) { valueidCategorie = ""; }
+ else { valueidCategorie = " idcategorie = '"+ unArticle.getidCategorie() +"'"; }
if (unArticle.getDescription().equals("")) { valueDescription = ""; }
else { valueDescription = ", description = '"+ unArticle.getDescription() +"'"; }
if (unArticle.getLibelle().equals("")) { valueLibelle = ""; }
@@ -102,7 +104,7 @@ public class ModeleArticle {
else { valuePrix = ", prix = "+ unArticle.getPrix(); }
if (String.valueOf(unArticle.getQtestock()).equals("")) { valueQtestock = ""; }
else { valueQtestock = ", qtestock = "+ unArticle.getQtestock(); }
- String requete = "update Article set " + valueCategorie + valueDescription + valueLibelle + valuePrix + valueQtestock + " where reference='"+ reference +"';";
+ String requete = "update Article set " + valueidCategorie + valueDescription + valueLibelle + valuePrix + valueQtestock + " where reference='"+ reference +"';";
try {
BDD uneBDD = new BDD();
uneBDD.seConnecter();
@@ -130,4 +132,56 @@ public class ModeleArticle {
System.out.println("Erreur d'execution de la requete " + requete);
}
}
+ public static ArrayList selectCategorie() {
+ ArrayList lesCatgories = new ArrayList();
+ String requete = "SELECT * FROM CategorieArticle;";
+ try {
+ BDD uneBDD = new BDD();
+ uneBDD.seConnecter();
+ Statement unStat = uneBDD.getMaConnexion().createStatement();
+ ResultSet unRes = unStat.executeQuery(requete);
+ while(unRes.next()) {
+ int idcategorie = unRes.getInt("idcategorie");
+ String libelle = unRes.getString("libelle");
+ Article uneCategorie = new Article(idcategorie, libelle);
+ lesCatgories.add(uneCategorie);
+ }
+ unStat.close();
+ unRes.close();
+ uneBDD.seDeconnecter();
+ }
+ catch(SQLException exp) {
+ System.out.println("Erreur d'execution de la requete " + requete);
+ }
+ return lesCatgories;
+ }
+
+ //extraire les Articles
+ public static Object [][] extraireArticles () {
+ ArrayList lesArticles = ModeleArticle.selectAll();
+ Object [][] donnees = new Object [lesArticles.size()][6];
+ int i =0;
+ for (Article unArticle : lesArticles) {
+ donnees[i][0] = unArticle.getReference();
+ donnees[i][1] = unArticle.getLibelle();
+ donnees[i][2] = unArticle.getDescription();
+ donnees[i][3] = unArticle.getCategorie();
+ donnees[i][4] = unArticle.getPrix();
+ donnees[i][5] = unArticle.getQtestock();
+ i++;
+ }
+
+ return donnees;
+ }
+ public static Object [] extraireCategories () {
+ ArrayList lesCategories = ModeleArticle.selectCategorie();
+ Object [] donnees = new Object [lesCategories.size()+1];
+ int i = 1;
+ for (Article uneCategorie : lesCategories) {
+ donnees[i] = uneCategorie.getidCategorie();
+ donnees[i] = uneCategorie.getLibelle();
+ i++;
+ }
+ return donnees;
+ }
}
\ No newline at end of file
diff --git a/src/modele/ModeleCheval.java b/src/modele/ModeleCheval.java
index 9478195..ed79465 100644
--- a/src/modele/ModeleCheval.java
+++ b/src/modele/ModeleCheval.java
@@ -104,4 +104,55 @@ public class ModeleCheval {
System.out.println("Erreur d'execution de la requete " + requete);
}
}
+ public static ArrayList selectChoose() {
+ ArrayList lesChevaux = new ArrayList();
+ String requete = "select idcheval,nom from Cheval;";
+ try {
+ BDD uneBDD = new BDD();
+ uneBDD.seConnecter();
+ Statement unStat = uneBDD.getMaConnexion().createStatement();
+ ResultSet unRes = unStat.executeQuery(requete);
+ while(unRes.next()) {
+ int id = unRes.getInt("idcheval");
+ String nom = unRes.getString("nom");
+ Cheval unCheval = new Cheval(id, nom);
+ lesChevaux.add(unCheval);
+ }
+ unStat.close();
+ unRes.close();
+ uneBDD.seDeconnecter();
+ }
+ catch(SQLException exp) {
+ System.out.println("Erreur d'execution de la requete " + requete);
+ }
+ return lesChevaux;
+ }
+ public static Object [] extraireChevaux () {
+ ArrayList lesChevaux = selectChoose();
+ Object [] donnees = new Object [lesChevaux.size()+1];
+ int i = 1;
+ for (Cheval unCheval : lesChevaux) {
+ donnees[i] = unCheval.getId();
+ donnees[i] = unCheval.getNom();
+ i++;
+ }
+ return donnees;
+ }
+ //extraire les Chevaux
+ public static Object [][] extraireChevaux2 () {
+ ArrayList lesChevaux = ModeleCheval.selectAll();
+ Object [][] donnees = new Object [lesChevaux.size()][7];
+ int i =0;
+ for (Cheval unCheval : lesChevaux) {
+ donnees[i][0] = unCheval.getNom();
+ donnees[i][1] = unCheval.getSexe();
+ donnees[i][2] = unCheval.getAge();
+ donnees[i][3] = unCheval.getProprietaire();
+ donnees[i][4] = unCheval.getRace();
+ donnees[i][5] = unCheval.getRobe();
+ donnees[i][6] = unCheval.getType();
+ i++;
+ }
+ return donnees;
+ }
}
\ No newline at end of file
diff --git a/src/modele/ModeleCours.java b/src/modele/ModeleCours.java
index 3d29f8f..d0708c7 100644
--- a/src/modele/ModeleCours.java
+++ b/src/modele/ModeleCours.java
@@ -11,18 +11,28 @@ public class ModeleCours
public static ArrayList selectAll()
{
ArrayList lesCours = new ArrayList();
- String requete = "select * from Cours;";
+ String requete = "SELECT GestionCours.*, Cours.*, CONCAT(Cours.heuredebut,' - ',Cours.heurefin) AS heure , CONCAT(Formateur.nom,' ', Formateur.prenom) AS formateur, CONCAT(Eleve.nom,' ', Eleve.prenom) AS eleve,Cheval.nom AS cheval FROM GestionCours\n"
+ + "INNER JOIN Eleve ON GestionCours.ideleve = Eleve.ideleve INNER JOIN Cheval ON GestionCours.idcheval = Cheval.idcheval\n"
+ + "INNER JOIN Cours ON GestionCours.idcours = Cours.idcours INNER JOIN Formateur ON Cours.idformateur = Formateur.idformateur;";
try {
BDD uneBDD = new BDD();
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
while(unRes.next()) {
- int idcours = unRes.getInt("idcours");
- String datecours = unRes.getString("datecours");
+ int idcours = unRes.getInt("GestionCours.idcours");
+ int ideleve = unRes.getInt("ideleve");
+ int idcheval = unRes.getInt("idcheval");
+ int idformateur = unRes.getInt("idformateur");
+ String note = unRes.getString("note");
String heuredebut = unRes.getString("heuredebut");
String heurefin = unRes.getString("heurefin");
- Cours unCours = new Cours(idcours, datecours, heuredebut, heurefin);
+ String datecours = unRes.getString("datecours");
+ String heure = unRes.getString("heure");
+ String formateur = unRes.getString("formateur");
+ String eleve = unRes.getString("eleve");
+ String nomcheval = unRes.getString("cheval");
+ Cours unCours = new Cours(idcours, ideleve, idcheval, idformateur, datecours, note, heuredebut, heurefin, heure, formateur, eleve, nomcheval);
lesCours.add(unCours);
}
unStat.close();
@@ -69,9 +79,12 @@ public static void delete(String datecours, String heuredebut) {
System.out.println("Erreur d'execution de la requete " + requete);
}
}
-public static Cours selectWhere(String datecours, String heuredebut)
+public static Cours selectWhere(String datecours/*, String heuredebut, String heurefin*/)
{
- String requete = "select * from Cours where datecours='" + datecours + "' and heuredebut='" + heuredebut + "';";
+ String requete = "SELECT GestionCours.*, Cours.*, CONCAT(Cours.heuredebut,' - ',Cours.heurefin) AS heure , CONCAT(Formateur.nom,' ', Formateur.prenom) AS formateur, CONCAT(Eleve.nom,' ', Eleve.prenom) AS eleve,Cheval.nom AS cheval FROM GestionCours\n"
+ + "INNER JOIN Eleve ON GestionCours.ideleve = Eleve.ideleve INNER JOIN Cheval ON GestionCours.idcheval = Cheval.idcheval\n"
+ + "INNER JOIN Cours ON GestionCours.idcours = Cours.idcours INNER JOIN Formateur ON Cours.idformateur = Formateur.idformateur\n"
+ + "WHERE datecours='" + datecours + "';";
Cours unCours = null;
try {
BDD uneBDD = new BDD();
@@ -80,8 +93,19 @@ public static Cours selectWhere(String datecours, String heuredebut)
ResultSet unRes = unStat.executeQuery(requete);
if(unRes.next())
{
+ int idcours = unRes.getInt("GestionCours.idcours");
+ int ideleve = unRes.getInt("ideleve");
+ int idcheval = unRes.getInt("idcheval");
+ int idformateur = unRes.getInt("idformateur");
+ //datecours
+ String note = unRes.getString("note");
+ String heuredebut = unRes.getString("heuredebut");
String heurefin = unRes.getString("heurefin");
- unCours = new Cours(datecours, heuredebut, heurefin);
+ String heure = unRes.getString("heure");
+ String formateur = unRes.getString("formateur");
+ String eleve = unRes.getString("eleve");
+ String nomcheval = unRes.getString("cheval");
+ unCours = new Cours(idcours, ideleve, idcheval, idformateur, datecours, note, heuredebut, heurefin, heure, formateur, eleve, nomcheval);
}
unStat.close();
unRes.close();
@@ -92,4 +116,22 @@ public static Cours selectWhere(String datecours, String heuredebut)
}
return unCours;
}
+
+//Extraire les Cours
+public static Object [][] extraireCours ()
+{
+ ArrayList lesCours = ModeleCours.selectAll();
+ Object [][] donnees = new Object [lesCours.size()][5];
+ int i =0;
+ for (Cours unCours : lesCours)
+ {
+ donnees[i][0] = unCours.getDateCours();
+ donnees[i][1] = unCours.getHeure();
+ donnees[i][2] = unCours.getFormateur();
+ donnees[i][3] = unCours.getEleve();
+ donnees[i][4] = unCours.getnomCheval();
+ i++;
+ }
+ return donnees;
+}
}
\ No newline at end of file
diff --git a/src/modele/ModeleEleve.java b/src/modele/ModeleEleve.java
index 789b816..e5afe53 100644
--- a/src/modele/ModeleEleve.java
+++ b/src/modele/ModeleEleve.java
@@ -4,13 +4,15 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
+import java.util.Date;
+
import controleur.Eleve;
public class ModeleEleve
{
public static ArrayList selectAll() {
ArrayList lesEleves = new ArrayList();
- String requete = "select * from Eleve;";
+ String requete = "select *, CONCAT(nom,' ', prenom) AS eleve from Eleve;";
try {
BDD uneBDD = new BDD();
uneBDD.seConnecter();
@@ -19,7 +21,7 @@ public class ModeleEleve
while(unRes.next()) {
int id = unRes.getInt("ideleve");
int privilege = unRes.getInt("privilege");
- String record = unRes.getString("dateenregistre");
+ Date record = unRes.getDate("dateenregistre");
String pseudo = unRes.getString("pseudo");
String prenom = unRes.getString("prenom");
String nom = unRes.getString("nom");
@@ -30,7 +32,8 @@ public class ModeleEleve
String mail = unRes.getString("adressemail");
int galop = unRes.getInt("galop");
String image = unRes.getString("imageeleve");
- Eleve unEleve = new Eleve(id, privilege, record, pseudo, prenom, nom, sexe, age, adresse, mdp, mail, galop, image);
+ String eleve = unRes.getString("eleve");
+ Eleve unEleve = new Eleve(id, privilege, record, pseudo, prenom, nom, sexe, age, adresse, mdp, mail, galop, image, eleve);
lesEleves.add(unEleve);
}
unStat.close();
@@ -43,7 +46,7 @@ public class ModeleEleve
return lesEleves;
}
public static Eleve selectWhere(String mail) {
- String requete = "select * from Eleve where adressemail='" + mail + "';";
+ String requete = "select *, CONCAT(nom,' ', prenom) AS eleve from Eleve where adressemail='" + mail + "';";
Eleve unEleve = null;
try {
BDD uneBDD = new BDD();
@@ -53,7 +56,7 @@ public class ModeleEleve
if(unRes.next()) {
int id = unRes.getInt("ideleve");
int privilege = unRes.getInt("privilege");
- String record = unRes.getString("dateenregistre");
+ Date record = unRes.getDate("dateenregistre");
String pseudo = unRes.getString("pseudo");
String prenom = unRes.getString("prenom");
String nom = unRes.getString("nom");
@@ -64,7 +67,8 @@ public class ModeleEleve
//adressemail
int galop = unRes.getInt("galop");
String image = unRes.getString("imageeleve");
- unEleve = new Eleve(id, privilege, record, pseudo, prenom, nom, sexe, age, adresse, mdp, mail, galop, image);
+ String eleve = unRes.getString("eleve");
+ unEleve = new Eleve(id, privilege, record, pseudo, prenom, nom, sexe, age, adresse, mdp, mail, galop, image, eleve);
}
unStat.close();
unRes.close();
@@ -148,4 +152,56 @@ public class ModeleEleve
System.out.println("Erreur d'execution de la requete " + requete);
}
}
+ public static ArrayList selectChoose() {
+ ArrayList lesEleves = new ArrayList();
+ String requete = "select ideleve, CONCAT(nom,' ', prenom) AS eleve from Eleve;";
+ try {
+ BDD uneBDD = new BDD();
+ uneBDD.seConnecter();
+ Statement unStat = uneBDD.getMaConnexion().createStatement();
+ ResultSet unRes = unStat.executeQuery(requete);
+ while(unRes.next()) {
+ int id = unRes.getInt("ideleve");
+ String eleve = unRes.getString("eleve");
+ Eleve unEleve = new Eleve(id, eleve);
+ lesEleves.add(unEleve);
+ }
+ unStat.close();
+ unRes.close();
+ uneBDD.seDeconnecter();
+ }
+ catch(SQLException exp) {
+ System.out.println("Erreur d'execution de la requete " + requete);
+ }
+ return lesEleves;
+ }
+ public static Object [] extraireEleves () {
+ ArrayList lesEleves = selectChoose();
+ Object [] donnees = new Object [lesEleves.size()+1];
+ int i = 1;
+ for (Eleve unEleve : lesEleves) {
+ donnees[i] = unEleve.getId();
+ donnees[i] = unEleve.getEleve();
+ i++;
+ }
+ return donnees;
+ }
+
+ //extraire les Eleves
+ public static Object [][] extraireEleves2 () {
+ ArrayList lesEleves = ModeleEleve.selectAll();
+ Object [][] donnees = new Object [lesEleves.size()][7];
+ int i =0;
+ for (Eleve unEleve : lesEleves) {
+ donnees[i][0] = unEleve.getPseudo();
+ donnees[i][1] = unEleve.getMail();
+ donnees[i][2] = unEleve.getEleve();
+ donnees[i][3] = unEleve.getAdresse();
+ donnees[i][4] = unEleve.getSexe();
+ donnees[i][5] = unEleve.getAge();
+ donnees[i][6] = unEleve.getGalop();
+ i++;
+ }
+ return donnees;
+ }
}
\ No newline at end of file
diff --git a/src/modele/ModeleEvent.java b/src/modele/ModeleEvent.java
index 7777f30..352b043 100644
--- a/src/modele/ModeleEvent.java
+++ b/src/modele/ModeleEvent.java
@@ -10,7 +10,7 @@ import controleur.Event;
public class ModeleEvent {
public static ArrayList selectAll() {
ArrayList lesEvents = new ArrayList();
- String requete = "select * from Event;";
+ String requete = "SELECT * FROM Event AS e INNER JOIN TypeEvent AS te ON e.idtype = te.idtype;";
try {
BDD uneBDD = new BDD();
uneBDD.seConnecter();
@@ -19,14 +19,15 @@ public class ModeleEvent {
while(unRes.next()) {
int id = unRes.getInt("idevent");
String reference = unRes.getString("reference");
- String categorie = unRes.getString("idtype");
+ int idcategorie = unRes.getInt("e.idtype");
+ String categorie = unRes.getString("te.libelle");
String description = unRes.getString("description");
String libelle = unRes.getString("nom");
int prix = unRes.getInt("prix");
String lieu = unRes.getString("lieu");
String date = unRes.getString("dateevent");
String image = unRes.getString("imageevent");
- Event unEvent = new Event(id, reference, categorie, description, libelle, prix, lieu, date, image);
+ Event unEvent = new Event(id, reference, idcategorie, categorie, description, libelle, prix, lieu, date, image);
lesEvents.add(unEvent);
}
unStat.close();
@@ -39,7 +40,7 @@ public class ModeleEvent {
return lesEvents;
}
public static Event selectWhere(String reference) {
- String requete = "select * from Event where reference='" + reference + "';";
+ String requete = "SELECT * FROM Event AS e INNER JOIN TypeEvent AS te ON e.idtype = te.idtype where reference='" + reference + "';";
Event unEvent = null;
try {
BDD uneBDD = new BDD();
@@ -48,14 +49,15 @@ public class ModeleEvent {
ResultSet unRes = unStat.executeQuery(requete);
if(unRes.next()) {
int id = unRes.getInt("idevent");
- String categorie = unRes.getString("idtype");
+ int idcategorie = unRes.getInt("e.idtype");
+ String categorie = unRes.getString("te.libelle");
String description = unRes.getString("description");
String libelle = unRes.getString("nom");
int prix = unRes.getInt("prix");
String lieu = unRes.getString("lieu");
String date = unRes.getString("dateevent");
String image = unRes.getString("imageevent");
- unEvent = new Event(id, reference, categorie, description, libelle, prix, lieu, date, image);
+ unEvent = new Event(id, reference, idcategorie, categorie, description, libelle, prix, lieu, date, image);
}
unStat.close();
unRes.close();
@@ -67,15 +69,15 @@ public class ModeleEvent {
return unEvent;
}
public static void insert(Event unEvent) {
- String requete = "insert into Event (dateevent, reference, idtype, description, nom, lieu, prix, imageevent) values ("
- + "NOW(), '"
+ String requete = "insert into Event (reference, idtype, description, nom, lieu, prix, dateevent, imageevent) values ('"
+ unEvent.getReference() + "', '"
- + unEvent.getCategorie() + "', '"
+ + unEvent.getidCategorie() + "', '"
+ unEvent.getDescription() + "', '"
+ unEvent.getLibelle() + "', '"
+ unEvent.getLieu() + "', "
- + unEvent.getPrix() + ", '"
- + "/images/evenements/img_event.jpg');";
+ + unEvent.getPrix() + ",'"
+ + unEvent.getDate() + "',"
+ + "'/images/evenements/img_event.jpg');";
try {
BDD uneBDD = new BDD();
uneBDD.seConnecter();
@@ -90,14 +92,14 @@ public class ModeleEvent {
}
}
public static void update(Event unEvent, String reference) {
- String valueCategorie = unEvent.getCategorie();
+ String valueCategorie = String.valueOf(unEvent.getidCategorie());
String valueDescription = unEvent.getDescription();
String valueLibelle = unEvent.getLibelle();
String valuePrix = String.valueOf(unEvent.getPrix());
String valueLieu = unEvent.getLieu();
- String valueDate = unEvent.getDate();
- if (unEvent.getCategorie().equals("")) { valueCategorie = ""; }
- else { valueCategorie = " idtype = '"+ unEvent.getCategorie() +"'"; }
+ String valueDate = String.valueOf(unEvent.getDate());
+ if (String.valueOf(unEvent.getidCategorie()).equals(0)) { valueCategorie = ""; }
+ else { valueCategorie = " idtype = '"+ String.valueOf(unEvent.getidCategorie()) +"'"; }
if (unEvent.getDescription().equals("")) { valueDescription = ""; }
else { valueDescription = ", description = '"+ unEvent.getDescription() +"'"; }
if (unEvent.getLibelle().equals("")) { valueLibelle = ""; }
@@ -107,7 +109,7 @@ public class ModeleEvent {
if (String.valueOf(unEvent.getLieu()).equals("")) { valueLieu = ""; }
else { valueLieu = ", lieu = '"+ unEvent.getLieu() + "'";}
if (String.valueOf(unEvent.getDate()).equals("")) { valueDate = ""; }
- else { valueDate = ", dateevent = Now()"; }
+ else { valueDate = ", dateevent = '"+ unEvent.getDate() + "'";}
String requete = "update Event set " + valueCategorie + valueDescription + valueLibelle + valuePrix + valueLieu + valueDate + " where reference='"+ reference +"';";
try {
BDD uneBDD = new BDD();
@@ -136,4 +138,55 @@ public class ModeleEvent {
System.out.println("Erreur d'execution de la requete " + requete);
}
}
+ public static ArrayList selectCategorie() {
+ ArrayList lesCatgories = new ArrayList();
+ String requete = "SELECT * FROM TypeEvent;";
+ try {
+ BDD uneBDD = new BDD();
+ uneBDD.seConnecter();
+ Statement unStat = uneBDD.getMaConnexion().createStatement();
+ ResultSet unRes = unStat.executeQuery(requete);
+ while(unRes.next()) {
+ int idcategorie = unRes.getInt("idtype");
+ String libelle = unRes.getString("libelle");
+ Event uneCategorie = new Event(idcategorie, libelle);
+ lesCatgories.add(uneCategorie);
+ }
+ unStat.close();
+ unRes.close();
+ uneBDD.seDeconnecter();
+ }
+ catch(SQLException exp) {
+ System.out.println("Erreur d'execution de la requete " + requete);
+ }
+ return lesCatgories;
+ }
+ //extraire les Events
+ public static Object [][] extraireEvents () {
+ ArrayList lesEvents = ModeleEvent.selectAll();
+ Object [][] donnees = new Object [lesEvents.size()][7];
+ int i =0;
+ for (Event unEvent : lesEvents) {
+ donnees[i][0] = unEvent.getReference();
+ donnees[i][1] = unEvent.getLibelle();
+ donnees[i][2] = unEvent.getDescription();
+ donnees[i][3] = unEvent.getPrix();
+ donnees[i][4] = unEvent.getLieu();
+ donnees[i][5] = unEvent.getDate();
+ donnees[i][6] = unEvent.getCategorie();
+ i++;
+ }
+ return donnees;
+ }
+ public static Object [] extraireCategories () {
+ ArrayList lesCategories = ModeleEvent.selectCategorie();
+ Object [] donnees = new Object [lesCategories.size()+1];
+ int i = 1;
+ for (Event uneCategorie : lesCategories) {
+ donnees[i] = uneCategorie.getidCategorie();
+ donnees[i] = uneCategorie.getLibelle();
+ i++;
+ }
+ return donnees;
+ }
}
\ No newline at end of file
diff --git a/src/modele/ModeleFormateur.java b/src/modele/ModeleFormateur.java
index 1a5d575..f1fa755 100644
--- a/src/modele/ModeleFormateur.java
+++ b/src/modele/ModeleFormateur.java
@@ -4,13 +4,14 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
+
import controleur.Formateur;
public class ModeleFormateur
{
public static ArrayList selectAll() {
ArrayList lesFormateurs = new ArrayList();
- String requete = "select * from Formateur;";
+ String requete = "select *,CONCAT(Formateur.nom,' ', Formateur.prenom) AS formateur from Formateur;";
try {
BDD uneBDD = new BDD();
uneBDD.seConnecter();
@@ -18,7 +19,6 @@ public class ModeleFormateur
ResultSet unRes = unStat.executeQuery(requete);
while(unRes.next()) {
int idformateur = unRes.getInt("idformateur");
- String login = unRes.getString("login");
int privilege = unRes.getInt("privilege");
String prenom = unRes.getString("prenom");
String nom = unRes.getString("nom");
@@ -26,8 +26,9 @@ public class ModeleFormateur
int galop = unRes.getInt("galop");
String sexe = unRes.getString("sexe");
String mail = unRes.getString("adressemail");
- String mdp = unRes.getString("mdp");
- Formateur unFormateur = new Formateur(idformateur, login, privilege, prenom, nom, age, galop, sexe, mail, mdp);
+ String mdp = unRes.getString("mdp");
+ String formateur = unRes.getString("formateur");
+ Formateur unFormateur = new Formateur(idformateur, privilege, prenom, nom, age, galop, sexe, mail, mdp, formateur);
lesFormateurs.add(unFormateur);
}
unStat.close();
@@ -40,7 +41,7 @@ public class ModeleFormateur
return lesFormateurs;
}
public static Formateur selectWhere(String mail) {
- String requete = "select * from Formateur where adressemail='" + mail + "';";
+ String requete = "select *,CONCAT(Formateur.nom,' ', Formateur.prenom) AS formateur from Formateur where adressemail='" + mail + "';";
Formateur unFormateur = null;
try {
BDD uneBDD = new BDD();
@@ -50,7 +51,6 @@ public class ModeleFormateur
if(unRes.next())
{
int idformateur = unRes.getInt("idformateur");
- String login = unRes.getString("login");
int privilege = unRes.getInt("privilege");
String prenom = unRes.getString("prenom");
String nom = unRes.getString("nom");
@@ -58,8 +58,9 @@ public class ModeleFormateur
int galop = unRes.getInt("galop");
String sexe = unRes.getString("sexe");
String mdp = unRes.getString("mdp");
+ String formateur = unRes.getString("formateur");
// adressemail
- unFormateur = new Formateur(idformateur, login, privilege, prenom, nom, age, galop, sexe, mail, mdp);
+ unFormateur = new Formateur(idformateur, privilege, prenom, nom, age, galop, sexe, mail, mdp, formateur);
}
unStat.close();
unRes.close();
@@ -71,7 +72,7 @@ public class ModeleFormateur
return unFormateur;
}
public static Formateur selectCompte(String mail, String mdp) {
- String requete = "select * from Formateur where adressemail='" + mail + "' and mdp='" + mdp + "';";
+ String requete = "select *,CONCAT(Formateur.nom,' ', Formateur.prenom) AS formateur from Formateur where adressemail='" + mail + "' and mdp='" + mdp + "';";
Formateur unFormateur = null;
try {
BDD uneBDD = new BDD();
@@ -81,15 +82,15 @@ public class ModeleFormateur
if(unRes.next())
{
int idformateur = unRes.getInt("idformateur");
- String login = unRes.getString("login");
int privilege = unRes.getInt("privilege");
String prenom = unRes.getString("prenom");
String nom = unRes.getString("nom");
int age = unRes.getInt("age");
int galop = unRes.getInt("galop");
String sexe = unRes.getString("sexe");
+ String formateur = unRes.getString("formateur");
// adressemail & mdp
- unFormateur = new Formateur(idformateur, login, privilege, prenom, nom, age, galop, sexe, mail, mdp);
+ unFormateur = new Formateur(idformateur, privilege, prenom, nom, age, galop, sexe, mail, mdp, formateur);
}
unStat.close();
unRes.close();
@@ -101,8 +102,7 @@ public class ModeleFormateur
return unFormateur;
}
public static void insert(Formateur unFormateur) {
- String requete = "insert into Formateur (login, privilege, prenom, nom, age, galop, sexe, adressemail, mdp) values ('"
- + unFormateur.getLogin() + "', '"
+ String requete = "insert into Formateur (privilege, prenom, nom, age, galop, sexe, adressemail, mdp) values ('"
+ unFormateur.getPrivilege() + "', '"
+ unFormateur.getPrenom() + "', '"
+ unFormateur.getNom() + "', '"
@@ -137,4 +137,64 @@ public class ModeleFormateur
System.out.println("Erreur d'execution de la requete " + requete);
}
}
+
+ public static ArrayList selectChoose() {
+ ArrayList lesFormateurs = new ArrayList();
+ String requete = "select *,CONCAT(Formateur.nom,' ', Formateur.prenom) AS formateur from Formateur;";
+ try {
+ BDD uneBDD = new BDD();
+ uneBDD.seConnecter();
+ Statement unStat = uneBDD.getMaConnexion().createStatement();
+ ResultSet unRes = unStat.executeQuery(requete);
+ while(unRes.next()) {
+ int idformateur = unRes.getInt("idformateur");
+ int privilege = unRes.getInt("privilege");
+ String prenom = unRes.getString("prenom");
+ String nom = unRes.getString("nom");
+ int age = unRes.getInt("age");
+ int galop = unRes.getInt("galop");
+ String sexe = unRes.getString("sexe");
+ String mail = unRes.getString("adressemail");
+ String mdp = unRes.getString("mdp");
+ String formateur = unRes.getString("formateur");
+ Formateur unFormateur = new Formateur(idformateur, privilege, prenom, nom, age, galop, sexe, mail, mdp, formateur);
+ lesFormateurs.add(unFormateur);
+ }
+ unStat.close();
+ unRes.close();
+ uneBDD.seDeconnecter();
+ }
+ catch(SQLException exp) {
+ System.out.println("Erreur d'execution de la requete " + requete);
+ }
+ return lesFormateurs;
+ }
+
+ public static Object [] extraireFormateurs () {
+ ArrayList lesFormateurs = selectChoose();
+ Object [] donnees = new Object [lesFormateurs.size()+1];
+ int i = 1;
+ for (Formateur unFormateur : lesFormateurs) {
+ donnees[i] = unFormateur.getId();
+ donnees[i] = unFormateur.getFormateur();
+ i++;
+ }
+ return donnees;
+}
+ //extraire les Formateurs
+ public static Object [][] extraireFormateurs2() {
+ ArrayList lesFormateurs = ModeleFormateur.selectAll();
+ Object [][] donnees = new Object [lesFormateurs.size()][5];
+ int i =0;
+ for (Formateur unFormateur : lesFormateurs)
+ {
+ donnees[i][0] = unFormateur.getMail();
+ donnees[i][1] = unFormateur.getFormateur();
+ donnees[i][2] = unFormateur.getSexe();
+ donnees[i][3] = unFormateur.getAge();
+ donnees[i][4] = unFormateur.getGalop();
+ i++;
+ }
+ return donnees;
+ }
}
\ No newline at end of file
diff --git a/src/vue/Connexion.java b/src/vue/Connexion.java
index 1ecf8a9..cd0dafe 100644
--- a/src/vue/Connexion.java
+++ b/src/vue/Connexion.java
@@ -12,37 +12,48 @@ public class Connexion extends JFrame
JFrame frame = new JFrame();
JPanel contentPane = new JPanel();
JPanel header = new JPanel();
- JLabel lbLogo = new JLabel(new ImageIcon("src/images/logo.png"));
+ JLabel lbLogo = new JLabel(new ImageIcon(Connexion.class.getResource("/image/logo.png")));
VueConnexion vueConnexion = new VueConnexion();
public Connexion()
{
this.setSize(600, 500);
this.setLocationRelativeTo(null);
- this.setIconImage(new ImageIcon("src/images/favicon.png").getImage());
+ this.setIconImage(new ImageIcon(Connexion.class.getResource("/image/favicon.png")).getImage());
this.setTitle("Ecurie");
- this.setBackground(new Color(222,220,203));
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
-
contentPane.add(header, BorderLayout.NORTH);
- header.setBackground(new Color(222,220,203));
header.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
- header.add(lbLogo);
- getContentPane().add(vueConnexion, BorderLayout.CENTER);
-
+ header.add(lbLogo);
+ getContentPane().add(vueConnexion, BorderLayout.CENTER);
this.setVisible(true);
}
-
public void rendreVisible(boolean val)
- {
- this.setVisible(val);
- }
+ { this.setVisible(val); }
public static void main(String[] args)
{
+ /*FORMS Font*/
+ UIManager.put("Label.font", new Font("Book Antiqua", Font.BOLD, 23));
+ UIManager.put("Button.font",new Font("Book Antiqua", Font.BOLD, 20));
+ UIManager.put("OptionPane.messageFont", new Font("Book Antiqua", Font.BOLD, 18));
+ UIManager.put("OptionPane.buttonFont", new Font("Book Antiqua", Font.BOLD, 18));
+ UIManager.put("TextField.font",new Font("Bodoni MT", Font.BOLD, 23));
+ UIManager.put("ComboBox.font",new Font("Bodoni MT", Font.BOLD, 23));
+ UIManager.put("TextPane.font",new Font("Bodoni MT", Font.BOLD, 23));
+ UIManager.put("PasswordField.font",new Font("Bodoni MT", Font.BOLD, 23));
+ UIManager.put("RadioButton.font",new Font("Bodoni MT", Font.BOLD, 23));
+ /*JPANE & BACKGROUND*/
+ UIManager.put("OptionPane.background", new Color(222,220,203));
+ UIManager.put("OptionPane.messagebackground", new Color(222,220,203));
+ UIManager.put("RadioButton.background",new Color(222,220,203));
+ UIManager.put("Panel.background", new Color(222,220,203));
+ /*JTABLE*/
+ UIManager.put("TableHeader.font", new Font("Verdana", Font.PLAIN, 20));
+ UIManager.put("Table.font", new Font("Arial Unicode MS", Font.PLAIN, 18));
new Gestion();
}
-}
+}
\ No newline at end of file
diff --git a/src/vue/FormArticles.java b/src/vue/FormArticles.java
index 304a034..89ca313 100644
--- a/src/vue/FormArticles.java
+++ b/src/vue/FormArticles.java
@@ -3,15 +3,15 @@ package vue;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.TableColumnModel;
-
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.util.ArrayList;
import controleur.Article;
import modele.ModeleArticle;
+import javax.swing.border.EtchedBorder;
+import org.jdesktop.swingx.prompt.PromptSupport;
public class FormArticles extends JPanel implements ActionListener {
@@ -20,123 +20,108 @@ public class FormArticles extends JPanel implements ActionListener {
String prenom, nom, sexe, imagearticle;
int id, privilege, age, selection;
String[] formState = { " VISUALISER ", " AJOUTER ", " MODIFIER ", " SUPPRIMER " };
- String[] titresArticle = new String[] {" Référence "," Categorie "," Produit "," Description "," Prix "," Quantité "};
- Object[][] dataArticle = extraireArticles();
- private final JPanel panel = new JPanel();
- private final JPanel panel_1 = new JPanel();
- private final JPanel panel_2 = new JPanel();
- private final JPanel panel_7 = new JPanel();
- private final JPanel panel_8 = new JPanel();
- private final JPanel panel_10 = new JPanel();
- private final JPanel panel_11 = new JPanel();
- private final JPanel panel_13 = new JPanel();
- private final JPanel panel_14 = new JPanel();
- private final JPanel panel_15 = new JPanel();
- private final JPanel panel_12 = new JPanel();
- private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel_15, panel_14);
+ String[] titresArticle = new String[] {" Référence "," Produit "," Description "," Catégorie "," Prix "," Quantité "};
+ Object[][] dataArticle = ModeleArticle.extraireArticles();
+ Object[] dataCategorie = ModeleArticle.extraireCategories();
+ private final JPanel panelForm = new JPanel();
+ private final JPanel panelImageID = new JPanel();
+ private final JPanel panelReference = new JPanel();
+ private final JPanel panelDescription = new JPanel();
+ private final JPanel panelPrix = new JPanel();
+ private final JPanel panelQuantite = new JPanel();
+ private final JPanel panelNom = new JPanel();
+ private final JPanel panelButton = new JPanel();
+ private final JPanel panelTable = new JPanel();
+ private final JPanel panelFormulaire = new JPanel();
+ private final JPanel panelCategorie = new JPanel();
+ private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panelFormulaire, panelTable);
private final JTable tableArticles = new JTable(dataArticle, titresArticle);
private final JScrollPane scrollTab = new JScrollPane(tableArticles);
- private final JLabel lbTitre = new JLabel(" Panneau de Gestion des Articles ");
+ private final JLabel lbTitre = new JLabel(" Panneau de gestion des articles ");
private final JLabel lbId = new JLabel(" ID : ");
- private final JLabel lbReference = new JLabel(" Référence de l'article : ");
- private final JLabel lbCategorie = new JLabel(" Catégorie de l'article : ");
- private final JLabel lbPrix = new JLabel(" Prix de l'article (\u20AC) : ");
+ private final JLabel lbReference = new JLabel(" Référence : ");
+ private final JLabel lbCategorie = new JLabel(" Catégorie : ");
+ private final JLabel lbPrix = new JLabel(" Prix (\u20AC) : ");
private final JLabel lbDescription = new JLabel(" Description : ");
- private final JLabel lbLibelle = new JLabel(" Nom de l'article : ");
+ private final JLabel lbLibelle = new JLabel(" Nom : ");
private final JLabel lbQtestock = new JLabel(" Quantité (/pièce) : ");
private final JLabel lbImage = new JLabel(" Image : ");
private final JLabel imgImage = new JLabel();
private final JLabel textId = new JLabel();
private final JTextField textReference = new JTextField();
- private final JTextField textCategorie = new JTextField();
private final JTextField textLibelle = new JTextField();
private final JTextField textPrix = new JTextField();
private final JTextField textQtestock = new JTextField();
private final JTextPane textDescription = new JTextPane();
@SuppressWarnings({ "rawtypes", "unchecked" })
private final JComboBox choiceForm = new JComboBox(formState);
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private final JComboBox comboBox = new JComboBox(dataCategorie);
private final JButton btAnnuler = new JButton(" Annuler ");
private final JButton btAjouter = new JButton(" Valider ");
+
public FormArticles()
{
this.setBackground(new Color(222,220,203));
setLayout(new BorderLayout(0, 0));
this.add(splitPane);
- panel_15.setPreferredSize(new Dimension(500, 10));
- panel_15.setLayout(new BorderLayout(0, 30));
- panel_15.add(panel, BorderLayout.CENTER);
- panel.setLayout(new GridLayout(0, 1, 0, 0));
- panel.add(panel_1);
- panel_1.setLayout(new GridLayout(1, 4, 0, 0));
+ panelFormulaire.setPreferredSize(new Dimension(500, 10));
+ panelFormulaire.setLayout(new BorderLayout(0, 30));
+ panelFormulaire.add(panelForm, BorderLayout.CENTER);
+ panelForm.setLayout(new GridLayout(0, 1, 0, 0));
+ panelForm.add(panelImageID);
+ panelImageID.setLayout(new GridLayout(1, 4, 0, 0));
lbId.setHorizontalAlignment(SwingConstants.RIGHT);
- lbId.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_1.add(lbId);
- textId.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelImageID.add(lbId);
textId.setHorizontalAlignment(SwingConstants.CENTER);
- panel_1.add(textId);
- lbImage.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- imgImage.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelImageID.add(textId);
+ imgImage.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
imgImage.setHorizontalAlignment(SwingConstants.CENTER);
- panel_1.add(lbImage);
- panel_1.add(imgImage);
- panel.add(panel_2);
- panel_2.setLayout(new GridLayout(2, 1, 0, 0));
+ panelImageID.add(lbImage);
+ panelImageID.add(imgImage);
+ panelForm.add(panelReference);
+ panelReference.setLayout(new GridLayout(2, 1, 0, 0));
lbReference.setHorizontalAlignment(SwingConstants.CENTER);
- lbReference.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_2.add(lbReference);
- textReference.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelReference.add(lbReference);
+ PromptSupport.setPrompt("Indiquer une référence d'un article", textReference);
textReference.setHorizontalAlignment(SwingConstants.CENTER);
- panel_2.add(textReference);
- panel.add(panel_12);
- panel_12.setLayout(new GridLayout(2, 1, 0, 0));
- lbCategorie.setHorizontalAlignment(SwingConstants.CENTER);
- lbCategorie.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_12.add(lbCategorie);
- textCategorie.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textCategorie.setHorizontalAlignment(SwingConstants.CENTER);
- panel_12.add(textCategorie);
- panel.add(panel_11);
- panel_11.setLayout(new GridLayout(2, 1, 0, 0));
+ panelReference.add(textReference);
+ panelForm.add(panelNom);
+ panelNom.setLayout(new GridLayout(2, 1, 0, 0));
lbLibelle.setHorizontalAlignment(SwingConstants.CENTER);
- lbLibelle.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_11.add(lbLibelle);
- textLibelle.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelNom.add(lbLibelle);
textLibelle.setHorizontalAlignment(SwingConstants.CENTER);
- panel_11.add(textLibelle);
- panel.add(panel_7);
- panel_7.setLayout(new GridLayout(2, 1, 0, 0));
+ panelNom.add(textLibelle);
+ panelForm.add(panelDescription);
+ panelDescription.setLayout(new GridLayout(2, 1, 0, 0));
lbDescription.setHorizontalAlignment(SwingConstants.CENTER);
- lbDescription.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_7.add(lbDescription);
- textDescription.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_7.add(textDescription);
- panel.add(panel_8);
- panel_8.setLayout(new GridLayout(1, 1, 0, 0));
+ panelDescription.add(lbDescription);
+ panelDescription.add(textDescription);
+ panelForm.add(panelCategorie);
+ panelCategorie.setLayout(new GridLayout(2, 1, 0, 0));
+ lbCategorie.setHorizontalAlignment(SwingConstants.CENTER);
+ panelCategorie.add(lbCategorie);
+ panelCategorie.add(comboBox);
+ panelForm.add(panelPrix);
+ panelPrix.setLayout(new GridLayout(1, 1, 0, 0));
lbPrix.setHorizontalAlignment(SwingConstants.RIGHT);
- lbPrix.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_8.add(lbPrix);
- textPrix.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelPrix.add(lbPrix);
textPrix.setHorizontalAlignment(SwingConstants.CENTER);
- panel_8.add(textPrix);
- panel.add(panel_10);
- panel_10.setLayout(new GridLayout(1, 1, 0, 0));
+ panelPrix.add(textPrix);
+ panelForm.add(panelQuantite);
+ panelQuantite.setLayout(new GridLayout(1, 1, 0, 0));
lbQtestock.setHorizontalAlignment(SwingConstants.RIGHT);
- lbQtestock.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_10.add(lbQtestock);
- textQtestock.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelQuantite.add(lbQtestock);
textQtestock.setHorizontalAlignment(SwingConstants.CENTER);
- panel_10.add(textQtestock);
- panel_13.setPreferredSize(new Dimension(10, 30));
- panel_15.add(panel_13, BorderLayout.SOUTH);
- panel_13.setLayout(new GridLayout(1, 3, 40, 0));
- choiceForm.setFont(new Font("Book Antiqua", Font.BOLD, 15));
+ panelQuantite.add(textQtestock);
+ panelButton.setPreferredSize(new Dimension(20, 50));
+ panelFormulaire.add(panelButton, BorderLayout.SOUTH);
+ panelButton.setLayout(new GridLayout(1, 3, 40, 0));
choiceForm.setSelectedIndex(0);
- panel_13.add(choiceForm);
- btAnnuler.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_13.add(btAnnuler);
- btAjouter.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_13.add(btAjouter);
+ panelButton.add(choiceForm);
+ panelButton.add(btAnnuler);
+ panelButton.add(btAjouter);
choiceForm.addActionListener(this);
this.btAnnuler.addActionListener(this);
this.btAjouter.addActionListener(this);
@@ -156,21 +141,20 @@ public class FormArticles extends JPanel implements ActionListener {
}
}
});
- panel_14.setLayout(new BorderLayout(0, 0));
- lbTitre.setPreferredSize(new Dimension(160, 50));
+ panelTable.setLayout(new BorderLayout(0, 0));
+ lbTitre.setPreferredSize(new Dimension(150, 100));
lbTitre.setHorizontalAlignment(SwingConstants.CENTER);
- lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 25));
- panel_14.add(lbTitre, BorderLayout.NORTH);
- panel_14.add(scrollTab, BorderLayout.CENTER);
+ lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 40));
+ panelTable.add(lbTitre, BorderLayout.NORTH);
+ panelTable.add(scrollTab, BorderLayout.CENTER);
tableArticles.setShowVerticalLines(false);
tableArticles.setEnabled(false);
tableArticles.setRowHeight(30);
- tableArticles.setFont(new Font("Arial Unicode MS", Font.PLAIN, 18));
TableColumnModel columnModel = tableArticles.getColumnModel();
columnModel.getColumn(0).setPreferredWidth(10);
- columnModel.getColumn(1).setPreferredWidth(10);
- columnModel.getColumn(2).setPreferredWidth(100);
- columnModel.getColumn(3).setPreferredWidth(300);
+ columnModel.getColumn(1).setPreferredWidth(100);
+ columnModel.getColumn(2).setPreferredWidth(300);
+ columnModel.getColumn(3).setPreferredWidth(10);
columnModel.getColumn(4).setPreferredWidth(10);
columnModel.getColumn(5).setPreferredWidth(10);
}
@@ -178,12 +162,12 @@ public class FormArticles extends JPanel implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==this.btAnnuler) {
- this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
- this.textReference.setText("");this.textCategorie.setText("");this.textDescription.setText("");
+ this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
+ this.textReference.setText("");this.comboBox.setSelectedIndex(0);this.textDescription.setText("");
this.textLibelle.setText("");this.textPrix.setText("");this.textQtestock.setText("");
}
else if (e.getSource()==this.btAjouter) {
- Article unArticle = ModeleArticle.selectWhere(textReference.getText());
+ Article unArticle = ModeleArticle.selectWhere(textReference.getText());
switch(choiceForm.getSelectedIndex()) {
case 0: //VISUALISE
{
@@ -192,27 +176,28 @@ public class FormArticles extends JPanel implements ActionListener {
else {
this.textId.setText(String.valueOf(unArticle.getId()));
this.textReference.setText(unArticle.getReference());
- this.textCategorie.setText(unArticle.getCategorie());
+ this.comboBox.setSelectedIndex(unArticle.getidCategorie());
this.textDescription.setText(unArticle.getDescription());
this.textLibelle.setText(unArticle.getLibelle());
this.textPrix.setText(String.valueOf(unArticle.getPrix()));
this.textQtestock.setText(String.valueOf(unArticle.getQtestock()));
- this.imgImage.setIcon(new ImageIcon("//NASCCB/web/Ecurie" + unArticle.getImageArticle()));
+ ImageIcon imageIcon = new ImageIcon(new ImageIcon("//NASCCB/web/Ecurie" + unArticle.getImageArticle()).getImage().getScaledInstance(75, 85, Image.SCALE_DEFAULT));
+ this.imgImage.setIcon(imageIcon);
JOptionPane.showMessageDialog(this, " Visualisation réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
}
break;
case 1: //AJOUTER
try{
- if((textReference.getText().equals(""))||(textCategorie.getText().equals(""))||(textDescription.getText().equals(""))||(textLibelle.getText().equals(""))||(textPrix.getText().equals(""))||(textQtestock.getText().equals("")))
+ if((textReference.getText().equals(""))||(comboBox.getSelectedIndex()==0)||(textDescription.getText().equals(""))||(textLibelle.getText().equals(""))||(textPrix.getText().equals(""))||(textQtestock.getText().equals("")))
{ JOptionPane.showMessageDialog(this," Veuillez vérifier tous les champs incorrects ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
else if(unArticle != null)
{ JOptionPane.showMessageDialog(this, " La référence saisi est déjà existante ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
- else {
- Article insertArticle = new Article(textReference.getText(), textCategorie.getText(), textDescription.getText(), textLibelle.getText(), Integer.parseInt(textPrix.getText()), Integer.parseInt(textQtestock.getText()));
+ else {
+ Article insertArticle = new Article(textReference.getText(), comboBox.getSelectedIndex(), textDescription.getText(), textLibelle.getText(), Integer.parseInt(textPrix.getText()), Integer.parseInt(textQtestock.getText()));
ModeleArticle.insert(insertArticle);
this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
- this.textReference.setText("");this.textCategorie.setText("");this.textDescription.setText("");
+ this.textReference.setText("");this.comboBox.setSelectedIndex(0);this.textDescription.setText("");
this.textLibelle.setText("");this.textPrix.setText("");this.textQtestock.setText("");
JOptionPane.showMessageDialog(this, " Insertion réalisé avec succès ! " ," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
@@ -225,11 +210,11 @@ public class FormArticles extends JPanel implements ActionListener {
try{
if(textReference.getText().equals(""))
{ JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs vide"); }
- else {
- Article editArticle = new Article(textReference.getText(), textCategorie.getText(), textDescription.getText(), textLibelle.getText(), Integer.parseInt(textPrix.getText()), Integer.parseInt(textQtestock.getText()));
+ else {
+ Article editArticle = new Article(textReference.getText(), comboBox.getSelectedIndex(), textDescription.getText(), textLibelle.getText(), Integer.parseInt(textPrix.getText()), Integer.parseInt(textQtestock.getText()));
ModeleArticle.update(editArticle, textReference.getText());
this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
- this.textReference.setText("");this.textCategorie.setText("");this.textDescription.setText("");
+ this.textReference.setText("");this.comboBox.setSelectedIndex(0);this.textDescription.setText("");
this.textLibelle.setText("");this.textPrix.setText("");this.textQtestock.setText("");
JOptionPane.showMessageDialog(this, " Modification reussie avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
@@ -244,10 +229,10 @@ public class FormArticles extends JPanel implements ActionListener {
{ JOptionPane.showMessageDialog(this, " Veuillez saisir des valeurs dans les champs vide "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
else {
ModeleArticle.delete(textReference.getText());
- this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
- this.textReference.setText("");this.textCategorie.setText("");this.textDescription.setText("");
+ this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
+ this.textReference.setText("");this.comboBox.setSelectedIndex(0);this.textDescription.setText("");
this.textLibelle.setText("");this.textPrix.setText("");this.textQtestock.setText("");
- JOptionPane.showMessageDialog(this, " Suppression réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showMessageDialog(this, " Suppression réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
this.setVisible(true);// fin d'enregistrement
}
@@ -257,21 +242,4 @@ public class FormArticles extends JPanel implements ActionListener {
}
}
}
-
- //extraire les Articles
- public Object [][] extraireArticles () {
- ArrayList lesArticles = ModeleArticle.selectAll();
- Object [][] donnees = new Object [lesArticles.size()][6];
- int i =0;
- for (Article unArticle : lesArticles) {
- donnees[i][0] = unArticle.getReference();
- donnees[i][1] = unArticle.getCategorie();
- donnees[i][2] = unArticle.getLibelle();
- donnees[i][3] = unArticle.getDescription();
- donnees[i][4] = unArticle.getPrix();
- donnees[i][5] = unArticle.getQtestock();
- i++;
- }
- return donnees;
- }
}
\ No newline at end of file
diff --git a/src/vue/FormChevaux.java b/src/vue/FormChevaux.java
index 92f04e6..27d9524 100644
--- a/src/vue/FormChevaux.java
+++ b/src/vue/FormChevaux.java
@@ -2,12 +2,13 @@ package vue;
import java.awt.*;
import javax.swing.*;
+import javax.swing.border.EtchedBorder;
+import org.jdesktop.swingx.prompt.PromptSupport;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.util.ArrayList;
import controleur.Cheval;
import modele.ModeleCheval;
@@ -19,24 +20,23 @@ public class FormChevaux extends JPanel implements ActionListener
int selection;
String[] formState = { " VISUALISER ", " AJOUTER ", " SUPPRIMER " };
String[] titresChevaux = new String[] {" Nom ", " Sexe ", " Age ", " Propriétaire ", " Race ", " Robe ", " Type "};
- Object[][] dataChevaux = extraireChevaux();
- private final JPanel panel = new JPanel();
- private final JPanel panel_9 = new JPanel();
- private final JPanel panel_10 = new JPanel();
- private final JPanel panel_11 = new JPanel();
- private final JPanel panel_1 = new JPanel();
- private final JPanel panel_2 = new JPanel();
- private final JPanel panel_3 = new JPanel();
- private final JPanel panel_4 = new JPanel();
- private final JPanel panel_5 = new JPanel();
- private final JPanel panel_6 = new JPanel();
- private final JPanel panel_7 = new JPanel();
- private final JPanel panel_8 = new JPanel();
- private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel, panel_10);
+ Object[][] dataChevaux = ModeleCheval.extraireChevaux2();
+ private final JPanel panelFormulaire = new JPanel();
+ private final JPanel panelButton = new JPanel();
+ private final JPanel panelTable = new JPanel();
+ private final JPanel panelForm = new JPanel();
+ private final JPanel panelPictureID = new JPanel();
+ private final JPanel panelNom = new JPanel();
+ private final JPanel panelSexe = new JPanel();
+ private final JPanel panelRobe = new JPanel();
+ private final JPanel panelType = new JPanel();
+ private final JPanel panelRace = new JPanel();
+ private final JPanel panelProprietaire = new JPanel();
+ private final JPanel panelAge = new JPanel();
+ private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panelFormulaire, panelTable);
private final JTable tableChevaux = new JTable(dataChevaux, titresChevaux);
private final JScrollPane scrollTab = new JScrollPane(tableChevaux);
private final JLabel lbTitre = new JLabel(" Panneau de gestion des chevaux ");
- private final JLabel titreChevaux= new JLabel(" Liste des chevaux ");
private final JLabel lbRace = new JLabel(" Race : ");
private final JLabel lbRobe = new JLabel(" Robe : ");
private final JLabel lbId = new JLabel(" ID : ");
@@ -62,99 +62,78 @@ public class FormChevaux extends JPanel implements ActionListener
private final JButton btAnnuler = new JButton(" Annuler ");
private final JButton btAjouter = new JButton(" Valider ");
- public FormChevaux() {
-
+ public FormChevaux(){
this.setBackground(new Color(222,220,203));
- setLayout(new BorderLayout(0, 0));
+ setLayout(new BorderLayout(0, 0));
this.add(splitPane);
- panel.setPreferredSize(new Dimension(500, 10));
- panel.setLayout(new BorderLayout(0, 30));
- panel.add(panel_11);
- panel_11.setLayout(new GridLayout(0, 1, 0, 0));
- panel_11.add(panel_1);
- panel_1.setLayout(new GridLayout(1, 4, 0, 0));
+ panelFormulaire.setPreferredSize(new Dimension(500, 10));
+ panelFormulaire.setLayout(new BorderLayout(0, 30));
+ panelFormulaire.add(panelForm);
+ panelForm.setLayout(new GridLayout(0, 1, 0, 0));
+ panelForm.add(panelPictureID);
+ panelPictureID.setLayout(new GridLayout(1, 4, 0, 0));
lbId.setHorizontalAlignment(SwingConstants.RIGHT);
- lbId.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_1.add(lbId);
+ panelPictureID.add(lbId);
textId.setHorizontalAlignment(SwingConstants.CENTER);
- textId.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_1.add(textId);
- lbPhoto.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- imgPhoto.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelPictureID.add(textId);
imgPhoto.setHorizontalAlignment(SwingConstants.CENTER);
- panel_1.add(lbPhoto);
- panel_1.add(imgPhoto);
- panel_11.add(panel_2);
- panel_2.setLayout(new GridLayout(2, 1, 0, 0));
+ imgPhoto.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
+ panelPictureID.add(lbPhoto);
+ panelPictureID.add(imgPhoto);
+ panelForm.add(panelNom);
+ panelNom.setLayout(new GridLayout(2, 1, 0, 0));
lbNom.setHorizontalAlignment(SwingConstants.CENTER);
- lbNom.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_2.add(lbNom);
+ panelNom.add(lbNom);
textNom.setHorizontalAlignment(SwingConstants.CENTER);
- textNom.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_2.add(textNom);
- panel_11.add(panel_3);
- panel_3.setLayout(new GridLayout(1, 1, 0, 0));
+ PromptSupport.setPrompt("Indiquer le nom d'un cheval", textNom);
+ panelNom.add(textNom);
+ panelForm.add(panelSexe);
+ panelSexe.setLayout(new GridLayout(1, 1, 0, 0));
lbSexe.setHorizontalAlignment(SwingConstants.CENTER);
- lbSexe.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_3.add(lbSexe);
+ panelSexe.add(lbSexe);
groupSexe.add(textSexeF);
groupSexe.add(textSexeH);
- textSexeF.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textSexeF.setActionCommand("FEMELLE");
- panel_3.add(textSexeF);
- textSexeH.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textSexeH.setActionCommand("MALE");
- panel_3.add(textSexeH);
- panel_11.add(panel_8);
- panel_8.setLayout(new GridLayout(1, 1, 0, 0));
+ textSexeF.setActionCommand("FEMELLE");
+ panelSexe.add(textSexeF);
+ textSexeH.setActionCommand("MALE");
+ panelSexe.add(textSexeH);
+ panelForm.add(panelAge);
+ panelAge.setLayout(new GridLayout(1, 1, 0, 0));
lbAge.setHorizontalAlignment(SwingConstants.RIGHT);
- lbAge.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_8.add(lbAge);
+ panelAge.add(lbAge);
textAge.setHorizontalAlignment(SwingConstants.CENTER);
- textAge.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_8.add(textAge);
- panel_11.add(panel_4);
- panel_4.setLayout(new GridLayout(2, 1, 0, 0));
+ panelAge.add(textAge);
+ panelForm.add(panelRobe);
+ panelRobe.setLayout(new GridLayout(2, 1, 0, 0));
lbRobe.setHorizontalAlignment(SwingConstants.CENTER);
- lbRobe.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_4.add(lbRobe);
+ panelRobe.add(lbRobe);
textRobe.setHorizontalAlignment(SwingConstants.CENTER);
- textRobe.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_4.add(textRobe);
- panel_11.add(panel_5);
- panel_5.setLayout(new GridLayout(2, 1, 0, 0));
+ panelRobe.add(textRobe);
+ panelForm.add(panelType);
+ panelType.setLayout(new GridLayout(2, 1, 0, 0));
lbType.setHorizontalAlignment(SwingConstants.CENTER);
- lbType.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_5.add(lbType);
+ panelType.add(lbType);
textType.setHorizontalAlignment(SwingConstants.CENTER);
- textType.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_5.add(textType);
- panel_11.add(panel_6);
- panel_6.setLayout(new GridLayout(2, 1, 0, 0));
+ panelType.add(textType);
+ panelForm.add(panelRace);
+ panelRace.setLayout(new GridLayout(2, 1, 0, 0));
lbRace.setHorizontalAlignment(SwingConstants.CENTER);
- lbRace.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_6.add(lbRace);
+ panelRace.add(lbRace);
textRace.setHorizontalAlignment(SwingConstants.CENTER);
- textRace.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_6.add(textRace);
- panel_11.add(panel_7);
- panel_7.setLayout(new GridLayout(2, 1, 0, 0));
+ panelRace.add(textRace);
+ panelForm.add(panelProprietaire);
+ panelProprietaire.setLayout(new GridLayout(2, 1, 0, 0));
lbProprietaire.setHorizontalAlignment(SwingConstants.CENTER);
- lbProprietaire.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_7.add(lbProprietaire);
+ panelProprietaire.add(lbProprietaire);
textProprietaire.setHorizontalAlignment(SwingConstants.CENTER);
- textProprietaire.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_7.add(textProprietaire);
- panel_9.setPreferredSize(new Dimension(10, 30));
- panel.add(panel_9, BorderLayout.SOUTH);
- panel_9.setLayout(new GridLayout(1, 3, 40, 0));
- choiceForm.setFont(new Font("Book Antiqua", Font.BOLD, 15));
+ panelProprietaire.add(textProprietaire);
+ panelButton.setPreferredSize(new Dimension(20, 50));
+ panelFormulaire.add(panelButton, BorderLayout.SOUTH);
+ panelButton.setLayout(new GridLayout(1, 3, 40, 0));
choiceForm.setSelectedIndex(0);
- panel_9.add(choiceForm);
- btAnnuler.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_9.add(btAnnuler);
- btAjouter.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_9.add(btAjouter);
+ panelButton.add(choiceForm);
+ panelButton.add(btAnnuler);
+ panelButton.add(btAjouter);
choiceForm.addActionListener(this);
this.btAnnuler.addActionListener(this);
this.btAjouter.addActionListener(this);
@@ -166,18 +145,15 @@ public class FormChevaux extends JPanel implements ActionListener
}
}
});
- panel_10.setLayout(new BorderLayout(0, 0));
- lbTitre.setPreferredSize(new Dimension(160, 50));
+ panelTable.setLayout(new BorderLayout(0, 0));
+ lbTitre.setPreferredSize(new Dimension(150, 100));
lbTitre.setHorizontalAlignment(SwingConstants.CENTER);
- lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 25));
- panel_10.add(lbTitre, BorderLayout.NORTH);
- titreChevaux.setHorizontalAlignment(SwingConstants.CENTER);
- titreChevaux.setFont(new Font(titreChevaux.getText(), Font.CENTER_BASELINE, 20));
- panel_10.add(scrollTab, BorderLayout.CENTER);
+ lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 40));
+ panelTable.add(lbTitre, BorderLayout.NORTH);
+ panelTable.add(scrollTab, BorderLayout.CENTER);
tableChevaux.setShowVerticalLines(false);
tableChevaux.setEnabled(false);
tableChevaux.setRowHeight(30);
- tableChevaux.setFont(new Font("Arial Unicode MS", Font.PLAIN, 18));
}
@Override
@@ -206,7 +182,8 @@ public class FormChevaux extends JPanel implements ActionListener
this.textRace.setText(unCheval.getRace());
this.textProprietaire.setText(unCheval.getProprietaire());
this.textAge.setText(String.valueOf(unCheval.getAge()));
- this.imgPhoto.setIcon(new ImageIcon("//NASCCB/web/Ecurie" + unCheval.getImage()));
+ ImageIcon imageIcon = new ImageIcon(new ImageIcon("//NASCCB/web/Ecurie" + unCheval.getImage()).getImage().getScaledInstance(70, 85, Image.SCALE_DEFAULT));
+ this.imgPhoto.setIcon(imageIcon);
JOptionPane.showMessageDialog(this, " Visualisation réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
}
@@ -224,7 +201,7 @@ public class FormChevaux extends JPanel implements ActionListener
this.textId.setText("");this.imgPhoto.setIcon(new ImageIcon(""));
this.textNom.setText("");this.groupSexe.clearSelection();this.textAge.setText("");
this.textRobe.setText("");this.textType.setText("");this.textRace.setText("");this.textProprietaire.setText("");
- JOptionPane.showMessageDialog(this, " Insertion réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showMessageDialog(this, " Insertion réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
this.setVisible(true); // fin d'ajout
}
@@ -233,38 +210,21 @@ public class FormChevaux extends JPanel implements ActionListener
break;
case 2: //DELETE
try {
- if(textNom.getText().equals(""))
+ if(textNom.getText().equals(""))
{ JOptionPane.showMessageDialog(this, " Veuillez vérifier le nom du cheval ! "," Action refusé ",JOptionPane.ERROR_MESSAGE); }
- else {
+ else {
ModeleCheval.delete(textNom.getText());
this.textId.setText("");this.imgPhoto.setIcon(new ImageIcon(""));
this.textNom.setText("");this.groupSexe.clearSelection();this.textAge.setText("");
this.textRobe.setText("");this.textType.setText("");this.textRace.setText("");this.textProprietaire.setText("");
- JOptionPane.showMessageDialog(this, " Suppression réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showMessageDialog(this, " Suppression réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
this.setVisible(true);// fin de suppression
}
- catch (NumberFormatException exp)
+ catch (NumberFormatException exp)
{ JOptionPane.showMessageDialog(this," Veuillez vérifier tous les champs incorrects ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
break;
}
}
}
- //extraire les Chevaux
- public Object [][] extraireChevaux () {
- ArrayList lesChevaux = ModeleCheval.selectAll();
- Object [][] donnees = new Object [lesChevaux.size()][7];
- int i =0;
- for (Cheval unCheval : lesChevaux) {
- donnees[i][0] = unCheval.getNom();
- donnees[i][1] = unCheval.getSexe();
- donnees[i][2] = unCheval.getAge();
- donnees[i][3] = unCheval.getProprietaire();
- donnees[i][4] = unCheval.getRace();
- donnees[i][5] = unCheval.getRobe();
- donnees[i][6] = unCheval.getType();
- i++;
- }
- return donnees;
- }
}
\ No newline at end of file
diff --git a/src/vue/FormCours.java b/src/vue/FormCours.java
index b61bf3f..ab529f2 100644
--- a/src/vue/FormCours.java
+++ b/src/vue/FormCours.java
@@ -1,31 +1,225 @@
package vue;
import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
import javax.swing.*;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.table.TableModel;
+import javax.swing.table.TableRowSorter;
+import com.toedter.calendar.JDateChooser;
-public class FormCours extends JPanel
-{
- private static final long serialVersionUID = 3315083316143792281L;
- JPanel panel = new JPanel();
- JLabel lbCours = new JLabel("Votre Profil");
- JTextArea txtTitre = new JTextArea();
+import controleur.Cours;
+import modele.ModeleCours;
+import modele.ModeleCheval;
+import modele.ModeleEleve;
+import modele.ModeleFormateur;
+public class FormCours extends JPanel implements ActionListener {
+ private static final long serialVersionUID = -7935938065497628244L;
+ String prenom, nom, sexe, imagearticle;
+ int id, privilege, age, selection;
+ String[] formState = { " VISUALISER "/*, " AJOUTER ", " MODIFIER ", " SUPPRIMER " */};
+ String[] titresCour = new String[] {" Date "," Horaires "," Formateur "," Elève "," Cheval "};
+ String[] dataCategorie = new String[] {"00:00:00","00:30:00","01:00:00","01:30:00","02:00:00","02:30:00","03:00:00","03:30:00","04:00:00","04:30:00","05:00:00","05:30:00","06:00:00","06:30:00","07:00:00","07:30:00","08:00:00","08:30:00","09:00:00","09:30:00","10:00:00","10:30:00","11:00:00","11:30:00","12:00:00","12:30:00","13:00:00","13:30:00","14:00:00","14:30:00","15:00:00","15:30:00","16:00:00","16:30:00","17:00:00","17:30:00","18:00:00","18:30:00","19:00:00","19:30:00","20:00:00","20:30:00","21:00:00","21:30:00","22:00:00","22:30:00","23:00:00","23:30"};
+ Object[][] dataCour = ModeleCours.extraireCours();
+ Object[] dataChevaux = ModeleCheval.extraireChevaux();
+ Object[] dataEleves = ModeleEleve.extraireEleves();
+ Object[] dataFormateurs = ModeleFormateur.extraireFormateurs();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ private final JPanel panel = new JPanel();
+ private final JPanel panel_1 = new JPanel();
+ private final JPanel panel_2 = new JPanel();
+ private final JPanel panel_7 = new JPanel();
+ private final JPanel panel_8 = new JPanel();
+ private final JPanel panel_9 = new JPanel();
+ private final JPanel panel_10 = new JPanel();
+ private final JPanel panel_11 = new JPanel();
+ private final JPanel panel_13 = new JPanel();
+ private final JPanel panel_14 = new JPanel();
+ private final JPanel panel_15 = new JPanel();
+ private final JPanel panel_12 = new JPanel();
+ private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel_15, panel_14);
+ private final JTable tableCours = new JTable(dataCour, titresCour);
+ TableRowSorter sort = new TableRowSorter<>(tableCours.getModel());
+ private final JScrollPane scrollTab = new JScrollPane(tableCours);
+ private final JLabel lbTitre = new JLabel(" Panneau de gestion des cours ");
+ private final JLabel lbId = new JLabel(" ID : ");
+ private final JLabel lbDate = new JLabel(" Date : ");
+ private final JLabel lbHoraire = new JLabel(" Horaires : ");
+ private final JLabel lbNote = new JLabel(" Note : ");
+ private final JLabel lbCheval = new JLabel(" Cheval : ");
+ private final JLabel lbElève = new JLabel(" Elève : ");
+ private final JLabel lbFormateur = new JLabel(" Formateur : ");
+ private final JLabel lbvide1 = new JLabel("");
+ private final JLabel lbFiltre = new JLabel(" Filtre : ");
+ private final JLabel textId = new JLabel();
+ private final JDateChooser ChooserDate = new JDateChooser();
+ private final JTextField textFiltre = new JTextField();
+ private final JTextPane textNote = new JTextPane();
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private final JComboBox comboFormateur = new JComboBox(dataFormateurs);
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private final JComboBox comboEleve = new JComboBox(dataEleves);
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private final JComboBox comboCheval = new JComboBox(dataChevaux);
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private final JComboBox comboBox = new JComboBox(dataCategorie);
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private final JComboBox comboBox1 = new JComboBox(dataCategorie);
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private final JComboBox choiceForm = new JComboBox(formState);
+ private final JButton btAnnuler = new JButton(" Annuler ");
+ private final JButton btAjouter = new JButton(" Valider ");
+
+
public FormCours()
{
- this.setPreferredSize(new Dimension(500, 300));
- this.setBackground(new Color(222,220,203));
- this.setLayout(null);
- lbCours.setFont(new Font(lbCours.getText(), Font.CENTER_BASELINE + Font.BOLD, 20));
- add(panel);
- panel.setLayout(new BorderLayout(0, 0));
- panel.add(lbCours);
- txtTitre.setText("\n Date : A");
- txtTitre.setFont(new Font("Dialog", Font.PLAIN, 20));
- txtTitre.setEditable(false);
- txtTitre.setBackground(new Color(222, 220, 203));
- panel.add(txtTitre);
-
- this.setVisible(true);
+ this.setBackground(new Color(222,220,203));
+ setLayout(new BorderLayout(0, 0));
+ this.add(splitPane);
+
+ panel_15.setPreferredSize(new Dimension(500, 10));
+ panel_15.setLayout(new BorderLayout(0, 30));
+ panel_15.add(panel, BorderLayout.CENTER);
+ panel.setLayout(new GridLayout(0, 1, 0, 0));
+ panel.add(panel_1);
+ panel_1.setLayout(new GridLayout(1, 4, 0, 0));
+ lbId.setHorizontalAlignment(SwingConstants.RIGHT);
+ panel_1.add(lbId);
+ textId.setHorizontalAlignment(SwingConstants.CENTER);
+ panel_1.add(textId);
+ panel.add(panel_2);
+ panel_2.setLayout(new GridLayout(2, 1, 0, 0));
+ lbDate.setHorizontalAlignment(SwingConstants.CENTER);
+ panel_2.add(lbDate);
+ ChooserDate.setFont(new Font("Bodoni MT", Font.BOLD, 23));
+ ChooserDate.setDateFormatString("yyy-MM-dd");
+ panel_2.add(ChooserDate);
+ panel.add(panel_12);
+ panel_12.setLayout(new GridLayout(2, 1, 0, 0));
+ lbHoraire.setHorizontalAlignment(SwingConstants.CENTER);
+ panel_12.add(lbHoraire);
+ panel_12.add(lbvide1);
+ panel_12.add(comboBox);
+ panel_12.add(comboBox1);
+ panel.add(panel_10);
+ panel_10.setLayout(new GridLayout(2, 1, 0, 0));
+ lbFormateur.setHorizontalAlignment(SwingConstants.CENTER);
+ panel_10.add(lbFormateur);
+ panel_10.add(comboFormateur);
+ panel.add(panel_9);
+ panel_9.setLayout(new GridLayout(2, 1, 0, 0));
+ lbElève.setHorizontalAlignment(SwingConstants.CENTER);
+ panel_9.add(lbElève);
+ panel_9.add(comboEleve);
+ panel.add(panel_8);
+ panel_8.setLayout(new GridLayout(2, 1, 0, 0));
+ lbCheval.setHorizontalAlignment(SwingConstants.CENTER);
+ panel_8.add(lbCheval);
+ panel_8.add(comboCheval);
+ panel.add(panel_7);
+ panel_7.setLayout(new GridLayout(2, 1, 0, 0));
+ lbNote.setHorizontalAlignment(SwingConstants.CENTER);
+ panel_7.add(lbNote);
+ panel_7.add(textNote);
+ panel.add(panel_11);
+ panel_11.setLayout(new GridLayout(2, 1, 0, 0));
+ textFiltre.setHorizontalAlignment(SwingConstants.CENTER);
+ textFiltre.getDocument().addDocumentListener(new DocumentListener(){
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ String str = textFiltre.getText();
+ if (str.trim().length() == 0) {sort.setRowFilter(null);}
+ else {//(?i) recherche insensible à la casse
+ sort.setRowFilter(RowFilter.regexFilter("(?i)" + str));}
+ }
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ String str = textFiltre.getText();
+ if (str.trim().length() == 0) {sort.setRowFilter(null);}
+ else {sort.setRowFilter(RowFilter.regexFilter("(?i)" + str));}
+ }
+ @Override
+ public void changedUpdate(DocumentEvent e) {}
+ });
+
+
+ textFiltre.getDocument().addDocumentListener(new DocumentListener(){
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ String str = textFiltre.getText();
+ if (str.trim().length() == 0) {sort.setRowFilter(null);}
+ else {//(?i) recherche insensible à la casse
+ sort.setRowFilter(RowFilter.regexFilter("(?i)" + str));}
+ }
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ String str = textFiltre.getText();
+ if (str.trim().length() == 0) {sort.setRowFilter(null);}
+ else {sort.setRowFilter(RowFilter.regexFilter("(?i)" + str));}
+ }
+ @Override
+ public void changedUpdate(DocumentEvent e) {}
+ });
+ lbFiltre.setHorizontalAlignment(SwingConstants.CENTER);
+ panel_11.add(lbFiltre);
+ panel_11.add(textFiltre);
+ panel_13.setPreferredSize(new Dimension(20, 50));
+ panel_15.add(panel_13, BorderLayout.SOUTH);
+ panel_13.setLayout(new GridLayout(1, 3, 40, 0));
+ choiceForm.setSelectedIndex(0);
+ panel_13.add(choiceForm);
+ panel_13.add(btAnnuler);
+ panel_13.add(btAjouter);
+ this.choiceForm.addActionListener(this);
+ this.btAnnuler.addActionListener(this);
+ this.btAjouter.addActionListener(this);
+ panel_14.setLayout(new BorderLayout(0, 0));
+ lbTitre.setPreferredSize(new Dimension(150, 100));
+ lbTitre.setHorizontalAlignment(SwingConstants.CENTER);
+ lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 40));
+ panel_14.add(lbTitre, BorderLayout.NORTH);
+ panel_14.add(scrollTab, BorderLayout.CENTER);
+ tableCours.setShowVerticalLines(false);
+ tableCours.setRowSorter(sort);
+ tableCours.setEnabled(true);
+ tableCours.setRowHeight(30);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if(e.getSource()==this.btAnnuler) {
+ this.textId.setText("");this.textNote.setText("");this.textFiltre.setText("");this.ChooserDate.setDate(null);
+ this.comboBox.setSelectedIndex(0);this.comboBox1.setSelectedIndex(0);this.comboCheval.setSelectedIndex(0);
+ this.comboEleve.setSelectedIndex(0);this.comboFormateur.setSelectedIndex(0);
+ }
+ else if (e.getSource()==this.btAjouter) {
+ Cours unCour = ModeleCours.selectWhere(sdf.format(ChooserDate.getDate())/*, comboBox.setSelectedIndex(), comboBox1.setSelectedIndex()*/);
+ switch(choiceForm.getSelectedIndex()) {
+ case 0: //VISUALISE
+ {
+ if(unCour == null)
+ { JOptionPane.showMessageDialog(this, "Aucun cours ne correspond.\n Vérifier la date du cours !"," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
+ else {
+ this.textId.setText(String.valueOf(unCour.getIdCours()));
+ try {this.ChooserDate.setDate(sdf.parse(unCour.getDateCours()));} catch (ParseException e1) {e1.printStackTrace();}
+ this.comboBox.setSelectedItem(unCour.getHeureDebut());
+ this.comboBox1.setSelectedItem(unCour.getHeureFin());
+ this.comboCheval.setSelectedIndex(unCour.getIdCheval());
+ this.comboEleve.setSelectedIndex(unCour.getIdEleve());
+ this.comboFormateur.setSelectedIndex(unCour.getIdFormateur());
+ this.textNote.setText(unCour.getNote());
+ JOptionPane.showMessageDialog(this, " Visualisation réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
+ }
+ }
+ break;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/vue/FormEleves.java b/src/vue/FormEleves.java
index 8da60f8..f0770fd 100644
--- a/src/vue/FormEleves.java
+++ b/src/vue/FormEleves.java
@@ -2,13 +2,16 @@ package vue;
import java.awt.*;
import javax.swing.*;
+import javax.swing.border.EtchedBorder;
import javax.swing.table.TableColumnModel;
+import org.jdesktop.swingx.prompt.PromptSupport;
+
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.util.ArrayList;
+import java.text.SimpleDateFormat;
import controleur.Eleve;
import modele.ModeleEleve;
@@ -20,28 +23,27 @@ public class FormEleves extends JPanel implements ActionListener
int id, privilege, age, selection;
String[] galop= { "0", "1", "2", "3", "4", "5", "6", "7" };
String[] formState = { " VISUALISER ", " AJOUTER ", " MODIFIER ", " SUPPRIMER " };
- String[] titresEleve = new String[] {" Pseudo "," E-mail "," Prénom "," Nom "," Adresse "," Sexe "," Age "," Galop "};
- Object[][] dataEleve = extraireEleves();
- private final JPanel panel = new JPanel();
- private final JPanel panel_1 = new JPanel();
- private final JPanel panel_2 = new JPanel();
- private final JPanel panel_3 = new JPanel();
- private final JPanel panel_4 = new JPanel();
- private final JPanel panel_5 = new JPanel();
- private final JPanel panel_6 = new JPanel();
- private final JPanel panel_7 = new JPanel();
- private final JPanel panel_8 = new JPanel();
- private final JPanel panel_9 = new JPanel();
- private final JPanel panel_10 = new JPanel();
- private final JPanel panel_11 = new JPanel();
- private final JPanel panel_13 = new JPanel();
- private final JPanel panel_14 = new JPanel();
- private final JPanel panel_15 = new JPanel();
- private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel_15, panel_14);
+ String[] titresEleve = new String[] {" Pseudo "," E-mail "," Elève "," Adresse "," Sexe "," Age "," Galop "};
+ Object[][] dataEleve = ModeleEleve.extraireEleves2();
+ private final JPanel panelForm = new JPanel();
+ private final JPanel panelPrivilegeID = new JPanel();
+ private final JPanel panelRecord = new JPanel();
+ private final JPanel panelAvatar = new JPanel();
+ private final JPanel panelPseudo = new JPanel();
+ private final JPanel panelMail = new JPanel();
+ private final JPanel panelMdp = new JPanel();
+ private final JPanel panelPrenom = new JPanel();
+ private final JPanel panelNom = new JPanel();
+ private final JPanel panelSexe = new JPanel();
+ private final JPanel panelGalopAge = new JPanel();
+ private final JPanel panelAdresse = new JPanel();
+ private final JPanel panelButton = new JPanel();
+ private final JPanel panelTable = new JPanel();
+ private final JPanel panelFormulaire = new JPanel();
+ private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panelFormulaire, panelTable);
private final JTable tableEleves = new JTable(dataEleve, titresEleve);
private final JScrollPane scrollTab = new JScrollPane(tableEleves);
private final JLabel lbTitre = new JLabel(" Panneau de gestion des élèves ");
- private final JLabel titreFormateur= new JLabel(" Liste des élèves ");
private final JLabel lbGalop = new JLabel(" Galop : ");
private final JLabel lbId = new JLabel(" ID : ");
private final JLabel lbPrivilege = new JLabel(" Privilège : ");
@@ -76,132 +78,102 @@ public class FormEleves extends JPanel implements ActionListener
private final JButton btAnnuler = new JButton(" Annuler ");
private final JButton btAjouter = new JButton(" Valider ");
- public FormEleves()
- {
+ public FormEleves(){
this.setBackground(new Color(222,220,203));
setLayout(new BorderLayout(0, 0));
this.add(splitPane);
- panel_15.setPreferredSize(new Dimension(500, 10));
- panel_15.setLayout(new BorderLayout(0, 30));
- panel_15.add(panel, BorderLayout.CENTER);
- panel.setLayout(new GridLayout(0, 1, 0, 0));
+ panelFormulaire.setPreferredSize(new Dimension(500, 10));
+ panelFormulaire.setLayout(new BorderLayout(0, 30));
+ panelFormulaire.add(panelForm, BorderLayout.CENTER);
+ panelForm.setLayout(new GridLayout(0, 1, 0, 0));
lbAvatar.setHorizontalAlignment(SwingConstants.RIGHT);
lbAvatar.setIcon(new ImageIcon(imageeleve));
- panel.add(panel_1);
- panel_1.setLayout(new GridLayout(0, 4, 0, 0));
+ panelForm.add(panelPrivilegeID);
+ panelPrivilegeID.setLayout(new GridLayout(0, 4, 0, 0));
lbId.setHorizontalAlignment(SwingConstants.RIGHT);
- lbId.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- textId.setFont(new Font("Bodoni MT", Font.BOLD, 20));
textId.setHorizontalAlignment(SwingConstants.CENTER);
- panel_1.add(lbId);
- panel_1.add(textId);
- panel_1.add(lbPrivilege);
- panel_1.add(textPrivilege);
+ panelPrivilegeID.add(lbId);
+ panelPrivilegeID.add(textId);
+ panelPrivilegeID.add(lbPrivilege);
+ panelPrivilegeID.add(textPrivilege);
lbPrivilege.setHorizontalAlignment(SwingConstants.RIGHT);
- lbPrivilege.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- textPrivilege.setFont(new Font("Bodoni MT", Font.BOLD, 20));
textPrivilege.setHorizontalAlignment(SwingConstants.CENTER);
- panel.add(panel_2);
- panel_2.setLayout(new GridLayout(1, 2, 0, 0));
+ panelForm.add(panelRecord);
+ panelRecord.setLayout(new GridLayout(1, 2, 0, 0));
lbRecord.setHorizontalAlignment(SwingConstants.RIGHT);
- lbRecord.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_2.add(lbRecord);
- textRecord.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelRecord.add(lbRecord);
textRecord.setHorizontalAlignment(SwingConstants.CENTER);
- panel_2.add(textRecord);
- panel_3.setPreferredSize(new Dimension(0, 100));
- panel.add(panel_3);
- panel_3.setLayout(new GridLayout(1, 1, 0, 0));
- lbAvatar.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- imgAvatar.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelRecord.add(textRecord);
+ panelAvatar.setPreferredSize(new Dimension(0, 100));
+ panelForm.add(panelAvatar);
+ panelAvatar.setLayout(new GridLayout(1, 1, 0, 0));
+ imgAvatar.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
imgAvatar.setHorizontalAlignment(SwingConstants.CENTER);
- panel_3.add(lbAvatar);
- panel_3.add(imgAvatar);
- panel.add(panel_4);
- panel_4.setLayout(new GridLayout(1, 1, 0, 0));
+ panelAvatar.add(lbAvatar);
+ panelAvatar.add(imgAvatar);
+ panelForm.add(panelPseudo);
+ panelPseudo.setLayout(new GridLayout(1, 1, 0, 0));
lbPseudo.setHorizontalAlignment(SwingConstants.RIGHT);
- lbPseudo.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_4.add(lbPseudo);
- textPseudo.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelPseudo.add(lbPseudo);
textPseudo.setHorizontalAlignment(SwingConstants.CENTER);
- panel_4.add(textPseudo);
- panel.add(panel_5);
- panel.add(panel_6);
- panel_6.setLayout(new GridLayout(2, 1, 0, 0));
+ panelPseudo.add(textPseudo);
+ panelForm.add(panelMail);
+ panelForm.add(panelMdp);
+ panelMdp.setLayout(new GridLayout(2, 1, 0, 0));
lbMdp.setHorizontalAlignment(SwingConstants.CENTER);
- lbMdp.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_6.add(lbMdp);
+ panelMdp.add(lbMdp);
textMail.setHorizontalAlignment(SwingConstants.CENTER);
- textMail.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textMdp.setFont(new Font("Bell MT", Font.BOLD, 20));
+ PromptSupport.setPrompt("Indiquer l'e-mail d'un élève", textMail);
textMdp.setHorizontalAlignment(SwingConstants.CENTER);
- panel_6.add(textMdp);
- panel_5.setLayout(new GridLayout(2, 1, 0, 0));
+ panelMdp.add(textMdp);
+ panelMail.setLayout(new GridLayout(2, 1, 0, 0));
lbMail.setHorizontalAlignment(SwingConstants.CENTER);
- lbMail.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_5.add(lbMail);
- textMail.setFont(new Font("Bodoni MT", Font.BOLD, 18));
- panel_5.add(textMail);
- panel.add(panel_7);
- panel_7.setLayout(new GridLayout(2, 1, 0, 0));
+ panelMail.add(lbMail);
+ panelMail.add(textMail);
+ panelForm.add(panelPrenom);
+ panelPrenom.setLayout(new GridLayout(2, 1, 0, 0));
lbPrenom.setHorizontalAlignment(SwingConstants.CENTER);
- lbPrenom.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_7.add(lbPrenom);
+ panelPrenom.add(lbPrenom);
textPrenom.setHorizontalAlignment(SwingConstants.CENTER);
- textPrenom.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_7.add(textPrenom);
- panel.add(panel_8);
- panel_8.setLayout(new GridLayout(2, 1, 0, 0));
+ panelPrenom.add(textPrenom);
+ panelForm.add(panelNom);
+ panelNom.setLayout(new GridLayout(2, 1, 0, 0));
lbNom.setHorizontalAlignment(SwingConstants.CENTER);
- lbNom.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_8.add(lbNom);
+ panelNom.add(lbNom);
textNom.setHorizontalAlignment(SwingConstants.CENTER);
- textNom.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_8.add(textNom);
- panel.add(panel_11);
- panel_11.setLayout(new GridLayout(2, 1, 0, 0));
+ panelNom.add(textNom);
+ panelForm.add(panelAdresse);
+ panelAdresse.setLayout(new GridLayout(2, 1, 0, 0));
lbAdresse.setHorizontalAlignment(SwingConstants.CENTER);
- lbAdresse.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_11.add(lbAdresse);
+ panelAdresse.add(lbAdresse);
textAdresse.setHorizontalAlignment(SwingConstants.CENTER);
- textAdresse.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_11.add(textAdresse);
- panel_9.setLayout(new GridLayout(1, 1, 0, 0));
+ panelAdresse.add(textAdresse);
+ panelSexe.setLayout(new GridLayout(1, 1, 0, 0));
lbSexe.setHorizontalAlignment(SwingConstants.CENTER);
- lbSexe.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel.add(panel_9);
- panel_9.add(lbSexe);
+ panelForm.add(panelSexe);
+ panelSexe.add(lbSexe);
groupSexe.add(textSexeF);
groupSexe.add(textSexeH);
- textSexeF.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textSexeF.setActionCommand("FEMME");
- panel_9.add(textSexeF);
- textSexeH.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textSexeH.setActionCommand("HOMME");
- panel_9.add(textSexeH);
- panel.add(panel_10);
- panel_10.setLayout(new GridLayout(1, 4, 0, 0));
+ textSexeF.setActionCommand("FEMME");
+ panelSexe.add(textSexeF);
+ textSexeH.setActionCommand("HOMME");
+ panelSexe.add(textSexeH);
+ panelForm.add(panelGalopAge);
+ panelGalopAge.setLayout(new GridLayout(1, 4, 0, 0));
lbAge.setHorizontalAlignment(SwingConstants.RIGHT);
- lbAge.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_10.add(lbAge);
- textAge.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelGalopAge.add(lbAge);
textAge.setHorizontalAlignment(SwingConstants.CENTER);
- panel_10.add(textAge);
+ panelGalopAge.add(textAge);
lbGalop.setHorizontalAlignment(SwingConstants.RIGHT);
- lbGalop.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_10.add(lbGalop);
- textGalop.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_10.add(textGalop);
- panel_13.setPreferredSize(new Dimension(10, 30));
- panel_15.add(panel_13, BorderLayout.SOUTH);
- panel_13.setLayout(new GridLayout(1, 3, 40, 0));
- choiceForm.setFont(new Font("Book Antiqua", Font.BOLD, 15));
+ panelGalopAge.add(lbGalop);
+ panelGalopAge.add(textGalop);
+ panelButton.setPreferredSize(new Dimension(20, 50));
+ panelFormulaire.add(panelButton, BorderLayout.SOUTH);
+ panelButton.setLayout(new GridLayout(1, 3, 40, 0));
choiceForm.setSelectedIndex(0);
- panel_13.add(choiceForm);
- btAnnuler.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_13.add(btAnnuler);
- btAjouter.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_13.add(btAjouter);
+ panelButton.add(choiceForm);
+ panelButton.add(btAnnuler);
+ panelButton.add(btAjouter);
this.choiceForm.addActionListener(this);
this.btAnnuler.addActionListener(this);
this.btAjouter.addActionListener(this);
@@ -213,27 +185,23 @@ public class FormEleves extends JPanel implements ActionListener
}
}
});
- titreFormateur.setHorizontalAlignment(SwingConstants.CENTER);
- titreFormateur.setFont(new Font(titreFormateur.getText(), Font.CENTER_BASELINE, 20));
- panel_14.setLayout(new BorderLayout(0, 0));
- lbTitre.setPreferredSize(new Dimension(160, 50));
+ panelTable.setLayout(new BorderLayout(0, 0));
+ lbTitre.setPreferredSize(new Dimension(150, 100));
lbTitre.setHorizontalAlignment(SwingConstants.CENTER);
- lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 25));
- panel_14.add(lbTitre, BorderLayout.NORTH);
- panel_14.add(scrollTab, BorderLayout.CENTER);
+ lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 40));
+ panelTable.add(lbTitre, BorderLayout.NORTH);
+ panelTable.add(scrollTab, BorderLayout.CENTER);
tableEleves.setShowVerticalLines(false);
tableEleves.setEnabled(false);
tableEleves.setRowHeight(30);
- tableEleves.setFont(new Font("Arial Unicode MS", Font.PLAIN, 18));
TableColumnModel columnModel = tableEleves.getColumnModel();
columnModel.getColumn(0).setPreferredWidth(50);
columnModel.getColumn(1).setPreferredWidth(80);
- columnModel.getColumn(2).setPreferredWidth(50);
- columnModel.getColumn(3).setPreferredWidth(50);
- columnModel.getColumn(4).setPreferredWidth(100);
+ columnModel.getColumn(2).setPreferredWidth(80);
+ columnModel.getColumn(3).setPreferredWidth(100);
+ columnModel.getColumn(4).setPreferredWidth(10);
columnModel.getColumn(5).setPreferredWidth(10);
columnModel.getColumn(6).setPreferredWidth(10);
- columnModel.getColumn(7).setPreferredWidth(10);
}
@Override
public void actionPerformed(ActionEvent e) {
@@ -254,7 +222,7 @@ public class FormEleves extends JPanel implements ActionListener
else {
this.textId.setText(String.valueOf(unEleve.getId()));
this.textPrivilege.setText(String.valueOf(unEleve.getPrivilege()));
- this.textRecord.setText(unEleve.getRecord());
+ this.textRecord.setText(new SimpleDateFormat("dd MMMM yyyy").format(unEleve.getRecord()));
this.textPseudo.setText(unEleve.getPseudo());
this.textPrenom.setText(unEleve.getPrenom());
this.textNom.setText(unEleve.getNom());
@@ -266,7 +234,8 @@ public class FormEleves extends JPanel implements ActionListener
this.textMdp.setText(unEleve.getMdp());
//mail
this.textGalop.setSelectedIndex(unEleve.getGalop());
- this.imgAvatar.setIcon(new ImageIcon("//NASCCB/web/Ecurie" + unEleve.getImageEleve()));
+ ImageIcon imageIcon = new ImageIcon(new ImageIcon("//NASCCB/web/Ecurie" + unEleve.getImageEleve()).getImage().getScaledInstance(60, 60, Image.SCALE_DEFAULT));
+ this.imgAvatar.setIcon(imageIcon);
JOptionPane.showMessageDialog(this, " Visualisation réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
}
@@ -328,23 +297,4 @@ public class FormEleves extends JPanel implements ActionListener
}
}
}
-
- //extraire les Eleves
- public Object [][] extraireEleves () {
- ArrayList lesEleves = ModeleEleve.selectAll();
- Object [][] donnees = new Object [lesEleves.size()][8];
- int i =0;
- for (Eleve unEleve : lesEleves) {
- donnees[i][0] = unEleve.getPseudo();
- donnees[i][1] = unEleve.getMail();
- donnees[i][2] = unEleve.getPrenom();
- donnees[i][3] = unEleve.getNom();
- donnees[i][4] = unEleve.getAdresse();
- donnees[i][5] = unEleve.getSexe();
- donnees[i][6] = unEleve.getAge();
- donnees[i][7] = unEleve.getGalop();
- i++;
- }
- return donnees;
- }
}
\ No newline at end of file
diff --git a/src/vue/FormEvents.java b/src/vue/FormEvents.java
index 9338ff7..9737c55 100644
--- a/src/vue/FormEvents.java
+++ b/src/vue/FormEvents.java
@@ -2,152 +2,143 @@ package vue;
import java.awt.*;
import javax.swing.*;
+import javax.swing.border.EtchedBorder;
import javax.swing.table.TableColumnModel;
+import org.jdesktop.swingx.prompt.PromptSupport;
+
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.util.ArrayList;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import controleur.Event;
import modele.ModeleEvent;
-
+import com.toedter.calendar.JDateChooser;
public class FormEvents extends JPanel implements ActionListener {
private static final long serialVersionUID = -7935938065497628244L;
String prenom, nom, sexe, imageevent;
int id, privilege, age, selection;
+ Date dateevent;
String[] formState = { " VISUALISER ", " AJOUTER ", " MODIFIER ", " SUPPRIMER " };
- String[] titresEvent = new String[] {" Référence "," Categorie "," Evenement "," Description "," Prix "," Lieu ", " Date "};
- Object[][] dataEvent = extraireEvents();
- private final JPanel panel = new JPanel();
- private final JPanel panel_1 = new JPanel();
- private final JPanel panel_2 = new JPanel();
- private final JPanel panel_7 = new JPanel();
- private final JPanel panel_8 = new JPanel();
- private final JPanel panel_9 = new JPanel();
- private final JPanel panel_10 = new JPanel();
- private final JPanel panel_11 = new JPanel();
- private final JPanel panel_13 = new JPanel();
- private final JPanel panel_14 = new JPanel();
- private final JPanel panel_15 = new JPanel();
- private final JPanel panel_12 = new JPanel();
- private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel_15, panel_14);
+ String[] titresEvent = new String[] {" Référence "," Evènement "," Description "," Prix "," Lieu ", " Date "," Catégorie "};
+ Object[][] dataEvent = ModeleEvent.extraireEvents();
+ Object[] dataCategorie = ModeleEvent.extraireCategories();
+ private final JPanel panelForm = new JPanel();
+ private final JPanel panelImageID = new JPanel();
+ private final JPanel panelReference = new JPanel();
+ private final JPanel panelDescription = new JPanel();
+ private final JPanel panelPrix = new JPanel();
+ private final JPanel panelDate = new JPanel();
+ private final JPanel panelLieu = new JPanel();
+ private final JPanel panelNom = new JPanel();
+ private final JPanel panelButton = new JPanel();
+ private final JPanel panelTable = new JPanel();
+ private final JPanel panelFormulaire = new JPanel();
+ private final JPanel panelCategorie = new JPanel();
+ private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panelFormulaire, panelTable);
private final JTable tableEvents = new JTable(dataEvent, titresEvent);
private final JScrollPane scrollTab = new JScrollPane(tableEvents);
- private final JLabel lbTitre = new JLabel(" Panneau de Gestion des Evenements ");
+ private final JLabel lbTitre = new JLabel(" Panneau de gestion des évènements ");
private final JLabel lbId = new JLabel(" ID : ");
- private final JLabel lbReference = new JLabel(" Référence de l'évènement : ");
- private final JLabel lbCategorie = new JLabel(" Catégorie de l'évènement : ");
- private final JLabel lbPrix = new JLabel(" Prix de l'évènement (\u20AC) : ");
+ private final JLabel lbReference = new JLabel(" Référence : ");
+ private final JLabel lbCategorie = new JLabel(" Catégorie : ");
+ private final JLabel lbPrix = new JLabel(" Prix (\u20AC) : ");
private final JLabel lbDescription = new JLabel(" Description : ");
- private final JLabel lbLibelle = new JLabel(" Nom de l'évènement : ");
- private final JLabel lbLieu = new JLabel(" Lieu de l'évènement : ");
- private final JLabel lbDate = new JLabel(" Date de l'évènement : ");
+ private final JLabel lbLibelle = new JLabel(" Nom : ");
+ private final JLabel lbLieu = new JLabel(" Lieu : ");
+ private final JLabel lbDate = new JLabel(" Date : ");
private final JLabel lbImage = new JLabel(" Image : ");
private final JLabel imgImage = new JLabel();
private final JLabel textId = new JLabel();
private final JTextField textReference = new JTextField();
- private final JTextField textCategorie = new JTextField();
private final JTextField textLibelle = new JTextField();
private final JTextField textPrix = new JTextField();
private final JTextField textLieu = new JTextField();
- private final JTextField textDate = new JTextField();
+ private final JDateChooser dateChooser = new JDateChooser();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final JTextPane textDescription = new JTextPane();
@SuppressWarnings({ "rawtypes", "unchecked" })
private final JComboBox choiceForm = new JComboBox(formState);
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private final JComboBox comboBox = new JComboBox(dataCategorie);
private final JButton btAnnuler = new JButton(" Annuler ");
private final JButton btAjouter = new JButton(" Valider ");
+
public FormEvents()
{
this.setBackground(new Color(222,220,203));
setLayout(new BorderLayout(0, 0));
this.add(splitPane);
- panel_15.setPreferredSize(new Dimension(500, 10));
- panel_15.setLayout(new BorderLayout(0, 30));
- panel_15.add(panel, BorderLayout.CENTER);
- panel.setLayout(new GridLayout(0, 1, 0, 0));
- panel.add(panel_1);
- panel_1.setLayout(new GridLayout(1, 4, 0, 0));
+ panelFormulaire.setPreferredSize(new Dimension(500, 10));
+ panelFormulaire.setLayout(new BorderLayout(0, 30));
+ panelFormulaire.add(panelForm, BorderLayout.CENTER);
+ panelForm.setLayout(new GridLayout(0, 1, 0, 0));
+ panelForm.add(panelImageID);
+ panelImageID.setLayout(new GridLayout(1, 4, 0, 0));
lbId.setHorizontalAlignment(SwingConstants.RIGHT);
- lbId.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_1.add(lbId);
- textId.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelImageID.add(lbId);
textId.setHorizontalAlignment(SwingConstants.CENTER);
- panel_1.add(textId);
- lbImage.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- imgImage.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelImageID.add(textId);
imgImage.setHorizontalAlignment(SwingConstants.CENTER);
- panel_1.add(lbImage);
- panel_1.add(imgImage);
- panel.add(panel_2);
- panel_2.setLayout(new GridLayout(2, 1, 0, 0));
+ imgImage.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
+ panelImageID.add(lbImage);
+ panelImageID.add(imgImage);
+ panelForm.add(panelReference);
+ panelReference.setLayout(new GridLayout(2, 1, 0, 0));
lbReference.setHorizontalAlignment(SwingConstants.CENTER);
- lbReference.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_2.add(lbReference);
- textReference.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelReference.add(lbReference);
textReference.setHorizontalAlignment(SwingConstants.CENTER);
- panel_2.add(textReference);
- panel.add(panel_12);
- panel_12.setLayout(new GridLayout(2, 1, 0, 0));
- lbCategorie.setHorizontalAlignment(SwingConstants.CENTER);
- lbCategorie.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_12.add(lbCategorie);
- textCategorie.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textCategorie.setHorizontalAlignment(SwingConstants.CENTER);
- panel_12.add(textCategorie);
- panel.add(panel_11);
- panel_11.setLayout(new GridLayout(2, 1, 0, 0));
+ PromptSupport.setPrompt("Indiquer la référence d'un évènement", textReference);
+ panelReference.add(textReference);
+ panelForm.add(panelNom);
+ panelNom.setLayout(new GridLayout(2, 1, 0, 0));
lbLibelle.setHorizontalAlignment(SwingConstants.CENTER);
- lbLibelle.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_11.add(lbLibelle);
- textLibelle.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelNom.add(lbLibelle);
textLibelle.setHorizontalAlignment(SwingConstants.CENTER);
- panel_11.add(textLibelle);
- panel.add(panel_7);
- panel_7.setLayout(new GridLayout(2, 1, 0, 0));
+ panelNom.add(textLibelle);
+ panelForm.add(panelDescription);
+ panelDescription.setLayout(new GridLayout(2, 1, 0, 0));
lbDescription.setHorizontalAlignment(SwingConstants.CENTER);
- lbDescription.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_7.add(lbDescription);
- textDescription.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- panel_7.add(textDescription);
- panel.add(panel_10);
- panel_10.setLayout(new GridLayout(2, 1, 0, 0));
+ panelDescription.add(lbDescription);
+ panelDescription.add(textDescription);
+ panelForm.add(panelLieu);
+ panelLieu.setLayout(new GridLayout(2, 1, 0, 0));
lbLieu.setHorizontalAlignment(SwingConstants.CENTER);
- lbLieu.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_10.add(lbLieu);
- textLieu.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelLieu.add(lbLieu);
textLieu.setHorizontalAlignment(SwingConstants.CENTER);
- panel_10.add(textLieu);
- panel.add(panel_9);
- panel_9.setLayout(new GridLayout(2, 1, 0, 0));
+ panelLieu.add(textLieu);
+ panelForm.add(panelDate);
+ panelDate.setLayout(new GridLayout(2, 1, 0, 0));
lbDate.setHorizontalAlignment(SwingConstants.CENTER);
- lbDate.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_9.add(lbDate);
- textDate.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textDate.setHorizontalAlignment(SwingConstants.CENTER);
- panel_9.add(textDate);
- panel.add(panel_8);
- panel_8.setLayout(new GridLayout(1, 1, 0, 0));
+ panelDate.add(lbDate);
+ dateChooser.setFont(new Font("Bodoni MT", Font.BOLD, 23));
+ dateChooser.setDateFormatString("dd MMMM yyyy");
+ panelDate.add(dateChooser);
+ panelForm.add(panelCategorie);
+ panelCategorie.setLayout(new GridLayout(2, 1, 0, 0));
+ lbCategorie.setHorizontalAlignment(SwingConstants.CENTER);
+ panelCategorie.add(lbCategorie);
+ panelCategorie.add(comboBox);
+ panelForm.add(panelPrix);
+ panelPrix.setLayout(new GridLayout(1, 1, 0, 0));
lbPrix.setHorizontalAlignment(SwingConstants.RIGHT);
- lbPrix.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_8.add(lbPrix);
- textPrix.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelPrix.add(lbPrix);
textPrix.setHorizontalAlignment(SwingConstants.CENTER);
- panel_8.add(textPrix);
- panel_13.setPreferredSize(new Dimension(10, 30));
- panel_15.add(panel_13, BorderLayout.SOUTH);
- panel_13.setLayout(new GridLayout(1, 3, 40, 0));
- choiceForm.setFont(new Font("Book Antiqua", Font.BOLD, 15));
+ panelPrix.add(textPrix);
+ panelButton.setPreferredSize(new Dimension(20, 50));
+ panelFormulaire.add(panelButton, BorderLayout.SOUTH);
+ panelButton.setLayout(new GridLayout(1, 3, 40, 0));
choiceForm.setSelectedIndex(0);
- panel_13.add(choiceForm);
- btAnnuler.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_13.add(btAnnuler);
- btAjouter.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_13.add(btAjouter);
+ panelButton.add(choiceForm);
+ panelButton.add(btAnnuler);
+ panelButton.add(btAjouter);
choiceForm.addActionListener(this);
this.btAnnuler.addActionListener(this);
this.btAjouter.addActionListener(this);
@@ -159,32 +150,32 @@ public class FormEvents extends JPanel implements ActionListener {
}
}
});
- panel_14.setLayout(new BorderLayout(0, 0));
- lbTitre.setPreferredSize(new Dimension(160, 50));
+ panelTable.setLayout(new BorderLayout(0, 0));
+ lbTitre.setPreferredSize(new Dimension(150, 100));
lbTitre.setHorizontalAlignment(SwingConstants.CENTER);
- lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 25));
- panel_14.add(lbTitre, BorderLayout.NORTH);
- panel_14.add(scrollTab, BorderLayout.CENTER);
+ lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 40));
+ panelTable.add(lbTitre, BorderLayout.NORTH);
+ panelTable.add(scrollTab, BorderLayout.CENTER);
tableEvents.setShowVerticalLines(false);
tableEvents.setEnabled(false);
tableEvents.setRowHeight(30);
- tableEvents.setFont(new Font("Arial Unicode MS", Font.PLAIN, 18));
TableColumnModel columnModel = tableEvents.getColumnModel();
- columnModel.getColumn(0).setPreferredWidth(10);
- columnModel.getColumn(1).setPreferredWidth(10);
- columnModel.getColumn(2).setPreferredWidth(100);
- columnModel.getColumn(3).setPreferredWidth(300);
+ columnModel.getColumn(0).setPreferredWidth(50);
+ columnModel.getColumn(1).setPreferredWidth(100);
+ columnModel.getColumn(2).setPreferredWidth(300);
+ columnModel.getColumn(3).setPreferredWidth(10);
columnModel.getColumn(4).setPreferredWidth(10);
- columnModel.getColumn(5).setPreferredWidth(10);
- columnModel.getColumn(6).setPreferredWidth(100);
+ columnModel.getColumn(5).setPreferredWidth(100);
+ columnModel.getColumn(6).setPreferredWidth(50);
}
-
+
@Override
public void actionPerformed(ActionEvent e) {
+
if(e.getSource()==this.btAnnuler) {
this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
- this.textReference.setText("");this.textCategorie.setText("");this.textDescription.setText("");
- this.textLibelle.setText("");this.textPrix.setText("");this.textLieu.setText("");this.textDate.setText("");
+ this.textReference.setText("");this.comboBox.setSelectedIndex(0);this.textDescription.setText("");
+ this.textLibelle.setText("");this.textPrix.setText("");this.textLieu.setText("");this.dateChooser.setDate(null);
}
else if (e.getSource()==this.btAjouter) {
Event unEvent = ModeleEvent.selectWhere(textReference.getText());
@@ -193,55 +184,56 @@ public class FormEvents extends JPanel implements ActionListener {
{
if(unEvent == null)
{ JOptionPane.showMessageDialog(this, "Veuillez vérifier la reference d'évènement !"," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
- else {
+ else {
this.textId.setText(String.valueOf(unEvent.getId()));
this.textReference.setText(unEvent.getReference());
- this.textCategorie.setText(unEvent.getCategorie());
+ this.comboBox.setSelectedIndex(unEvent.getidCategorie());
this.textDescription.setText(unEvent.getDescription());
this.textLibelle.setText(unEvent.getLibelle());
this.textPrix.setText(String.valueOf(unEvent.getPrix()));
this.textLieu.setText(unEvent.getLieu());
- this.textDate.setText(unEvent.getDate());
- this.imgImage.setIcon(new ImageIcon("//NASCCB/web/Ecurie" + unEvent.getImageEvent()));
+ try {this.dateChooser.setDate(sdf.parse(unEvent.getDate()));} catch (ParseException e1) {e1.printStackTrace();}
+ ImageIcon imageIcon = new ImageIcon(new ImageIcon("//NASCCB/web/Ecurie" + unEvent.getImageEvent()).getImage().getScaledInstance(65, 80, Image.SCALE_DEFAULT));
+ this.imgImage.setIcon(imageIcon);
JOptionPane.showMessageDialog(this, " Visualisation réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
}
break;
case 1: //AJOUTER
try{
- if((textReference.getText().equals(""))||(textCategorie.getText().equals(""))||(textDescription.getText().equals(""))||(textLibelle.getText().equals(""))||(textPrix.getText().equals(""))||(textLieu.getText().equals(""))||(textDate.getText().equals("")))
+ if((textReference.getText().equals(""))||(comboBox.getSelectedIndex() == 0)||(textDescription.getText().equals(""))||(textLibelle.getText().equals(""))||(textPrix.getText().equals(""))||(textLieu.getText().equals(""))||(dateChooser.getDate().equals(null)))
{ JOptionPane.showMessageDialog(this," Veuillez vérifier tous les champs incorrects ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
else if(unEvent != null)
{ JOptionPane.showMessageDialog(this, " La référence saisi est déjà existante ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
else {
- Event insertEvent = new Event(textReference.getText(), textCategorie.getText(), textDescription.getText(), textLibelle.getText(), Integer.parseInt(textPrix.getText()), textLieu.getText(), textDate.getText());
+ Event insertEvent = new Event(textReference.getText(), comboBox.getSelectedIndex(), textDescription.getText(), textLibelle.getText(), Integer.parseInt(textPrix.getText()), textLieu.getText(), sdf.format(dateChooser.getDate()));
ModeleEvent.insert(insertEvent);
this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
- this.textReference.setText("");this.textCategorie.setText("");this.textDescription.setText("");
- this.textLibelle.setText("");this.textPrix.setText("");this.textLieu.setText("");this.textDate.setText("");
+ this.textReference.setText("");this.comboBox.setSelectedIndex(0);this.textDescription.setText("");
+ this.textLibelle.setText("");this.textPrix.setText("");this.textLieu.setText("");this.dateChooser.setDate(null);
JOptionPane.showMessageDialog(this, " Insertion réalisé avec succès ! " ," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
- { JOptionPane.showMessageDialog(this," Veuillez vérifier tous les champs incorrects ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
+ { JOptionPane.showMessageDialog(this," Veuillez vérifier tous les champs et formats incorrects ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
break;
case 2: //MODIFIER
try{
if(textReference.getText().equals(""))
{ JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs vide"); }
else {
- Event editEvent = new Event(textReference.getText(), textCategorie.getText(), textDescription.getText(), textLibelle.getText(), Integer.parseInt(textPrix.getText()), textLieu.getText(), textDate.getText());
+ Event editEvent = new Event(textReference.getText(), comboBox.getSelectedIndex(), textDescription.getText(), textLibelle.getText(), Integer.parseInt(textPrix.getText()), textLieu.getText(), sdf.format(dateChooser.getDate()));
ModeleEvent.update(editEvent, textReference.getText());
this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
- this.textReference.setText("");this.textCategorie.setText("");this.textDescription.setText("");
- this.textLibelle.setText("");this.textPrix.setText("");this.textLieu.setText("");this.textDate.setText("");
+ this.textReference.setText("");this.comboBox.setSelectedIndex(0);this.textDescription.setText("");
+ this.textLibelle.setText("");this.textPrix.setText("");this.textLieu.setText("");this.dateChooser.setDate(null);
JOptionPane.showMessageDialog(this, " Modification reussie avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
this.setVisible(true); // fin d'enregistrement
}
- catch (NumberFormatException exp) {
- }
+ catch (NumberFormatException exp)
+ { JOptionPane.showMessageDialog(this," Veuillez vérifier tous les champs et formats incorrects ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
break;
case 3://SUPPRIMER
try {
@@ -250,8 +242,8 @@ public class FormEvents extends JPanel implements ActionListener {
else {
ModeleEvent.delete(textReference.getText());
this.textId.setText("");this.imgImage.setIcon(new ImageIcon(""));
- this.textReference.setText("");this.textCategorie.setText("");this.textDescription.setText("");
- this.textLibelle.setText("");this.textPrix.setText("");this.textLieu.setText("");this.textDate.setText("");
+ this.textReference.setText("");this.comboBox.setSelectedIndex(0);this.textDescription.setText("");
+ this.textLibelle.setText("");this.textPrix.setText("");this.textLieu.setText("");this.dateChooser.setDate(null);
JOptionPane.showMessageDialog(this, " Suppression réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
this.setVisible(true);// fin d'enregistrement
@@ -262,22 +254,4 @@ public class FormEvents extends JPanel implements ActionListener {
}
}
}
-
- //extraire les Events
- public Object [][] extraireEvents () {
- ArrayList lesEvents = ModeleEvent.selectAll();
- Object [][] donnees = new Object [lesEvents.size()][7];
- int i =0;
- for (Event unEvent : lesEvents) {
- donnees[i][0] = unEvent.getReference();
- donnees[i][1] = unEvent.getCategorie();
- donnees[i][2] = unEvent.getLibelle();
- donnees[i][3] = unEvent.getDescription();
- donnees[i][4] = unEvent.getPrix();
- donnees[i][5] = unEvent.getLieu();
- donnees[i][6] = unEvent.getDate();
- i++;
- }
- return donnees;
- }
}
\ No newline at end of file
diff --git a/src/vue/FormFormateurs.java b/src/vue/FormFormateurs.java
index 022f98f..48d0c09 100644
--- a/src/vue/FormFormateurs.java
+++ b/src/vue/FormFormateurs.java
@@ -4,11 +4,11 @@ import java.awt.*;
import javax.swing.*;
import javax.swing.table.TableColumnModel;
+import org.jdesktop.swingx.prompt.PromptSupport;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
-import java.util.ArrayList;
import java.awt.event.KeyAdapter;
import controleur.Formateur;
@@ -17,31 +17,29 @@ import modele.ModeleFormateur;
public class FormFormateurs extends JPanel implements ActionListener
{
private static final long serialVersionUID = -7023992128997426855L;
- String test, login, prenom, nom, sexe, mail, mdp= "";
+ String test, prenom, nom, sexe, mail, mdp= "";
int id, privilege, age, selection;
String[] galop= { "0", "1", "2", "3", "4", "5", "6", "7" };
String[] formState = { " VISUALISER ", " AJOUTER ", " SUPPRIMER " };
- String[] titresFormateur = new String[] {" Pseudo "," E-mail "," Prénom "," Nom "," Sexe "," Age "," Galop "};
- Object[][] dataFormateur = extraireFormateurs();
- private final JPanel panel = new JPanel();
- private final JPanel panel_1 = new JPanel();
- private final JPanel panel_3 = new JPanel();
- private final JPanel panel_4 = new JPanel();
- private final JPanel panel_5 = new JPanel();
- private final JPanel panel_6 = new JPanel();
- private final JPanel panel_7 = new JPanel();
- private final JPanel panel_8 = new JPanel();
- private final JPanel panel_11 = new JPanel();
- private final JPanel panel_12 = new JPanel();
- private final JPanel panel_13 = new JPanel();
- private final JPanel panel_10 = new JPanel();
- private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel_13, panel_12);
+ String[] titresFormateur = new String[] {" E-mail "," Formateur "," Sexe "," Age "," Galop "};
+ Object[][] dataFormateur = ModeleFormateur.extraireFormateurs2();
+ private final JPanel panelForm = new JPanel();
+ private final JPanel panelPrivilegeID = new JPanel();
+ private final JPanel panelMail = new JPanel();
+ private final JPanel panelMdp = new JPanel();
+ private final JPanel panelPrenom = new JPanel();
+ private final JPanel panelNom = new JPanel();
+ private final JPanel panelGalopAge = new JPanel();
+ private final JPanel panelButton = new JPanel();
+ private final JPanel panelTable = new JPanel();
+ private final JPanel panelFormulaire = new JPanel();
+ private final JPanel panelSexe = new JPanel();
+ private final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panelFormulaire, panelTable);
private final JTable tableFormateurs = new JTable(dataFormateur, titresFormateur);
private final JScrollPane scrollTab = new JScrollPane(tableFormateurs);
private final JLabel lbTitre = new JLabel(" Panneau de gestion des formateurs ");
private final JLabel lbId = new JLabel(" ID : ");
private final JLabel lbPrivilege = new JLabel(" Privilège : ");
- private final JLabel lbLogin = new JLabel("Pseudo : ");
private final JLabel lbMail = new JLabel(" E-mail : ");
private final JLabel lbMdp = new JLabel(" Mot de passe : ");
private final JLabel lbPrenom = new JLabel(" Prénom : ");
@@ -49,9 +47,7 @@ public class FormFormateurs extends JPanel implements ActionListener
private final JLabel lbAge = new JLabel(" Age : ");
private final JLabel lbSexe = new JLabel(" Sexe : ");
private final JLabel lbGalop = new JLabel(" Galop : ");
- private final JLabel titreFormateur= new JLabel(" Liste des Formateurs ");
private final JLabel textId = new JLabel();
- private final JLabel textLogin = new JLabel();
private final JLabel textPrivilege = new JLabel();
private final JPasswordField textMdp = new JPasswordField();
private final JTextField textPrenom = new JTextField();
@@ -72,101 +68,72 @@ public class FormFormateurs extends JPanel implements ActionListener
{
setLayout(new BorderLayout(0, 0));
this.add(splitPane);
- panel_13.setPreferredSize(new Dimension(500, 10));
- panel_13.setLayout(new BorderLayout(0, 30));
- panel_13.add(panel, BorderLayout.CENTER);
- panel.setLayout(new GridLayout(0, 1, 0, 0));
- panel.add(panel_1);
- panel_1.setLayout(new GridLayout(1, 4, 0, 0));
+ panelFormulaire.setPreferredSize(new Dimension(500, 10));
+ panelFormulaire.setLayout(new BorderLayout(0, 30));
+ panelFormulaire.add(panelForm, BorderLayout.CENTER);
+ panelForm.setLayout(new GridLayout(0, 1, 0, 0));
+ panelForm.add(panelPrivilegeID);
+ panelPrivilegeID.setLayout(new GridLayout(1, 4, 0, 0));
lbId.setHorizontalAlignment(SwingConstants.RIGHT);
- lbId.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_1.add(lbId);
- textId.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelPrivilegeID.add(lbId);
textId.setHorizontalAlignment(SwingConstants.CENTER);
- panel_1.add(textId);
+ panelPrivilegeID.add(textId);
lbPrivilege.setHorizontalAlignment(SwingConstants.RIGHT);
- lbPrivilege.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_1.add(lbPrivilege);
- textPrivilege.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelPrivilegeID.add(lbPrivilege);
textPrivilege.setHorizontalAlignment(SwingConstants.CENTER);
- panel_1.add(textPrivilege);
- panel.add(panel_3);
- panel_3.setLayout(new GridLayout(1, 1, 0, 0));
- lbLogin.setHorizontalAlignment(SwingConstants.RIGHT);
- lbLogin.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_3.add(lbLogin);
- textLogin.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textLogin.setHorizontalAlignment(SwingConstants.CENTER);
- panel_3.add(textLogin);
- panel.add(panel_4);
- panel.add(panel_5);
- panel_5.setLayout(new GridLayout(0, 1, 0, 0));
+ panelPrivilegeID.add(textPrivilege);
+ panelForm.add(panelMail);
+ panelForm.add(panelMdp);
+ panelMdp.setLayout(new GridLayout(0, 1, 0, 0));
lbMdp.setHorizontalAlignment(SwingConstants.CENTER);
- lbMdp.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_5.add(lbMdp);
- textMdp.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelMdp.add(lbMdp);
textMdp.setHorizontalAlignment(SwingConstants.CENTER);
- panel_5.add(textMdp);
- panel_4.setLayout(new GridLayout(2, 1, 0, 0));
+ panelMdp.add(textMdp);
+ panelMail.setLayout(new GridLayout(2, 1, 0, 0));
lbMail.setHorizontalAlignment(SwingConstants.CENTER);
- lbMail.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_4.add(lbMail);
- textMail.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelMail.add(lbMail);
textMail.setHorizontalAlignment(SwingConstants.CENTER);
- panel_4.add(textMail);
- panel.add(panel_6);
- panel_6.setLayout(new GridLayout(2, 1, 0, 0));
+ PromptSupport.setPrompt("Indiquer l'e-mail d'un formateur", textMail);
+ panelMail.add(textMail);
+ panelForm.add(panelPrenom);
+ panelPrenom.setLayout(new GridLayout(2, 1, 0, 0));
lbPrenom.setHorizontalAlignment(SwingConstants.CENTER);
- lbPrenom.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_6.add(lbPrenom);
- textPrenom.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelPrenom.add(lbPrenom);
textPrenom.setHorizontalAlignment(SwingConstants.CENTER);
- panel_6.add(textPrenom);
- panel.add(panel_7);
- panel_7.setLayout(new GridLayout(2, 1, 0, 0));
+ panelPrenom.add(textPrenom);
+ panelForm.add(panelNom);
+ panelNom.setLayout(new GridLayout(2, 1, 0, 0));
lbNom.setHorizontalAlignment(SwingConstants.CENTER);
- lbNom.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_7.add(lbNom);
- textNom.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelNom.add(lbNom);
textNom.setHorizontalAlignment(SwingConstants.CENTER);
- panel_7.add(textNom);
- panel_10.setLayout(new GridLayout(1, 3, 0, 0));
+ panelNom.add(textNom);
+ panelSexe.setLayout(new GridLayout(1, 3, 0, 0));
lbSexe.setHorizontalAlignment(SwingConstants.CENTER);
- lbSexe.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel.add(panel_10);
- panel_10.add(lbSexe);
+ panelForm.add(panelSexe);
+ panelSexe.add(lbSexe);
groupSexe.add(textSexeF);
groupSexe.add(textSexeH);
- textSexeF.setFont(new Font("Bodoni MT", Font.BOLD, 20));
textSexeF.setActionCommand("FEMME");
- panel_10.add(textSexeF);
- textSexeH.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelSexe.add(textSexeF);
textSexeH.setActionCommand("HOMME");
- panel_10.add(textSexeH);
- panel.add(panel_8);
- panel_8.setLayout(new GridLayout(1, 4, 0, 0));
+ panelSexe.add(textSexeH);
+ panelForm.add(panelGalopAge);
+ panelGalopAge.setLayout(new GridLayout(1, 4, 0, 0));
lbAge.setHorizontalAlignment(SwingConstants.RIGHT);
- lbAge.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_8.add(lbAge);
- textAge.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelGalopAge.add(lbAge);
textAge.setHorizontalAlignment(SwingConstants.CENTER);
- panel_8.add(textAge);
+ panelGalopAge.add(textAge);
lbGalop.setHorizontalAlignment(SwingConstants.RIGHT);
- lbGalop.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_8.add(lbGalop);
- textGalop.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ panelGalopAge.add(lbGalop);
textGalop.setSelectedIndex(0);
- panel_8.add(textGalop);
- panel_11.setPreferredSize(new Dimension(10, 30));
- panel_13.add(panel_11, BorderLayout.SOUTH);
- panel_11.setLayout(new GridLayout(1, 3, 40, 0));
- choiceForm.setFont(new Font("Book Antiqua", Font.BOLD, 15));
+ panelGalopAge.add(textGalop);
+ panelButton.setPreferredSize(new Dimension(23, 50));
+ panelFormulaire.add(panelButton, BorderLayout.SOUTH);
+ panelButton.setLayout(new GridLayout(1, 3, 40, 0));
choiceForm.setSelectedIndex(0);
- panel_11.add(choiceForm);
- btAnnuler.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_11.add(btAnnuler);
- btAjouter.setFont(new Font("Book Antiqua", Font.BOLD, 15));
- panel_11.add(btAjouter);
+ panelButton.add(choiceForm);
+ panelButton.add(btAnnuler);
+ panelButton.add(btAjouter);
choiceForm.addActionListener(this);
this.btAnnuler.addActionListener(this);
this.btAjouter.addActionListener(this);
@@ -178,34 +145,29 @@ public class FormFormateurs extends JPanel implements ActionListener
}
}
});
- titreFormateur.setHorizontalAlignment(SwingConstants.CENTER);
- titreFormateur.setFont(new Font(titreFormateur.getText(), Font.CENTER_BASELINE, 20));
- panel_12.setLayout(new BorderLayout(0, 0));
- lbTitre.setPreferredSize(new Dimension(160, 50));
+ panelTable.setLayout(new BorderLayout(0, 0));
+ lbTitre.setPreferredSize(new Dimension(150, 100));
lbTitre.setHorizontalAlignment(SwingConstants.CENTER);
- lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 25));
- panel_12.add(lbTitre, BorderLayout.NORTH);
- panel_12.add(scrollTab, BorderLayout.CENTER);
+ lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 40));
+ panelTable.add(lbTitre, BorderLayout.NORTH);
+ panelTable.add(scrollTab, BorderLayout.CENTER);
tableFormateurs.setShowVerticalLines(false);
tableFormateurs.setEnabled(false);
tableFormateurs.setRowHeight(30);
- tableFormateurs.setFont(new Font("Arial Unicode MS", Font.PLAIN, 18));
TableColumnModel columnModel = tableFormateurs.getColumnModel();
- columnModel.getColumn(0).setPreferredWidth(50);
- columnModel.getColumn(1).setPreferredWidth(150);
- columnModel.getColumn(2).setPreferredWidth(50);
- columnModel.getColumn(3).setPreferredWidth(50);
+ columnModel.getColumn(0).setPreferredWidth(150);
+ columnModel.getColumn(1).setPreferredWidth(80);
+ columnModel.getColumn(2).setPreferredWidth(10);
+ columnModel.getColumn(3).setPreferredWidth(10);
columnModel.getColumn(4).setPreferredWidth(10);
- columnModel.getColumn(5).setPreferredWidth(10);
- columnModel.getColumn(6).setPreferredWidth(10);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==this.btAnnuler) {
- this.textId.setText("");this.textLogin.setText("");this.textPrivilege.setText("");
- this.textPrenom.setText("");this.textNom.setText("");this.textMail.setText("");this.textMdp.setText("");
+ this.textId.setText("");this.textPrivilege.setText("");
+ this.textPrenom.setText("");this.textNom.setText("");this.textMail.setText("");this.textMdp.setText("");
this.textAge.setText("");this.textGalop.setSelectedIndex(0);this.groupSexe.clearSelection();
}
else if (e.getSource()==this.btAjouter) {
@@ -213,22 +175,21 @@ public class FormFormateurs extends JPanel implements ActionListener
Formateur unCompte = ModeleFormateur.selectCompte(textMail.getText(),new String(this.textMdp.getPassword()));
switch(choiceForm.getSelectedIndex()) {
case 0: //VISUALISE
- {
+ {
if(unEleve == null)
{ JOptionPane.showMessageDialog(this, " Veuillez vérifier l'adresse mail saisie ! "," Erreur de saisie ",JOptionPane.ERROR_MESSAGE); }
- else {
+ else {
this.textId.setText(String.valueOf(unEleve.getId()));
this.textPrivilege.setText(String.valueOf(unEleve.getPrivilege()));
- this.textLogin.setText(unEleve.getLogin());
//mail
this.textMdp.setText(unEleve.getMdp());
this.textPrenom.setText(unEleve.getPrenom());
this.textNom.setText(unEleve.getNom());
this.textAge.setText(String.valueOf(unEleve.getAge()));
- this.textGalop.setSelectedIndex(unEleve.getGalop());
+ this.textGalop.setSelectedIndex(unEleve.getGalop());
if (unEleve.getSexe().equals("FEMME")){textSexeF.setSelected(true);}
else if (unEleve.getSexe().equals("HOMME")){textSexeH.setSelected(true);}
- else {this.groupSexe.clearSelection();}
+ else {this.groupSexe.clearSelection();}
JOptionPane.showMessageDialog(this, " Visualisation réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
}
@@ -257,9 +218,9 @@ public class FormFormateurs extends JPanel implements ActionListener
{ JOptionPane.showMessageDialog(this, " Veuillez vérifier l'adresse e-mail et confirmer le mot de passe ! "," Action refusé ",JOptionPane.ERROR_MESSAGE); }
else {
ModeleFormateur.delete(textMail.getText());
- this.textId.setText("");this.textPrivilege.setText("");this.textLogin.setText("");
+ this.textId.setText("");this.textPrivilege.setText("");
this.textPrenom.setText("");this.textNom.setText("");this.textMail.setText("");this.textMdp.setText("");
- this.groupSexe.clearSelection();this.textAge.setText("");this.textGalop.setSelectedIndex(0);
+ this.groupSexe.clearSelection();this.textAge.setText("");this.textGalop.setSelectedIndex(0);
JOptionPane.showMessageDialog(this, " Suppression réalisé avec succès ! "," Action réussie ",JOptionPane.INFORMATION_MESSAGE);
}
this.setVisible(true);// fin de suppression
@@ -270,22 +231,4 @@ public class FormFormateurs extends JPanel implements ActionListener
}
}
}
- //extraire les Formateurs
- public Object [][] extraireFormateurs () {
- ArrayList lesFormateurs = ModeleFormateur.selectAll();
- Object [][] donnees = new Object [lesFormateurs.size()][7];
- int i =0;
- for (Formateur unFormateur : lesFormateurs)
- {
- donnees[i][0] = unFormateur.getLogin();
- donnees[i][1] = unFormateur.getMail();
- donnees[i][2] = unFormateur.getPrenom();
- donnees[i][3] = unFormateur.getNom();
- donnees[i][4] = unFormateur.getSexe();
- donnees[i][5] = unFormateur.getAge();
- donnees[i][6] = unFormateur.getGalop();
- i++;
- }
- return donnees;
- }
}
\ No newline at end of file
diff --git a/src/vue/Generale.java b/src/vue/Generale.java
index 9243ee1..d36ab9c 100644
--- a/src/vue/Generale.java
+++ b/src/vue/Generale.java
@@ -6,6 +6,7 @@ import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+
import controleur.Gestion;
import controleur.Formateur;
@@ -14,145 +15,146 @@ public class Generale extends JFrame implements ActionListener
private static final long serialVersionUID = -4529974363596089889L;
/*VARIABLE*/
private JPanel contentPane = new JPanel();
- ImageIcon logo = new ImageIcon(new ImageIcon("src/images/favicon.png").getImage());
- JMenuBar menuBar = new JMenuBar();
- JMenu mnGestion = new JMenu(" Gestion ");
- JMenu mnEcurie = new JMenu(" Centre ");
- JMenuItem itemAccueil = new JMenuItem(" Accueil ");
- JMenuItem itemList = new JMenuItem(" Listes ");
- JMenuItem itemQuitter = new JMenuItem(" Quitter ");
- JMenuItem itemFormsEleves = new JMenuItem(" Elèves ");
- JMenuItem itemFormsChevaux = new JMenuItem(" Chevaux ");
- JMenuItem itemFormsFormateurs = new JMenuItem(" Formateurs ");
- JMenuItem itemFormsArticles = new JMenuItem(" Articles ");
- JMenuItem itemFormsEvenements = new JMenuItem(" Evenements ");
- JMenuItem itemFormsCours = new JMenuItem(" Cours ");
-
+ ImageIcon logo = new ImageIcon(new ImageIcon(Generale.class.getResource("/image/favicon.png")).getImage());
+ JMenuBar menuBar = new JMenuBar();
+ JMenu mnEcurie = new JMenu(" Fichier ");
+ JMenuItem itemAccueil = new JMenuItem(" Accueil ");
+ JMenuItem itemQuitter = new JMenuItem(" Quitter ");
+ JMenuItem itemFormsCours = new JMenuItem(" Cours ");
+ JToolBar toolBar = new JToolBar();
+ JButton btnCheval = new JButton(new ImageIcon(Generale.class.getResource("/image/cheval.png")));
+ JButton btnFormateur = new JButton(new ImageIcon(Generale.class.getResource("/image/formateur.png")));
+ JButton btnEleve = new JButton(new ImageIcon(Generale.class.getResource("/image/eleve.png")));
+ JButton btnEvent = new JButton(new ImageIcon(Generale.class.getResource("/image/event.png")));
+ JButton btnArticle = new JButton(new ImageIcon(Generale.class.getResource("/image/article.png")));
+ JButton btnCours = new JButton(new ImageIcon(Generale.class.getResource("/image/cours.png")));
+
private final JPanel panel = new JPanel();
+ private final JPanel panel_2 = new JPanel();
private final JPanel panelCheval = new JPanel();
- private final FormFormateurs uneFormFormateur = new FormFormateurs();
- private final JPanel panelList = new JPanel();
private final JPanel panelEleve = new JPanel();
private final JPanel panelFormateur = new JPanel();
private final JPanel panelArticle = new JPanel();
private final JPanel panelEvenement = new JPanel();
private final JPanel panelCour = new JPanel();
private final JPanel panelAcceuil = new JPanel();
- private final VueList uneVueList = new VueList();
private final VueAccueil uneVueAccueil;
+ private final FormFormateurs uneFormFormateur = new FormFormateurs();
private final FormEleves uneFormEleve = new FormEleves();
private final FormArticles uneFormArticle = new FormArticles();
private final FormChevaux uneFormCheval = new FormChevaux();
private final FormEvents uneFormEvent = new FormEvents();
private final FormCours uneFormCour = new FormCours();
- JPanel[] panels=new JPanel[]{panelAcceuil,panelEleve,panelCheval,panelFormateur,panelArticle,panelEvenement,panelCour,panelList};
+ JPanel[] panels=new JPanel[]{panelAcceuil,panelEleve,panelCheval,panelFormateur,panelArticle,panelEvenement,panelCour};
- /*AFFICHAGE GENERAL APPLI*/
- public Generale(Formateur unFormateur) {
+
+ public Generale(Formateur unFormateur) {
this.uneVueAccueil = new VueAccueil(unFormateur);
this.setSize(1800, 1000);
- this.setLocationRelativeTo(null);
- this.setDefaultCloseOperation(EXIT_ON_CLOSE);
+ this.setLocationRelativeTo(null);
+ this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setIconImage(logo.getImage());
- this.setTitle("Ecurie");
+ this.setTitle("Ecurie");
menuBar.setBackground(new Color(89, 137, 76));
menuBar.setFont(new Font("Segoe UI", Font.PLAIN, 12));
- menuBar.setPreferredSize(new Dimension(0, 40));
- this.setJMenuBar(this.MenuBar());
+ menuBar.setPreferredSize(new Dimension(0, 60));
+ this.setJMenuBar(this.MenuBar());
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- contentPane.setBackground(new Color(222,220,203));
- setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(0, 0));
- JLabel lbTitre = new JLabel(" Bienvenue " + unFormateur.getPrenom() + " " + unFormateur.getNom());
- lbTitre.setPreferredSize(new Dimension(250, 100));
- lbTitre.setHorizontalAlignment(SwingConstants.CENTER);lbTitre.setFont(new Font("Book Antiqua", Font.BOLD, 25));
- getContentPane().add(lbTitre, BorderLayout.NORTH);
- contentPane.add(panel, BorderLayout.CENTER);
+ setContentPane(contentPane);
+ toolBar.setPreferredSize(new Dimension(80, 100));
+ getContentPane().add(this.createToolBar(), BorderLayout.NORTH);
+ panel_2.setLayout(new BorderLayout(0, 0));
+ getContentPane().add(panel_2, BorderLayout.CENTER);
panel.setLayout(new CardLayout(0, 0));
+ panel_2.add(panel, BorderLayout.CENTER);
panel.add(panelFormateur, "");
- panelFormateur.setLayout(new CardLayout(0, 0));
+ panelFormateur.setLayout(new CardLayout(0, 0));
panelFormateur.add(uneFormFormateur, "");
uneFormFormateur.setLayout(new GridLayout(1, 0, 0, 0));
- panel.add(panelList, "");
- panelList.setLayout(new CardLayout(0, 0));
- panelList.add(uneVueList, "");
- uneVueList.setLayout(new GridLayout(1, 0, 0, 0));
panel.add(panelAcceuil, "");
- panelAcceuil.setLayout(new CardLayout(0, 0));
+ panelAcceuil.setLayout(new CardLayout(0, 0));
panelAcceuil.add(uneVueAccueil, "");
uneVueAccueil.setLayout(new GridLayout(1, 0, 0, 0));
panel.add(panelEleve, "");
- panelEleve.setLayout(new CardLayout(0, 0));
+ panelEleve.setLayout(new CardLayout(0, 0));
panelEleve.add(uneFormEleve, "");
uneFormEleve.setLayout(new GridLayout(1, 0, 0, 0));
panel.add(panelCheval, "");
- panelCheval.setLayout(new CardLayout(0, 0));
+ panelCheval.setLayout(new CardLayout(0, 0));
panelCheval.add(uneFormCheval, "");
uneFormCheval.setLayout(new GridLayout(1, 0, 0, 0));
panel.add(panelArticle, "");
- panelArticle.setLayout(new CardLayout(0, 0));
+ panelArticle.setLayout(new CardLayout(0, 0));
panelArticle.add(uneFormArticle, "");
uneFormArticle.setLayout(new GridLayout(1, 0, 0, 0));
panel.add(panelEvenement, "");
- panelEvenement.setLayout(new CardLayout(0, 0));
+ panelEvenement.setLayout(new CardLayout(0, 0));
panelEvenement.add(uneFormEvent, "");
uneFormEvent.setLayout(new GridLayout(1, 0, 0, 0));
panel.add(panelCour, "");
- panelCour.setLayout(new CardLayout(0, 0));
+ panelCour.setLayout(new CardLayout(0, 0));
panelCour.add(uneFormCour, "");
uneFormCour.setLayout(new GridLayout(1, 0, 0, 0));
panelAcceuil.setVisible(true);
- panelList.setVisible(false);
panelFormateur.setVisible(false);
panelEleve.setVisible(false);
- panelCheval.setVisible(false);
+ panelCheval.setVisible(false);
panelArticle.setVisible(false);
panelEvenement.setVisible(false);
panelCour.setVisible(false);
this.setVisible(true);
}
- public JMenuBar MenuBar() {
- /*BARRE MENU GROUPE*/
- mnEcurie.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
+ public JMenuBar MenuBar() {
+ /*BARRE MENU GROUPE*/
+ mnEcurie.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 22));
menuBar.add(this.mnEcurie);
- mnGestion.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
- menuBar.add(this.mnGestion);
/*BARRE MENU LISTE GROUPE*/
- itemAccueil.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
+ itemAccueil.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 22));
this.mnEcurie.add(this.itemAccueil);
- itemList.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
- this.mnEcurie.add(this.itemList);
- itemQuitter.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
+ itemQuitter.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 22));
this.mnEcurie.add(this.itemQuitter);
- itemFormsFormateurs.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
- this.mnGestion.add(this.itemFormsFormateurs);
- itemFormsEleves.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
- this.mnGestion.add(this.itemFormsEleves);
- itemFormsChevaux.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
- this.mnGestion.add(this.itemFormsChevaux);
- itemFormsArticles.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
- this.mnGestion.add(this.itemFormsArticles);
- itemFormsEvenements.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
- this.mnGestion.add(this.itemFormsEvenements);
- itemFormsCours.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 18));
- this.mnGestion.add(this.itemFormsCours);
+ itemFormsCours.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 22));
+ getContentPane().add(this.itemFormsCours);
this.itemQuitter.addActionListener(this);
this.itemAccueil.addActionListener(this);
- this.itemList.addActionListener(this);
- this.itemFormsEleves.addActionListener(this);
- this.itemFormsChevaux.addActionListener(this);
- this.itemFormsArticles.addActionListener(this);
- this.itemFormsEvenements.addActionListener(this);
this.itemFormsCours.addActionListener(this);
- this.itemFormsFormateurs.addActionListener(this);
return menuBar;
}
+ public JToolBar createToolBar() {
+ btnFormateur.setToolTipText("Gestion des formateurs");
+ toolBar.add(btnFormateur);
+ toolBar.addSeparator();
+ btnEleve.setToolTipText("Gestion des élèves");
+ toolBar.add(btnEleve);
+ toolBar.addSeparator();
+ btnCheval.setToolTipText("Gestion des chevaux");
+ toolBar.add(btnCheval);
+ toolBar.addSeparator();
+ btnArticle.setToolTipText("Gestion des articles");
+ toolBar.add(btnArticle);
+ toolBar.addSeparator();
+ btnEvent.setToolTipText("Gestion des évènements");
+ toolBar.add(btnEvent);
+ toolBar.addSeparator();
+ btnFormateur.setToolTipText("Gestion des cours");
+ toolBar.add(btnCours);
+ this.btnEleve.addActionListener(this);
+ this.btnFormateur.addActionListener(this);
+ this.btnCheval.addActionListener(this);
+ this.btnArticle.addActionListener(this);
+ this.btnEvent.addActionListener(this);
+ this.btnCours.addActionListener(this);
+
+ return toolBar;
+ }
/*ACTION GENERAL APPLI MenuBar*/
@Override
public void actionPerformed(ActionEvent e)
-{
+{ UIManager.put("JLabel.font", new Font("Arial", Font.PLAIN, 50));
+
if(e.getSource() == this.itemQuitter) {
Gestion.rendreVisible(true);
this.setVisible(false);
@@ -163,47 +165,41 @@ public void actionPerformed(ActionEvent e)
panelAcceuil.setVisible(true);
}
}
- else if (e.getSource()==this.itemFormsEleves) {
+ else if (e.getSource()==this.btnEleve) {
for (JPanel panel : panels) {
panel.setVisible(false);
panelEleve.setVisible(true);
}
}
- else if (e.getSource()==this.itemFormsChevaux) {
+ else if (e.getSource()==this.btnCheval) {
for (JPanel panel : panels) {
panel.setVisible(false);
panelCheval.setVisible(true);
}
}
- else if (e.getSource()==this.itemFormsFormateurs) {
+ else if (e.getSource()==this.btnFormateur) {
for (JPanel panel : panels) {
panel.setVisible(false);
panelFormateur.setVisible(true);
}
}
- else if (e.getSource()==this.itemFormsArticles) {
+ else if (e.getSource()==this.btnArticle) {
for (JPanel panel : panels) {
panel.setVisible(false);
panelArticle.setVisible(true);
}
}
- else if (e.getSource()==this.itemFormsEvenements) {
+ else if (e.getSource()==this.btnEvent) {
for (JPanel panel : panels) {
panel.setVisible(false);
panelEvenement.setVisible(true);
}
}
- else if (e.getSource()==this.itemFormsCours) {
+ else if (e.getSource()==this.btnCours) {
for (JPanel panel : panels) {
panel.setVisible(false);
panelCour.setVisible(true);
}
}
- else if (e.getSource()==this.itemList) {
- for (JPanel panel : panels) {
- panel.setVisible(false);
- panelList.setVisible(true);
- }
- }
}
}
\ No newline at end of file
diff --git a/src/vue/VueAccueil.java b/src/vue/VueAccueil.java
index 7554f6c..81a9c66 100644
--- a/src/vue/VueAccueil.java
+++ b/src/vue/VueAccueil.java
@@ -12,19 +12,15 @@ public class VueAccueil extends JPanel
private final JLabel title = new JLabel(" Vos informations personnelles ");
private final JLabel lbId = new JLabel(" ID : ");
private final JLabel lbPrivilege = new JLabel(" Privilège : ");
- private final JLabel lbLogin = new JLabel("Pseudo : ");
private final JLabel lbMail = new JLabel(" E-mail : ");
- private final JLabel lbPrenom = new JLabel(" Prénom : ");
- private final JLabel lbNom = new JLabel(" Nom : ");
+ private final JLabel lbFormateur = new JLabel(" Nom, Prénom : ");
private final JLabel lbAge = new JLabel(" Age : ");
private final JLabel lbSexe = new JLabel(" Sexe : ");
private final JLabel lbGalop = new JLabel(" Galop : ");
private final JLabel textId = new JLabel();
private final JLabel textPrivilege = new JLabel();
- private final JLabel textLogin = new JLabel();
private final JLabel textMail = new JLabel();
- private final JLabel textPrenom = new JLabel();
- private final JLabel textNom = new JLabel();
+ private final JLabel textFormateur = new JLabel();
private final JLabel textAge = new JLabel();
private final JLabel textSexe = new JLabel();
private final JLabel textGalop = new JLabel();
@@ -36,63 +32,41 @@ public class VueAccueil extends JPanel
panel.add(panel_1, BorderLayout.NORTH);
panel.add(panel_2, BorderLayout.CENTER);
panel_1.setLayout(new BorderLayout(0, 0));
+ JLabel lbTitre = new JLabel("Bonjour " + unFormateur.getFormateur());
+ lbTitre.setHorizontalAlignment(SwingConstants.CENTER);
+ lbTitre.setFont(new Font("Book Antiqua", Font.BOLD, 35));
+ panel_1.add(lbTitre, BorderLayout.NORTH);
title.setHorizontalAlignment(SwingConstants.CENTER);
- title.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 25));
+ title.setFont(new Font("Book Antiqua", Font.BOLD, 35));
panel_1.add(title, BorderLayout.CENTER);
- textId.setFont(new Font("Bodoni MT", Font.BOLD, 20));
textId.setHorizontalAlignment(SwingConstants.LEFT);
this.textId.setText(String.valueOf(unFormateur.getId()));
- textPrivilege.setFont(new Font("Bodoni MT", Font.BOLD, 20));
textPrivilege.setHorizontalAlignment(SwingConstants.LEFT);
this.textPrivilege.setText(String.valueOf(unFormateur.getPrivilege()));
- textLogin.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textLogin.setHorizontalAlignment(SwingConstants.LEFT);
- this.textLogin.setText(unFormateur.getLogin());
- textMail.setFont(new Font("Bodoni MT", Font.BOLD, 20));
textMail.setHorizontalAlignment(SwingConstants.LEFT);
this.textMail.setText(unFormateur.getMail());
- textPrenom.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textPrenom.setHorizontalAlignment(SwingConstants.LEFT);
- this.textPrenom.setText(unFormateur.getPrenom());
- textNom.setFont(new Font("Bodoni MT", Font.BOLD, 20));
- textNom.setHorizontalAlignment(SwingConstants.LEFT);
- this.textNom.setText(unFormateur.getNom());
- textAge.setFont(new Font("Bodoni MT", Font.BOLD, 20));
+ textFormateur.setHorizontalAlignment(SwingConstants.LEFT);
+ this.textFormateur.setText(unFormateur.getFormateur());
textAge.setHorizontalAlignment(SwingConstants.LEFT);
this.textAge.setText(String.valueOf(unFormateur.getAge()));
- textSexe.setFont(new Font("Bodoni MT", Font.BOLD, 20));
textSexe.setHorizontalAlignment(SwingConstants.LEFT);
this.textSexe.setText(unFormateur.getSexe());
- textGalop.setFont(new Font("Bodoni MT", Font.BOLD, 20));
textGalop.setHorizontalAlignment(SwingConstants.LEFT);
this.textGalop.setText(String.valueOf(unFormateur.getGalop()));
panel_2.setLayout(new GridLayout(9, 2, 40, 0));
lbId.setHorizontalAlignment(SwingConstants.RIGHT);
- lbId.setFont(new Font("Book Antiqua", Font.BOLD, 20));
panel_2.add(lbId);panel_2.add(textId);
lbPrivilege.setHorizontalAlignment(SwingConstants.RIGHT);
- lbPrivilege.setFont(new Font("Book Antiqua", Font.BOLD, 20));
panel_2.add(lbPrivilege);panel_2.add(textPrivilege);
- lbLogin.setHorizontalAlignment(SwingConstants.RIGHT);
- lbLogin.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_2.add(lbLogin);panel_2.add(textLogin);
lbMail.setHorizontalAlignment(SwingConstants.RIGHT);
- lbMail.setFont(new Font("Book Antiqua", Font.BOLD, 20));
panel_2.add(lbMail);panel_2.add(textMail);
- lbPrenom.setHorizontalAlignment(SwingConstants.RIGHT);
- lbPrenom.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_2.add(lbPrenom);panel_2.add(textPrenom);
- lbNom.setHorizontalAlignment(SwingConstants.RIGHT);
- lbNom.setFont(new Font("Book Antiqua", Font.BOLD, 20));
- panel_2.add(lbNom);panel_2.add(textNom);
+ lbFormateur.setHorizontalAlignment(SwingConstants.RIGHT);
+ panel_2.add(lbFormateur);panel_2.add(textFormateur);
lbAge.setHorizontalAlignment(SwingConstants.RIGHT);
- lbAge.setFont(new Font("Book Antiqua", Font.BOLD, 20));
panel_2.add(lbAge);panel_2.add(textAge);
lbSexe.setHorizontalAlignment(SwingConstants.RIGHT);
- lbSexe.setFont(new Font("Book Antiqua", Font.BOLD, 20));
panel_2.add(lbSexe);panel_2.add(textSexe);
lbGalop.setHorizontalAlignment(SwingConstants.RIGHT);
- lbGalop.setFont(new Font("Book Antiqua", Font.BOLD, 20));
panel_2.add(lbGalop);panel_2.add(textGalop);
}
}
\ No newline at end of file
diff --git a/src/vue/VueConnexion.java b/src/vue/VueConnexion.java
index f985caa..f7f646f 100644
--- a/src/vue/VueConnexion.java
+++ b/src/vue/VueConnexion.java
@@ -29,47 +29,30 @@ public class VueConnexion extends JPanel implements ActionListener
public VueConnexion()
{
- this.setBackground(new Color(222,220,203));
this.add(panel);
- panel.setBackground(new Color(222,220,203));
panel.setLayout(new BorderLayout(0, 30));
panel.add(header, BorderLayout.NORTH);
header.setLayout(new GridLayout(0, 1, 0, 0));
- header.setBackground(new Color(222,220,203));
lbTitre.setHorizontalAlignment(SwingConstants.CENTER);
- lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 25));
- header.add(lbTitre);
+ lbTitre.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 30));
+ header.add(lbTitre);
panel.add(content, BorderLayout.CENTER);
content.setLayout(new GridLayout(0, 1, 0, 0));
- content.setBackground(new Color(222,220,203));
content.add(forms);
forms.setLayout(new GridLayout(0, 1, 0, 20));
- forms.setBackground(new Color(222,220,203));
mail.setPreferredSize(new Dimension(10, 40));
- mail.setBackground(new Color(222,220,203));
forms.add(mail);
- lbMail.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 20));
- mailField.setFont(new Font("Bodoni MT", Font.PLAIN, 18));
mail.setLayout(new BoxLayout(mail, BoxLayout.X_AXIS));
mail.add(lbMail);
mail.add(mailField);
- mdp.setBackground(Color.YELLOW);
mdp.setPreferredSize(new Dimension(10, 40));
- mdp.setBackground(new Color(222,220,203));
forms.add(mdp);
mdp.setLayout(new BoxLayout(mdp, BoxLayout.X_AXIS));
- lbMdp.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 20));
mdp.add(lbMdp);
- mdpField.setFont(new Font("Dialog", Font.PLAIN, 15));
mdp.add(mdpField);
- footer.setBackground(new Color(222,220,203));
panel.add(footer, BorderLayout.SOUTH);
- btAnnuler.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 20));
- btSeConnecter.setFont(new Font("Book Antiqua", Font.BOLD | Font.ITALIC, 20));
footer.setLayout(new GridLayout(1, 2, 30, 0));
- btAnnuler.setBackground(new Color(222,220,203));
footer.add(btAnnuler);
- btSeConnecter.setBackground(new Color(222,220,203));
footer.add(btSeConnecter);
btAnnuler.addActionListener(this);
btSeConnecter.addActionListener(this);
@@ -90,11 +73,11 @@ public class VueConnexion extends JPanel implements ActionListener
}
else {
JOptionPane.showMessageDialog(this, "Bienvenue " + unFormateur.getNom() +" " + unFormateur.getPrenom()," Connexion réussie ",JOptionPane.INFORMATION_MESSAGE);
- // ouvrir le menu général
- new Generale(unFormateur);
- this.mailField.setText("");
- this.mdpField.setText("");
- Gestion.rendreVisible(false);
+ // ouvrir le menu général
+ new Generale(unFormateur);
+ this.mailField.setText("");
+ this.mdpField.setText("");
+ Gestion.rendreVisible(false);
}
}
}
diff --git a/src/vue/VueList.java b/src/vue/VueList.java
deleted file mode 100644
index a73c9b1..0000000
--- a/src/vue/VueList.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package vue;
-
-import java.awt.*;
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-
-import controleur.Cheval;
-import controleur.Cours;
-import controleur.Eleve;
-import controleur.Formateur;
-import modele.ModeleCheval;
-import modele.ModeleCours;
-import modele.ModeleEleve;
-import modele.ModeleFormateur;
-
-public class VueList extends JPanel implements ActionListener
-{
- private static final long serialVersionUID = -3553328743149224396L;
- private JTabbedPane onglets = new JTabbedPane(SwingConstants.TOP);
- private JPanel elevesTab = new JPanel();
- private JPanel formateursTab = new JPanel();
- private JPanel chevauxTab = new JPanel();
- private JPanel coursTab = new JPanel();
- private JLabel titreEleve = new JLabel(" Liste des élèves ");
- private JTable tableEleves;
- private JLabel titreFormateur= new JLabel(" Liste des Formateurs ");
- private JTable tableFormateurs;
- private JLabel titreCheval = new JLabel(" Liste des Chevaux ");
- private JTable tableChevaux;
- private JLabel titreCour = new JLabel(" Liste des Cours ");
- private JTable tableCours;
- public VueList () {
- this.setBounds(30, 80, 720, 330);
- this.setBackground(new Color(222,220,203));
- this.add(onglets);
- onglets.setOpaque(true);
- onglets.setPreferredSize(new Dimension(700, 300));
- //Tab1
- onglets.addTab("Liste Eleves", elevesTab);
- elevesTab.setBounds(30, 80, 720, 330);
- elevesTab.setLayout(null);
- elevesTab.setBackground(new Color(222,220,203));
- this.titreEleve.setBounds(250, 0, 300, 50);
- this.titreEleve.setFont(new Font(this.titreEleve.getText(), Font.CENTER_BASELINE, 20));
- String titresEleve [] = {"ID", "Privilege", "Record", "Pseudo", "Prénom", "Nom", "Sexe", "Âge", "Adresse", "MDP", "Email", "Galop", "Image"};
- this.tableEleves = new JTable(this.extraireEleves(), titresEleve);
- JScrollPane uneScrollEleve = new JScrollPane(this.tableEleves);
- uneScrollEleve.setBounds(10, 50, 670, 200);
- elevesTab.add(this.titreEleve);
- elevesTab.add(uneScrollEleve);
- //Tab2
- onglets.addTab("Liste Formateurs", formateursTab);
- formateursTab.setBounds(30, 80, 720, 330);
- formateursTab.setLayout(null);
- formateursTab.setBackground(new Color(222,220,203));
- this.titreFormateur.setBounds(250, 0, 300, 50);
- this.titreFormateur.setFont(new Font(this.titreFormateur.getText(), Font.CENTER_BASELINE, 20));
- String titresFormateur [] = {"ID","Login", "Privilege", "Prénom", "Nom", "Age", "Galop", "Sexe", "Email", "MDP"};
- this.tableFormateurs = new JTable(this.extraireFormateurs(), titresFormateur);
- JScrollPane uneScrollFormateur = new JScrollPane(this.tableFormateurs);
- uneScrollFormateur.setBounds(10, 50, 670, 200);
- formateursTab.add(this.titreFormateur);
- formateursTab.add(uneScrollFormateur);
- //Tab3
- onglets.addTab("Liste Chevaux", chevauxTab);
- chevauxTab.setBounds(30, 80, 720, 330);
- chevauxTab.setLayout(null);
- chevauxTab.setBackground(new Color(222,220,203));
- this.titreCheval.setBounds(250, 0, 300, 50);
- this.titreCheval.setFont(new Font(this.titreCheval.getText(), Font.CENTER_BASELINE, 20));
- String titresCheval [] = {"ID", "Nom", "Sexe", "Robe", "Type", "Race", "Propriétaire", "Age", "Image"};
- this.tableChevaux = new JTable(this.extraireChevaux(), titresCheval);
- JScrollPane uneScrollCheval = new JScrollPane(this.tableChevaux);
- uneScrollCheval.setBounds(10, 50, 670, 200);
- chevauxTab.add(this.titreCheval);
- chevauxTab.add(uneScrollCheval);
- //Tab4
- onglets.addTab("Liste Cours", coursTab);
- coursTab.setBounds(30, 80, 720, 330);
- coursTab.setLayout(null);
- coursTab.setBackground(new Color(222,220,203));
- this.titreCour.setBounds(250, 0, 300, 50);
- this.titreCour.setFont(new Font(this.titreCour.getText(), Font.CENTER_BASELINE, 20));
- String titresCour [] = {"ID du cours", "Date du cours", "Début à", "Fin à","Nombre élèves"};
- this.tableCours = new JTable(this.extraireCours(), titresCour);
- JScrollPane uneScrollCour = new JScrollPane(this.tableCours);
- uneScrollCour.setBounds(10, 50, 670, 200);
- coursTab.add(this.titreCour);
- coursTab.add(uneScrollCour);
- //Fin Tab
- this.setVisible(false);
- }
- @Override
- public void actionPerformed(ActionEvent e) {
- }
- //extraire les Eleves
- public Object [][] extraireEleves () {
- ArrayList lesEleves = ModeleEleve.selectAll();
- Object [][] donnees = new Object [lesEleves.size()][13];
- int i =0;
- for (Eleve unEleve : lesEleves) {
- donnees[i][0] = unEleve.getId();
- donnees[i][1] = unEleve.getPrivilege();
- donnees[i][2] = unEleve.getRecord();
- donnees[i][3] = unEleve.getPseudo();
- donnees[i][4] = unEleve.getPrenom();
- donnees[i][5] = unEleve.getNom();
- donnees[i][6] = unEleve.getSexe();
- donnees[i][7] = unEleve.getAge();
- donnees[i][8] = unEleve.getAdresse();
- donnees[i][9] = unEleve.getMdp();
- donnees[i][10] = unEleve.getMail();
- donnees[i][11] = unEleve.getGalop();
- donnees[i][12] = unEleve.getImageEleve();
- i++;
- }
- return donnees;
- }
- //extraire les Formateurs
- public Object [][] extraireFormateurs () {
- ArrayList lesFormateurs = ModeleFormateur.selectAll();
- Object [][] donnees = new Object [lesFormateurs.size()][10];
- int i =0;
- for (Formateur unFormateur : lesFormateurs)
- {
- donnees[i][0] = unFormateur.getId();
- donnees[i][1] = unFormateur.getLogin();
- donnees[i][2] = unFormateur.getPrivilege();
- donnees[i][3] = unFormateur.getPrenom();
- donnees[i][4] = unFormateur.getNom();
- donnees[i][5] = unFormateur.getAge();
- donnees[i][6] = unFormateur.getGalop();
- donnees[i][7] = unFormateur.getSexe();
- donnees[i][8] = unFormateur.getMail();
- donnees[i][9] = unFormateur.getMdp();
- i++;
- }
- return donnees;
- }
- //extraire les Chevaux
- public Object [][] extraireChevaux () {
- ArrayList lesChevaux = ModeleCheval.selectAll();
- Object [][] donnees = new Object [lesChevaux.size()][9];
- int i =0;
- for (Cheval unCheval : lesChevaux) {
- donnees[i][0] = unCheval.getId();
- donnees[i][1] = unCheval.getNom();
- donnees[i][2] = unCheval.getSexe();
- donnees[i][3] = unCheval.getRobe();
- donnees[i][4] = unCheval.getType();
- donnees[i][5] = unCheval.getRace();
- donnees[i][6] = unCheval.getProprietaire();
- donnees[i][7] = unCheval.getAge();
- donnees[i][8] = unCheval.getImage();
- i++;
- }
- return donnees;
- }
- //Extraire les Cours
- public Object [][] extraireCours ()
- {
- ArrayList lesCours = ModeleCours.selectAll();
- Object [][] donnees = new Object [lesCours.size()][5];
- int i =0;
- for (Cours unCours : lesCours)
- {
- donnees[i][0] = unCours.getIdCours();
- donnees[i][1] = unCours.getDateCours();
- donnees[i][2] = unCours.getHeureDebut();
- donnees[i][3] = unCours.getHeureFin();
- i++;
- }
- return donnees;
- }
-}
\ No newline at end of file