CCB Premier Import

This commit is contained in:
Christian Cunat-Brulé
2018-07-23 10:52:48 +02:00
commit f55475a23f
765 changed files with 209793 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="C:/Users/chris/Documents/Christian/workspace/mysql-connector-java-5.1.40/mysql-connector-java-5.1.40-bin.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Les Ecuries de la Boissière</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,12 @@
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=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,99 @@
package controleur;
public class Cheval
{
private int idcheval, age;
private String nom, sexe, proprietaire, robe, type, race, imagecheval;
public Cheval()
{
this.idcheval=this.age=0;
this.nom = this.sexe=this.proprietaire=this.robe=this.type=this.race=this.imagecheval="";
}
/*ALL*/
public Cheval (int idcheval, int age, String nom, String sexe, String proprietaire, String robe, String type, String race, String imagecheval)
{
this.idcheval= idcheval;
this.age = age;
this.nom = nom;
this.sexe = sexe;
this.proprietaire = proprietaire;
this.robe = robe;
this.type = type;
this.race = race;
this.imagecheval = imagecheval;
}
public Cheval (int age, String nom, String sexe, String proprietaire, String robe, String type, String race, String imagecheval)
{
this.age = age;
this.nom = nom;
this.sexe = sexe;
this.proprietaire = proprietaire;
this.robe = robe;
this.type = type;
this.race = race;
this.imagecheval = imagecheval;
}
public Cheval (String nom, String proprietaire)
{
this.nom = nom;
this.proprietaire = proprietaire;
}
public int getIdcheval() {
return idcheval;
}
public void setIdcheval(int idcheval) {
this.idcheval = idcheval;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getSexe() {
return sexe;
}
public void setSexe(String sexe) {
this.sexe = sexe;
}
public String getProprietaire() {
return proprietaire;
}
public void setProprietaire(String proprietaire) {
this.proprietaire = proprietaire;
}
public String getRobe() {
return robe;
}
public void setRobe(String robe) {
this.robe = robe;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getRace() {
return race;
}
public void setRace(String race) {
this.race = race;
}
public String getImagecheval() {
return imagecheval;
}
public void setImagecheval(String imagecheval) {
this.imagecheval = imagecheval;
}
}

View File

@@ -0,0 +1,93 @@
package controleur;
public class Cours
{
private int idcours, ideleve, idformateur, idcheval;
private String datecours, heuredebut, heurefin;
public Cours()
{
this.idcours=ideleve=idformateur=idcheval=0;
this.datecours = this.heuredebut=this.heurefin="";
}
public Cours (int idcours, String datecours, String heuredebut, String heurefin, int ideleve, int idformateur, int idcheval)
{
this.idcours= idcours;
this.datecours = datecours;
this.heuredebut = heuredebut;
this.heurefin = heurefin;
this.ideleve= ideleve;
this.idformateur= idformateur;
this.idcheval= idcheval;
}
public Cours ( String datecours, String heuredebut, String heurefin)
{
this.idcours= 0;
this.ideleve= 1;
this.idformateur= 1;
this.idcheval= 1;
this.datecours = datecours;
this.heuredebut = heuredebut;
this.heurefin = heurefin;
}
public Cours ( String datecours, String heuredebut, String heurefin, int ideleve, int idformateur, int idcheval)
{
this.idcours= 0;
this.ideleve= ideleve;
this.idformateur= idformateur;
this.idcheval= idcheval;
this.datecours = datecours;
this.heuredebut = heuredebut;
this.heurefin = heurefin;
}
public Cours ( String datecours, String heuredebut)
{
this.datecours = datecours;
this.heuredebut = heuredebut;
}
public int getIdCours() {
return idcours;
}
public void setIdCours(int idcours) {
this.idcours = idcours;
}
public String getDateCours() {
return datecours;
}
public void setDateCours(String datecours) {
this.datecours = datecours;
}
public String getHeureDebut() {
return heuredebut;
}
public void setHeureDebut(String heuredebut) {
this.heuredebut = heuredebut;
}
public String getHeureFin() {
return heurefin;
}
public void setHeureFin(String heurefin) {
this.heurefin = heurefin;
}
public int getIdEleve() {
return ideleve;
}
public void setIdEleve(int ideleve) {
this.ideleve = ideleve;
}
public int getIdFormateur() {
return idformateur;
}
public void setIdFormateur(int idformateur) {
this.idformateur = idformateur;
}
public int getIdCheval() {
return idcheval;
}
public void setIdCheval(int idcheval) {
this.idcheval = idcheval;
}
}

View File

@@ -0,0 +1,139 @@
package controleur;
public class Eleve
{
private int ideleve, age, galop, privilege;
private String nom, prenom, adresse, adressemail, sexe, pseudo, mdp, imageeleve, dateenregistre;
public Eleve()
{
this.ideleve=this.age=this.galop=0;
this.privilege=2;
this.nom=this.prenom=this.adresse=this.adressemail=this.sexe=this.pseudo=this.mdp="";
this.imageeleve=this.dateenregistre="2017-04-25 01:00:00";
}
/*ALL*/
public Eleve (int idEleve, int age, int galop, int privilege, String nom, String prenom, String adresse, String adressemail, String sexe, String pseudo, String mdp, String imageeleve, String dateenregistre)
{
this.ideleve= idEleve;
this.age = age;
this.galop = galop;
this.privilege = privilege;
this.nom = nom;
this.prenom = prenom;
this.adresse = adresse;
this.adressemail = adressemail;
this.sexe = sexe;
this.pseudo = pseudo;
this.mdp = mdp;
this.imageeleve = imageeleve;
this.dateenregistre = dateenregistre;
}
public Eleve ( int age, int galop, String nom, String prenom, String adresse, String adressemail, String sexe, String pseudo, String mdp, String imageeleve)
{
this.ideleve= 0;
this.age = age;
this.galop = galop;
this.privilege = 2;
this.nom = nom;
this.prenom = prenom;
this.adresse = adresse;
this.adressemail = adressemail;
this.sexe = sexe;
this.pseudo = pseudo;
this.mdp = mdp;
this.imageeleve = imageeleve;
this.dateenregistre = "";
}
public Eleve (String pseudo)
{
this.pseudo = pseudo;
}
public int getIdeleve() {
return ideleve;
}
public void setIdeleve(int ideleve) {
this.ideleve = ideleve;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public String getAdresse() {
return adresse;
}
public void setAdresse(String adresse) {
this.adresse = adresse;
}
public String getAdressEmail() {
return adressemail;
}
public void setAdressEmail(String adressemail) {
this.adressemail = adressemail;
}
public String getSexe() {
return sexe;
}
public void setSexe(String sexe) {
this.sexe = sexe;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getPseudo() {
return pseudo;
}
public void setPseudo(String pseudo) {
this.pseudo = pseudo;
}
public String getMdp() {
return mdp;
}
public void setMdp(String mdp) {
this.mdp = mdp;
}
public String getImageeleve() {
return imageeleve;
}
public void setImageeleve(String imageeleve) {
this.imageeleve = imageeleve;
}
public int getGalop() {
return galop;
}
public void setGalop(int galop) {
this.galop = galop;
}
public int getPrivilege() {
return privilege;
}
public void setPrivilege(int privilege) {
this.privilege = privilege;
}
public String getDateEnregistre() {
return dateenregistre;
}
public void setDateEnregistre(String dateenregistre) {
this.dateenregistre = dateenregistre;
}
}

View File

@@ -0,0 +1,110 @@
package controleur;
public class Formateur
{
private int idformateur, age, galop, privilege;
private String nom, prenom, adressemail, sexe, login, mdp;
public Formateur()
{
this.idformateur=this.age=this.galop=this.privilege=0;
this.nom=this.prenom=this.adressemail=this.sexe=this.mdp=this.login="";
}
/*ALL*/
public Formateur (int idformateur, int age, int galop, int privilege, String nom, String prenom, String adressemail, String sexe, String login, String mdp )
{
this.idformateur= idformateur;
this.nom = nom;
this.prenom = prenom;
this.adressemail = adressemail;
this.sexe = sexe;
this.age = age;
this.galop = galop;
this.privilege = privilege;
this.login = login;
this.mdp = mdp;
}
/* S IDF & Privikege*/
public Formateur ( int age, int galop, String nom, String prenom, String adressemail, String sexe, String login, String mdp )
{
this.nom = nom;
this.prenom = prenom;
this.adressemail = adressemail;
this.sexe = sexe;
this.age = age;
this.galop = galop;
this.privilege = 3;
this.login = login;
this.mdp = mdp;
}
public Formateur (String login)
{
this.login = login;
}
public int getIdformateur() {
return idformateur;
}
public void setIdformateur(int idformateur) {
this.idformateur = idformateur;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public String getAdressEmail() {
return adressemail;
}
public void setAdressEmail(String adressemail) {
this.adressemail = adressemail;
}
public String getSexe() {
return sexe;
}
public void setSexe(String sexe) {
this.sexe = sexe;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getGalop() {
return galop;
}
public void setGalop(int galop) {
this.galop = galop;
}
public int getPrivilege() {
return privilege;
}
public void setPrivilege(int privilege) {
this.privilege = privilege;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getMdp() {
return mdp;
}
public void setMdp(String mdp) {
this.mdp = mdp;
}
}

View File

@@ -0,0 +1,25 @@
package controleur;
import vue.Connexion;
public class Gestion
{
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)
{
new Gestion();
}
}

View File

@@ -0,0 +1,117 @@
package controleur;
public class Profil
{
private int idformateur, age, galop, privilege;
private String nom, prenom, adressemail, sexe, login, mdp;
public Profil (int idformateur, int age, int galop, int privilege, String nom, String prenom, String adressemail, String sexe, String login, String mdp )
{
this.idformateur= idformateur;
this.age = age;
this.galop = galop;
this.privilege = privilege;
this.nom = nom;
this.prenom = prenom;
this.adressemail = adressemail;
this.sexe = sexe;
this.login = login;
this.mdp = mdp;
}
public Profil (int age, int galop, int privilege, String nom, String prenom, String adressemail, String sexe, String login, String mdp )
{
this.age = age;
this.galop = galop;
this.privilege = privilege;
this.nom = nom;
this.prenom = prenom;
this.adressemail = adressemail;
this.sexe = sexe;
this.login = login;
this.mdp = mdp;
}
public Profil (String adressemail, String mdp)
{
this.adressemail = adressemail;
this.mdp = mdp;
}
public int getIdformateur() {
return idformateur;
}
public void setIdformateur(int idformateur) {
this.idformateur = idformateur;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public String getEmail() {
return adressemail;
}
public void setEmail(String adressemail) {
this.adressemail = adressemail;
}
public String getSexe() {
return sexe;
}
public void setSexe(String sexe) {
this.sexe = sexe;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getGalop() {
return galop;
}
public void setGalop(int galop) {
this.galop = galop;
}
public int getPrivilege() {
return privilege;
}
public void setPrivilege(int privilege) {
this.privilege = privilege;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getMdp() {
return mdp;
}
public void setMdp(String mdp) {
this.mdp = mdp;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,60 @@
package modele;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class BDD
{
private String serveur, nombdd, user, mdp;
private Connection maConnexion;
public BDD(String serveur, String nombdd, String user, String mdp)
{
this.serveur = serveur;
this.nombdd = nombdd;
this.user = user;
this.mdp = mdp;
this.maConnexion = null;
}
public void chargerPilote()
{
// v<>rifie la pr<70>sence du pilote JDBC MySQL
try {
Class.forName("com.mysql.jdbc.Driver");
}
catch(ClassNotFoundException exp) {
System.out.println("Abscence du pilote JDBC !");
}
}
public void seConnecter()
{
// connexion au serveur de la BDD
this.chargerPilote();
String url = "jdbc:mysql://" + this.serveur + "/" + this.nombdd;
try {
this.maConnexion = DriverManager.getConnection(url, this.user, this.mdp);
}
catch(SQLException exp) {
System.out.println("Impossible de se connecter <20><> " + url);
}
}
public void seDeconnecter()
{
// 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 <20>chou<6F> !");
}
}
public Connection getMaConnexion()
{
return this.maConnexion;
}
}

View File

@@ -0,0 +1,137 @@
package modele;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import controleur.Profil;
public class Modele
{
/* ARRAY */
public static ArrayList<Profil> selectAll()
{
ArrayList<Profil> lesProfils = new ArrayList<Profil>();
String requete = "SELECT * FROM formateur;";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
while(unRes.next())
{
int idformateur = unRes.getInt("idformateur");
int age = unRes.getInt("age");
int galop = unRes.getInt("galop");
int privilege = unRes.getInt("privilege");
String nom = unRes.getString("nom");
String prenom = unRes.getString("prenom");
String adressemail = unRes.getString("adressemail");
String sexe = unRes.getString("sexe");
String login = unRes.getString("login");
String mdp = unRes.getString("mdp");
Profil unProfil = new Profil(idformateur, age, galop, privilege, nom, prenom, adressemail, sexe, login, mdp );
lesProfils.add(unProfil);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return lesProfils;
}
/* INSERT */
public static void insert(Profil unProfil)
{
String requete = "INSERT INTO formateur (age, galop, privilege, nom, prenom, adressemail, sexe, login, mdp ) VALUES ('"
+ unProfil.getAge() + "', '"
+ unProfil.getGalop() + "', '"
+ unProfil.getPrivilege() + "', '"
+ unProfil.getNom() + "', '"
+ unProfil.getPrenom() + "', '"
+ unProfil.getEmail() + "', '"
+ unProfil.getSexe() + "', '"
+ unProfil.getLogin() + "', '"
+ unProfil.getMdp() + "');";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/* DELETE */
public static void delete(String adressemail)
{
String requete = "DELETE FROM formateur WHERE adressemail='" + adressemail + "';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/* WHERE* Connexion */
public static Profil selectWhere(String adressemail, String mdp)
{
String requete = "SELECT * FROM formateur WHERE adressemail='" + adressemail + "' AND mdp='" + mdp + "';";
Profil unProfil = null;
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
if(unRes.next())
{
int idformateur = unRes.getInt("idformateur");
int age = unRes.getInt("age");
int galop = unRes.getInt("galop");
int privilege = unRes.getInt("privilege");
String nom = unRes.getString("nom");
String prenom = unRes.getString("prenom");
String sexe = unRes.getString("sexe");
String login = unRes.getString("login");
unProfil = new Profil(idformateur, age, galop, privilege, nom, prenom, adressemail, sexe, login, mdp );
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return unProfil;
}
}

View File

@@ -0,0 +1,161 @@
package modele;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import controleur.Cheval;
public class ModeleCheval
{
/* ARRAY* */
public static ArrayList<Cheval> selectAll()
{
ArrayList<Cheval> lesChevaux = new ArrayList<Cheval>();
String requete = "SELECT * FROM cheval;";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
while(unRes.next())
{
int idcheval = unRes.getInt("idcheval");
int age = unRes.getInt("age");
String nom = unRes.getString("nom");
String sexe = unRes.getString("sexe");
String proprietaire = unRes.getString("proprietaire");
String robe = unRes.getString("robe");
String type = unRes.getString("type");
String race = unRes.getString("race");
String imagecheval = unRes.getString("imagecheval");
Cheval unCheval = new Cheval( idcheval, age, nom, sexe, proprietaire, robe, type, race, imagecheval);
lesChevaux.add(unCheval);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return lesChevaux;
}
/*INSERT* SID */
public static void insert(Cheval unCheval)
{
String requete = "INSERT INTO cheval (nom, age, sexe, proprietaire, robe, type, race, imagecheval) VALUES ('"
+ unCheval.getNom() + "', '"
+ unCheval.getAge() + "', '"
+ unCheval.getSexe() + "', '"
+ unCheval.getProprietaire() + "', '"
+ unCheval.getRobe() + "', '"
+ unCheval.getType() + "', '"
+ unCheval.getRace() + "', '"
+ unCheval.getImagecheval()+ "');";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/*UPDATE PAS* */
public static void update(Cheval unCheval, String nom, String proprietaire)
{
String requete = "UPDATE cheval SET "
+ "nom = '"+ unCheval.getNom() +"', proprietaire ='"+ unCheval.getProprietaire() +"', "
+ "robe ='"+ unCheval.getRobe() +"', type ='"+ unCheval.getType() +"', "
+ "sexe ='"+ unCheval.getSexe() +"', age ='"+ unCheval.getAge() +"', "
+ "race ='"+ unCheval.getRace()+"', "+"imagecheval ='"+ unCheval.getImagecheval()+"' "
+ "WHERE nom='"+ nom + "'AND proprietaire='" + proprietaire + "';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/*DELETE* */
public static void delete(String nom, String proprietaire)
{
String requete = "DELETE FROM cheval WHERE nom='" + nom + "'AND proprietaire='" + proprietaire + "';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/*WHERE* */
public static Cheval selectWhere(String nom, String proprietaire)
{
String requete = "SELECT * FROM cheval WHERE nom='" + nom + "AND proprietaire='" + proprietaire + "';";
Cheval unCheval = null;
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
if(unRes.next())
{
int idcheval = unRes.getInt("idcheval");
int age = unRes.getInt("age");
String sexe = unRes.getString("sexe");
String robe = unRes.getString("robe");
String type = unRes.getString("type");
String race = unRes.getString("race");
String imagecheval = unRes.getString("imagecheval");
unCheval = new Cheval( idcheval, age, nom, sexe, proprietaire, robe, type, race, imagecheval);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return unCheval;
}
}

View File

@@ -0,0 +1,150 @@
package modele;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import controleur.Cours;
public class ModeleCours
{
public static ArrayList<Cours> selectAll()
{
ArrayList<Cours> lesCours = new ArrayList<Cours>();
String requete = "select * from cours;";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
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");
String heuredebut = unRes.getString("heuredebut");
String heurefin = unRes.getString("heurefin");
int ideleve = unRes.getInt("ideleve");
int idformateur = unRes.getInt("idformateur");
int idcheval = unRes.getInt("idcheval");
Cours unCours = new Cours(idcours, datecours, heuredebut, heurefin, ideleve, idformateur, idcheval);
lesCours.add(unCours);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return lesCours;
}
public static void insert(Cours unCours)
{
String requete = "insert into cours (datecours, heuredebut, heurefin, ideleve, idformateur, idcheval ) values ('"
+ unCours.getDateCours() + "', '"
+ unCours.getHeureDebut() + "', '"
+ unCours.getHeureFin() + "', '"
+ unCours.getIdEleve() + "', '"
+ unCours.getIdFormateur() + "', '"
+ unCours.getIdCheval() + "');";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/*UPDATE PAS* */
public static void update(Cours unCours, String datecours, String heuredebut)
{
String requete = "UPDATE cours SET "
+ "datecours = '"+ unCours.getDateCours() +"', heuredebut ='"+ unCours.getHeureDebut() +"', "
+ "heurefin ='"+ unCours.getHeureFin() +"', "+ "ideleve ='"+ unCours.getIdEleve() +"', "
+ "idformateur ='"+ unCours.getIdFormateur() +"', "+ "idcheval ='"+ unCours.getIdCheval() +"' "
+ "WHERE datecours='"+ datecours + "' AND heuredebut='" + heuredebut + "';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
public static void delete(String datecours, String heuredebut)
{
String requete = "delete from cours where datecours='" + datecours + "'AND heuredebut='" + heuredebut + "';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
public static Cours selectWhere(String datecours, String heuredebut)
{
String requete = "select * from cours where datecours='" + datecours + "' and heuredebut='" + heuredebut + "';";
Cours unCours = null;
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
if(unRes.next())
{
String heurefin = unRes.getString("heurefin");
unCours = new Cours(datecours, heuredebut, heurefin);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return unCours;
}
}

View File

@@ -0,0 +1,168 @@
package modele;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import controleur.Eleve;
public class ModeleEleve
{
/*ARRAY* */
public static ArrayList<Eleve> selectAll()
{
ArrayList<Eleve> lesEleves = new ArrayList<Eleve>();
String requete = "SELECT * FROM compteeleve;";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
while(unRes.next())
{
int ideleve = unRes.getInt("ideleve");
int age = unRes.getInt("age");
int galop = unRes.getInt("galop");
int privilege = unRes.getInt("privilege");
String nom = unRes.getString("nom");
String prenom = unRes.getString("prenom");
String adresse = unRes.getString("adresse");
String adressemail = unRes.getString("adressemail");
String sexe = unRes.getString("sexe");
String pseudo = unRes.getString("pseudo");
String mdp = unRes.getString("mdp");
String imageeleve = unRes.getString("imageeleve");
String dateenregistre = unRes.getString("dateenregistre");
Eleve unEleve = new Eleve(ideleve, age, galop, privilege, nom, prenom, adresse, adressemail, sexe, pseudo, mdp, imageeleve, dateenregistre);
lesEleves.add(unEleve);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return lesEleves;
}
/* INSERT S ID & PRIV & DateEnr */
public static void insert(Eleve unEleve)
{
String requete = "INSERT INTO compteeleve (nom, prenom, adresse, adressemail, sexe, age, galop, pseudo, mdp, imageeleve) VALUES ('"
+ unEleve.getNom() + "', '"
+ unEleve.getPrenom() + "', '"
+ unEleve.getAdresse() + "', '"
+ unEleve.getAdressEmail() + "', '"
+ unEleve.getSexe() + "', '"
+ unEleve.getAge() + "', '"
+ unEleve.getGalop() + "', '"
+ unEleve.getPseudo() + "', '"
+ unEleve.getMdp() + "', '"
+ unEleve.getImageeleve()+ "');";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/* DELETE* */
public static void delete(String pseudo)
{
String requete = "DELETE FROM compteeleve WHERE pseudo='" + pseudo + "';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/*UPDATE S ID & PRIV & DateEnr */
public static void update(Eleve unEleve, String pseudo)
{
String requete = "UPDATE compteeleve SET "
+ "nom = '"+ unEleve.getNom() +"', prenom ='"+ unEleve.getPrenom() +"', "
+ "adresse ='"+ unEleve.getAdresse() +"', adressemail ='"+ unEleve.getAdressEmail() +"', "
+ "sexe ='"+ unEleve.getSexe() +"', age ='"+ unEleve.getAge() +"', "
+ "galop ='"+ unEleve.getGalop() +"', pseudo ='"+ unEleve.getPseudo() +"', "
+ "mdp ='"+ unEleve.getMdp()+"', imageeleve ='"+ unEleve.getImageeleve()+"' "
+ "WHERE pseudo='"+ pseudo +"';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/*WHERE* */
public static Eleve selectWhere(String pseudo, String mdp)
{
String requete = "SELECT * FROM compteeleve WHERE pseudo='" + pseudo + "' AND mdp='" + mdp + "';";
Eleve unEleve = null;
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
if(unRes.next())
{
int ideleve = unRes.getInt("ideleve");
int age = unRes.getInt("age");
int galop = unRes.getInt("galop");
int privilege = unRes.getInt("privilege");
String nom = unRes.getString("nom");
String prenom = unRes.getString("prenom");
String adresse = unRes.getString("adresse");
String sexe = unRes.getString("sexe");
String adressemail = unRes.getString("adressemail");
String imageeleve = unRes.getString("imageeleve");
String dateenregistre = unRes.getString("dateenregistre");
unEleve = new Eleve(ideleve, age, galop, privilege, nom, prenom, adresse, adressemail, sexe, pseudo, mdp, imageeleve, dateenregistre);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return unEleve;
}
}

View File

@@ -0,0 +1,158 @@
package modele;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import controleur.Formateur;
public class ModeleFormateur
{
/*ARRAY* */
public static ArrayList<Formateur> selectAll()
{
ArrayList<Formateur> lesFormateurs = new ArrayList<Formateur>();
String requete = "SELECT * FROM formateur;";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
while(unRes.next())
{
int idformateur = unRes.getInt("idformateur");
int age = unRes.getInt("age");
int galop = unRes.getInt("galop");
int privilege = unRes.getInt("privilege");
String nom = unRes.getString("nom");
String prenom = unRes.getString("prenom");
String adressemail = unRes.getString("adressemail");
String sexe = unRes.getString("sexe");
String mdp = unRes.getString("mdp");
String login = unRes.getString("login");
Formateur unFormateur = new Formateur(idformateur, age, galop, privilege, nom, prenom, adressemail, sexe, login, mdp);
lesFormateurs.add(unFormateur);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return lesFormateurs;
}
/* INSERT * SID */
public static void insert(Formateur unFormateur)
{
String requete = "INSERT INTO formateur (nom, prenom, adressemail, sexe, age, galop, privilege, login, mdp) VALUES ('"
+ unFormateur.getNom() + "', '"
+ unFormateur.getPrenom() + "', '"
+ unFormateur.getAdressEmail() + "', '"
+ unFormateur.getSexe() + "', '"
+ unFormateur.getAge() + "', '"
+ unFormateur.getGalop() + "', '"
+ unFormateur.getPrivilege() + "', '"
+ unFormateur.getLogin() + "', '"
+ unFormateur.getMdp() + "');";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/*UPDATE PAS* */
public static void update(Formateur unFormateur, String login)
{
String requete = "UPDATE formateur SET "
+ "nom = '"+ unFormateur.getNom() +"', prenom ='"+ unFormateur.getPrenom() +"', "
+ "galop ='"+ unFormateur.getGalop() +"', adressemail ='"+ unFormateur.getAdressEmail() +"', "
+ "sexe ='"+ unFormateur.getSexe() +"', age ='"+ unFormateur.getAge() +"', "
+ "login ='"+ unFormateur.getLogin()+"', "+"mdp ='"+ unFormateur.getMdp()+"' "
+ "WHERE login='"+ login +"';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/* DELETE* */
public static void delete(String login)
{
String requete = "DELETE FROM formateur WHERE login='" + login + "';";
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
unStat.execute(requete);
unStat.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
}
/* WHERE* */
public static Formateur selectWhere(String login, String mdp)
{
String requete = "SELECT * FROM formateur WHERE login='" + login + "' AND mdp='" + mdp + "';";
Formateur unFormateur = null;
try {
BDD uneBDD = new BDD("localhost", "ecurie", "root", "");
uneBDD.seConnecter();
Statement unStat = uneBDD.getMaConnexion().createStatement();
ResultSet unRes = unStat.executeQuery(requete);
if(unRes.next())
{
int idformateur = unRes.getInt("idformateur");
int age = unRes.getInt("age");
int galop = unRes.getInt("galop");
int privilege = unRes.getInt("privilege");
String nom = unRes.getString("nom");
String prenom = unRes.getString("prenom");
String sexe = unRes.getString("sexe");
String adressemail = unRes.getString("adressemail");
unFormateur = new Formateur(idformateur, age, galop, privilege, nom, prenom,adressemail, sexe, login, mdp);
}
unStat.close();
unRes.close();
uneBDD.seDeconnecter();
}
catch(SQLException exp)
{
System.out.println("Erreur d'execution de la requete " + requete);
}
return unFormateur;
}
}

View File

@@ -0,0 +1,46 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Connexion extends JFrame
{
public Connexion()
{
/*PARAM FENETRE */
this.setIconImage(new ImageIcon("src/images//favicon.png").getImage());//logo fenetre
this.setTitle("Les Ecuries de la Boissi<73>re");//titre fenetre
this.setBounds(400, 150, 1000, 800);//format fenetre
this.getContentPane().setBackground(new Color(117,157,135));//Couleur fenetre RGB
this.setLayout(null); // pas de grille
this.setResizable(false); // la fen<65>tre ne pourra pas <20>tre redimensionn<6E>e
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
/* AFFICHAGE FENETRE*/
ImageIcon logo = new ImageIcon(new ImageIcon("src/images/logo.png").getImage().getScaledInstance(550,151, Image.SCALE_AREA_AVERAGING));//logo page L/l
JLabel lbLogo = new JLabel(logo);
lbLogo.setBounds(200, 15, 550,151);//position logo page X Y L H
this.add(lbLogo);
JLabel lbTitre = new JLabel("<html><b><center>Bienvenue<br> Connectez-vous</center><b></html>");//titre page
lbTitre.setBounds(400, 250, 200, 60);// position titre page
lbTitre.setFont(new Font(lbTitre.getText(), Font.ROMAN_BASELINE, 25));// taille titre page
lbTitre.setForeground( Color.white);
this.add(lbTitre);
this.add(new VueConnexion());//insertion VueConnexion
this.setVisible(true);
}
public void rendreVisible(boolean val)
{
this.setVisible(val);
}
}

View File

@@ -0,0 +1,603 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import controleur.Gestion;
import controleur.Profil;
public class Generale extends JFrame implements ActionListener
{
/*VARIABLE*/
private JMenuBar uneBarre = new JMenuBar();
private JMenu mnFichier = new JMenu("Menu");
private JMenu mnGestion = new JMenu("Gestion");
private JMenu mnCentre = new JMenu("Centre");
private JMenu mnAide = new JMenu("Information");
private JMenuItem itemAccueil = new JMenuItem("Accueil");
private JMenuItem itemQuitter = new JMenuItem("Quitter");
private JMenuItem itemInformation = new JMenuItem("A propos");
private JMenuItem itemCours = new JMenuItem("Liste des cours");
private JMenuItem itemACours = new JMenuItem("Ajouter des cours");
private JMenuItem itemMCours = new JMenuItem("Modifier des cours");
private JMenuItem itemSCours = new JMenuItem("Supprimer des cours");
private JMenuItem itemEleves = new JMenuItem("Liste des <20>l<EFBFBD>ves");
private JMenuItem itemAEleves = new JMenuItem("Ajouter des <20>l<EFBFBD>ves");
private JMenuItem itemMEleves = new JMenuItem("Modifier des <20>l<EFBFBD>ves");
private JMenuItem itemSEleves = new JMenuItem("Supprimer des <20>l<EFBFBD>ves");
private JMenuItem itemChevaux = new JMenuItem("Liste des chevaux");
private JMenuItem itemAChevaux = new JMenuItem("Ajouter des chevaux");
private JMenuItem itemMChevaux = new JMenuItem("Modifier des chevaux");
private JMenuItem itemSChevaux = new JMenuItem("Supprimer des chevaux");
private JMenuItem itemFormateurs= new JMenuItem("Liste des formateurs");
private JMenuItem itemAFormateurs = new JMenuItem("Ajouter des formateurs");
private JMenuItem itemMFormateurs = new JMenuItem("Modifier des formateurs");
private JMenuItem itemSFormateurs = new JMenuItem("Supprimer des formateurs");
private VueInformation uneVueInformation = new VueInformation();
private VueEleves uneVueEleves = new VueEleves();
private VueElevesA uneVueElevesA = new VueElevesA();
private VueElevesM uneVueElevesM = new VueElevesM();
private VueElevesS uneVueElevesS = new VueElevesS();
private VueCours uneVueCours = new VueCours();
private VueCoursA uneVueCoursA = new VueCoursA();
private VueCoursM uneVueCoursM = new VueCoursM();
private VueCoursS uneVueCoursS = new VueCoursS();
private VueChevaux uneVueChevaux = new VueChevaux();
private VueChevauxA uneVueChevauxA = new VueChevauxA();
private VueChevauxM uneVueChevauxM = new VueChevauxM();
private VueChevauxS uneVueChevauxS = new VueChevauxS();
private VueFormateurs uneVueFormateurs = new VueFormateurs();
private VueFormateursA uneVueFormateursA = new VueFormateursA();
private VueFormateursM uneVueFormateursM = new VueFormateursM();
private VueFormateursS uneVueFormateursS = new VueFormateursS();
private VueAccueil uneVueAccueil ;
/*VARIABLE*/
/*AFFICHAGE GENERAL APPLI*/
public Generale(Profil unProfil)
{
ImageIcon logo = new ImageIcon(new ImageIcon("src/images/favicon.png").getImage().getScaledInstance(100, 100, Image.SCALE_DEFAULT));
this.setIconImage(logo.getImage());
this.setTitle("Les Ecuries de la Boissi<73>re");
this.setBounds(400, 150, 1000, 800);
this.getContentPane().setBackground(new Color(117,157,135));
this.setLayout(null);
this.setResizable(false);
this.uneVueAccueil = new VueAccueil(unProfil);
this.add(uneVueAccueil);
this.add(uneVueInformation);
this.add(uneVueChevaux);
this.add(uneVueChevauxA);
this.add(uneVueChevauxM);
this.add(uneVueChevauxS);
this.add(uneVueEleves);
this.add(uneVueElevesA);
this.add(uneVueElevesM);
this.add(uneVueElevesS);
this.add(uneVueCours);
this.add(uneVueCoursA);
this.add(uneVueCoursM);
this.add(uneVueCoursS);
this.add(uneVueFormateurs);
this.add(uneVueFormateursA);
this.add(uneVueFormateursM);
this.add(uneVueFormateursS);
/*BARRE MENU GROUPE*/
this.uneBarre.add(this.mnFichier);
this.uneBarre.add(this.mnCentre);
this.uneBarre.add(this.mnGestion);
this.uneBarre.add(this.mnAide);
/*BARRE MENU GROUPE*/
/*BARRE MENU LISTE GROUPE*/
this.mnFichier.add(this.itemAccueil);
this.mnFichier.add(this.itemQuitter);
this.mnCentre.add(this.itemEleves);
this.mnCentre.add(this.itemChevaux);
this.mnCentre.add(this.itemCours);
this.mnCentre.add(this.itemFormateurs);
this.mnGestion.add(this.itemAEleves);
this.mnGestion.add(this.itemMEleves);
this.mnGestion.add(this.itemSEleves);
this.mnGestion.add(this.itemAChevaux);
this.mnGestion.add(this.itemMChevaux);
this.mnGestion.add(this.itemSChevaux);
this.mnGestion.add(this.itemACours);
this.mnGestion.add(this.itemMCours);
this.mnGestion.add(this.itemSCours);
this.mnGestion.add(this.itemAFormateurs);
this.mnGestion.add(this.itemMFormateurs);
this.mnGestion.add(this.itemSFormateurs);
this.mnAide.add(this.itemInformation);
/*BARRE MENU LISTE GROUPE*/
this.itemQuitter.addActionListener(this);
this.itemAccueil.addActionListener(this);
this.itemEleves.addActionListener(this);
this.itemChevaux.addActionListener(this);
this.itemCours.addActionListener(this);
this.itemFormateurs.addActionListener(this);
this.itemACours.addActionListener(this);
this.itemMCours.addActionListener(this);
this.itemSCours.addActionListener(this);
this.itemAEleves.addActionListener(this);
this.itemMEleves.addActionListener(this);
this.itemSEleves.addActionListener(this);
this.itemAChevaux.addActionListener(this);
this.itemMChevaux.addActionListener(this);
this.itemSChevaux.addActionListener(this);
this.itemAFormateurs.addActionListener(this);
this.itemMFormateurs.addActionListener(this);
this.itemSFormateurs.addActionListener(this);
this.itemInformation.addActionListener(this);
this.setJMenuBar(this.uneBarre);
JLabel lbTitre = new JLabel("<html><b><center>Espace de travail<br>"+ unProfil.getLogin()+"</center></b></html>");
lbTitre.setBounds(400, 30, 300, 60);
lbTitre.setFont(new Font(lbTitre.getText(), Font.ROMAN_BASELINE, 25));// taille titre page
lbTitre.setForeground( Color.white);
this.add(lbTitre) ;
this.setVisible(true);
}
/*AFFICHAGE GENERAL APPLI*/
/*ACTION GENERAL APPLI*/
@Override
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == this.itemQuitter)
{
Gestion.rendreVisible(true);
this.setVisible(false);
}
else if (e.getSource()==this.itemAccueil)
{
uneVueAccueil.setVisible(true);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemInformation)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(true);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemCours)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(true);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemACours)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(true);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemMCours)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(true);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemSCours)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(true);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemEleves)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(true);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemAEleves)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(true);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemMEleves)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(true);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemSEleves)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(true);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemChevaux)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(true);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemAChevaux)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(true);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemMChevaux)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(true);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemSChevaux)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(true);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemFormateurs)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(true);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemAFormateurs)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(true);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemMFormateurs)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(true);
uneVueFormateursS.setVisible(false);
}
else if (e.getSource()==this.itemSFormateurs)
{
uneVueAccueil.setVisible(false);
uneVueInformation.setVisible(false);
uneVueCours.setVisible(false);
uneVueCoursA.setVisible(false);
uneVueCoursM.setVisible(false);
uneVueCoursS.setVisible(false);
uneVueEleves.setVisible(false);
uneVueElevesA.setVisible(false);
uneVueElevesM.setVisible(false);
uneVueElevesS.setVisible(false);
uneVueChevaux.setVisible(false);
uneVueChevauxA.setVisible(false);
uneVueChevauxM.setVisible(false);
uneVueChevauxS.setVisible(false);
uneVueFormateurs.setVisible(false);
uneVueFormateursA.setVisible(false);
uneVueFormateursM.setVisible(false);
uneVueFormateursS.setVisible(true);
}
}
/*ACTION GENERAL APPLI*/
}

View File

@@ -0,0 +1,50 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import controleur.Profil;
public class VueAccueil extends JPanel
{
public VueAccueil(Profil unProfil)
{
/*AFFICHAGE TAB*/
this.setBounds(50, 130, 900, 500);
this.setBackground(new Color(230,230,230));
this.setLayout(null);
/* TITRE */
JLabel lbProfil = new JLabel("Vos informations de profil");
lbProfil.setBounds(300, 30, 400, 40);
lbProfil.setFont(new Font(lbProfil.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(lbProfil);
/* INFO PROFIL */
JTextArea txtInfo = new JTextArea();
txtInfo.setBounds(50, 50, 750, 400);
txtInfo.setEditable(false);
txtInfo.setBackground(new Color(230,230,230));
txtInfo.setFont(new Font(txtInfo.getText(),Font.ROMAN_BASELINE, 20));
// txtTitre.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
txtInfo.setText( "\n\n Login : " + unProfil.getLogin()
+ "\n\n Nom : " + unProfil.getNom()
+ "\n\n Pr<50>nom : " + unProfil.getPrenom()
+ "\n\n Adresse Email : " + unProfil.getEmail()
+ "\n\n Votre Age : " + unProfil.getAge()
+ "\n\n Votre Sexe : " + unProfil.getSexe()
+ "\n\n Galop optenue : " + unProfil.getGalop());
this.add(txtInfo);
this.setVisible(true);
}
public static void main(String[] args) {
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
}
}

View File

@@ -0,0 +1,62 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import controleur.Cheval;
import modele.ModeleCheval;
public class VueChevaux extends JPanel implements ActionListener
{
private JTable tableChevaux;
public VueChevaux ()
{ /*AFICHAGE ECRAN*/
this.setBounds(50, 100, 900, 600);
this.setLayout(null);
this.setBackground(new Color(247,245,226));
/*TITRE*/
JLabel titre = new JLabel(" Liste des chevaux ");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
titre.setBounds(335, 5, 300, 50);
this.add(titre);
/*GRILLE BDD*/
String column [] = {"Nom", "Sexe", "<EFBFBD>ge", "Propri<EFBFBD>taire", "Race", "Robe", "Type"};
this.tableChevaux = new JTable(this.extraireChevaux(), column);
JScrollPane uneScroll = new JScrollPane(this.tableChevaux);
uneScroll.setBounds(10, 50, 880, 540);
tableChevaux.setEnabled(false);
this.add(uneScroll);
this.setVisible(false);
}
@Override
public void actionPerformed(ActionEvent e) {
}
//extraire les Chevaux BDD
public Object [][] extraireChevaux ()
{
ArrayList <Cheval> 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;
}
}

View File

@@ -0,0 +1,191 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Cheval;
import modele.ModeleCheval;
public class VueChevauxA extends JPanel implements ActionListener
{
private JTextField txtNom = new JTextField();
private JTextField txtProprietaire = new JTextField();
private JTextField txtImgC = new JTextField();
private JTextField txtAge = new JTextField();
private JTextField txtRobe = new JTextField();
private JTextField txtType = new JTextField();
private JTextField txtRace = new JTextField();
private ButtonGroup bg = new ButtonGroup();
private JRadioButton jrH = new JRadioButton("M<EFBFBD>LE");
private JRadioButton jrF = new JRadioButton("FEMELLE");
private String txtSexe =null;
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Ajouter");
public VueChevauxA()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel(""); JLabel lbVide4 = new JLabel(""); JLabel lbVide5 = new JLabel("");
JLabel lbVide6 = new JLabel("");
/*AFFICHAGE ECRAN & DONNEES BDD*/
this.setBounds(50, 130, 900, 500);
this.setLayout(new GridLayout(14, 4));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Ajouter un cheval");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide1); this.add(lbVide5); this.add(lbVide6);
JLabel lbNom = new JLabel(" *Nom :");
lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbNom); this.add(this.txtNom);
JLabel lbProprietaire = new JLabel(" *Propri<72>taire :");
lbProprietaire.setFont(new Font(lbProprietaire.getText(), Font.CENTER_BASELINE, 18));
this.add(lbProprietaire); this.add(this.txtProprietaire);
JLabel lbSexe = new JLabel(" Sexe :");
lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
this.add(lbSexe); this.add(lbVide2);
jrH.setSelected(true);
bg.add(jrH); this.add(jrH);
bg.add(jrF); this.add(jrF);
JLabel lbAge = new JLabel(" <20>ge :");
lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
this.add(lbAge); this.add(this.txtAge);
JLabel lbType = new JLabel(" Type :");
lbType.setFont(new Font(lbType.getText(), Font.CENTER_BASELINE, 18));
this.add(lbType); this.add(this.txtType);
JLabel lbRace = new JLabel(" Race :");
lbRace.setFont(new Font(lbRace.getText(), Font.CENTER_BASELINE, 18));
this.add(lbRace); this.add(this.txtRace);
JLabel lbRobe = new JLabel(" Robe :");
lbRobe.setFont(new Font(lbRobe.getText(), Font.CENTER_BASELINE, 18));
this.add(lbRobe); this.add(this.txtRobe);
JLabel lbImgC = new JLabel(" Image :");
lbImgC.setFont(new Font(lbImgC.getText(), Font.CENTER_BASELINE, 18));
this.add(lbImgC); this.add(this.txtImgC);
this.add(lbVide3); this.add(lbVide4);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
JLabel lbinfo = new JLabel(" Les champs pr<70>c<EFBFBD>d<EFBFBD>s d'une * sont obligatoires ");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfo);
}
@Override
public void actionPerformed(ActionEvent e) {
if(jrH.isSelected())
{
txtSexe = jrH.getText();
}
else if(jrF.isSelected())
{
txtSexe = jrF.getText();
}
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtAge.setBackground(Color.WHITE);
this.txtNom.setBackground(Color.WHITE);
this.txtProprietaire.setBackground(Color.WHITE);
this.txtRobe.setBackground(Color.WHITE);
this.txtType.setBackground(Color.WHITE);
this.txtRace.setBackground(Color.WHITE);
this.txtRobe.setText(null);
this.txtNom.setText(null);
this.txtProprietaire.setText(null);
jrH.setSelected(true);
this.txtRace.setText(null);
this.txtImgC.setText(null);
this.txtAge.setText(null);
this.txtType.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
int age=Integer.parseInt(this.txtAge.getText());
String nom = this.txtNom.getText();
String sexe = this.txtSexe;
jrH.setSelected(true);
String proprietaire = this.txtProprietaire.getText();
String robe = this.txtRobe.getText();
String type = this.txtType.getText();
String race = this.txtRace.getText();
String imagecheval = this.txtImgC.getText();
try{
if(nom.equals("")||proprietaire.equals(""))
{
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs obligatoire");
}
else
{
Cheval unCheval = new Cheval( age, nom, sexe, proprietaire, robe, type, race, imagecheval);
ModeleCheval.insert(unCheval);
JOptionPane.showMessageDialog(this, "Insertion reussie");
this.txtAge.setText(null);
this.txtNom.setText(null);
jrH.setSelected(true);
this.txtProprietaire.setText(null);
this.txtRobe.setText(null);
this.txtType.setText(null);
this.txtRace.setText(null);
this.txtImgC.setText(null);
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtAge.setBackground(Color.RED);
this.txtNom.setBackground(Color.RED);
this.txtProprietaire.setBackground(Color.RED);
this.txtRobe.setBackground(Color.RED);
this.txtType.setBackground(Color.RED);
this.txtRace.setBackground(Color.RED);
}
}
}
class StateListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
}
}
}

View File

@@ -0,0 +1,198 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Cheval;
import modele.ModeleCheval;
public class VueChevauxM extends JPanel implements ActionListener
{
private JTextField txtNom = new JTextField();
private JTextField txtProprietaire = new JTextField();
private JTextField txtImgC = new JTextField();
private JTextField txtAge = new JTextField();
private JTextField txtRobe = new JTextField();
private JTextField txtType = new JTextField();
private JTextField txtRace = new JTextField();
private ButtonGroup bg = new ButtonGroup();
private JRadioButton jrH = new JRadioButton("M<EFBFBD>LE");
private JRadioButton jrF = new JRadioButton("FEMELLE");
private String txtSexe = null;
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Modifier");
public VueChevauxM()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel(""); JLabel lbVide4 = new JLabel(""); JLabel lbVide5 = new JLabel("");
JLabel lbVide6 = new JLabel("");
this.setBounds(50, 130, 900, 500);
this.setLayout(new GridLayout(14, 4));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Modifier un cheval");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide5);
JLabel lbinfoM = new JLabel(" ! Tous les champs doivent <20>tre remplis ! ");
lbinfoM.setFont(new Font(lbinfoM.getText(), Font.CENTER_BASELINE, 12));
lbinfoM.setForeground(Color.red);
this.add(lbinfoM);
this.add(lbVide6);
JLabel lbNom = new JLabel(" *Nom d'un cheval <20>xistant :");
lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbNom); this.add(this.txtNom);
JLabel lbProprietaire = new JLabel(" *Proprietaire du cheval:");
lbProprietaire.setFont(new Font(lbProprietaire.getText(), Font.CENTER_BASELINE, 18));
this.add(lbProprietaire); this.add(this.txtProprietaire);
JLabel lbSexe = new JLabel(" Sexe :");
lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
this.add(lbSexe); this.add(lbVide2);
jrH.setSelected(true);
bg.add(jrH); this.add(jrH);
bg.add(jrF); this.add(jrF);
JLabel lbAge = new JLabel(" <20>ge :");
lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
this.add(lbAge); this.add(this.txtAge);
JLabel lbType = new JLabel(" Type :");
lbType.setFont(new Font(lbType.getText(), Font.CENTER_BASELINE, 18));
this.add(lbType); this.add(this.txtType);
JLabel lbRace = new JLabel(" Race :");
lbRace.setFont(new Font(lbRace.getText(), Font.CENTER_BASELINE, 18));
this.add(lbRace); this.add(this.txtRace);
JLabel lbRobe = new JLabel(" Robe :");
lbRobe.setFont(new Font(lbRobe.getText(), Font.CENTER_BASELINE, 18));
this.add(lbRobe); this.add(this.txtRobe);
JLabel lbImgC = new JLabel(" Image :");
lbImgC.setFont(new Font(lbImgC.getText(), Font.CENTER_BASELINE, 18));
this.add(lbImgC); this.add(this.txtImgC);
this.add(lbVide3); this.add(lbVide4);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
JLabel lbinfo = new JLabel(" Les champs pr<70>c<EFBFBD>d<EFBFBD>s d'une * sont obligatoires ");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfo);
}
@Override
public void actionPerformed(ActionEvent e) {
if(jrH.isSelected())
{
txtSexe = jrH.getText();
}
else if(jrF.isSelected())
{
txtSexe = jrF.getText();
}
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtAge.setBackground(Color.WHITE);
this.txtNom.setBackground(Color.WHITE);
this.txtProprietaire.setBackground(Color.WHITE);
this.txtRobe.setBackground(Color.WHITE);
this.txtType.setBackground(Color.WHITE);
this.txtRace.setBackground(Color.WHITE);
this.txtAge.setText(null);
this.txtNom.setText(null);
jrH.setSelected(true);
this.txtProprietaire.setText(null);
this.txtRobe.setText(null);
this.txtType.setText(null);
this.txtRace.setText(null);
this.txtImgC.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
int age=Integer.parseInt(this.txtAge.getText());
String nom = this.txtNom.getText();
String sexe = this.txtSexe;
String proprietaire = this.txtProprietaire.getText();
String robe = this.txtRobe.getText();
String type = this.txtType.getText();
String race = this.txtRace.getText();
String imagecheval = this.txtImgC.getText();
try{
if(nom.equals("")||proprietaire.equals(""))
{
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs obligatoire");
}
else
{
Cheval unCheval = new Cheval( age, nom, sexe, proprietaire, robe, type, race, imagecheval);
ModeleCheval.update(unCheval, nom, proprietaire);
JOptionPane.showMessageDialog(this, "Modification reussie");
this.txtAge.setText(null);
this.txtNom.setText(null);
jrH.setSelected(true);
this.txtProprietaire.setText(null);
this.txtRobe.setText(null);
this.txtType.setText(null);
this.txtRace.setText(null);
this.txtImgC.setText(null);
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtAge.setBackground(Color.RED);
this.txtNom.setBackground(Color.RED);
this.txtProprietaire.setBackground(Color.RED);
this.txtRobe.setBackground(Color.RED);
this.txtType.setBackground(Color.RED);
this.txtRace.setBackground(Color.RED);
this.txtImgC.setBackground(Color.RED);
}
}
}
class StateListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
}
}
}

View File

@@ -0,0 +1,102 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Cheval;
import modele.ModeleCheval;
public class VueChevauxS extends JPanel implements ActionListener
{
private JTextField txtNom = new JTextField();
private JTextField txtProprietaire = new JTextField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Supprimer");
public VueChevauxS()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");JLabel lbVide5 = new JLabel("");
this.setBounds(150, 250, 700, 150);
this.setLayout(new GridLayout(6,2));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Supprimer un cheval");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide3); this.add(lbVide4); this.add(lbVide5);
JLabel lbNom = new JLabel(" Nom :");
lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbNom); this.add(this.txtNom);
JLabel lbProp = new JLabel(" Propri<72>taire :");
lbProp.setFont(new Font(lbProp.getText(), Font.CENTER_BASELINE, 18));
this.add(lbProp); this.add(this.txtProprietaire);
this.add(lbVide1); this.add(lbVide2);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtNom.setBackground(Color.WHITE);
this.txtProprietaire.setBackground(Color.WHITE);
this.txtNom.setText(null);
this.txtProprietaire.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
String nom = this.txtNom.getText();
String proprietaire = this.txtProprietaire.getText();
try{
Cheval unCheval = new Cheval(nom , proprietaire);
ModeleCheval.delete(nom,proprietaire);
JOptionPane.showMessageDialog(this, "Suppression reussie de " + unCheval.getNom());
this.txtNom.setText(null);
this.txtProprietaire.setText(null);
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtNom.setBackground(Color.RED);
this.txtProprietaire.setBackground(Color.RED);
}
}
}
}

View File

@@ -0,0 +1,87 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import controleur.Gestion;
import controleur.Profil;
import modele.Modele;
public class VueConnexion extends JPanel implements ActionListener
{
private JTextField txtMail = new JTextField();
private JPasswordField txtMdp = new JPasswordField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btSeConnecter = new JButton("Se connecter");
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");
public VueConnexion()
{
this.setBounds(200, 350, 600, 200);
this.setLayout(new GridLayout(4,2));
this.setBackground(new Color(230,230,230));
JLabel lbMail = new JLabel(" E-mail :");
lbMail.setFont(new Font(lbMail.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMail); this.add(this.txtMail);
JLabel lbMdp = new JLabel(" Mot de passe :");
lbMdp.setFont(new Font(lbMdp.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMdp); this.add(this.txtMdp);
this.add(lbVide1);this.add(lbVide2);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btSeConnecter);
this.btSeConnecter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btSeConnecter.addActionListener(this);
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == this.btAnnuler)
{
this.txtMail.setText("");
this.txtMdp.setText("");
}
else if(e.getSource() == this.btSeConnecter)
{
String adressemail = this.txtMail.getText();
String mdp = new String(this.txtMdp.getPassword());
Profil unProfil = Modele.selectWhere(adressemail, mdp);
if(unProfil == null)
{
JOptionPane.showMessageDialog(this, "Veuillez v<>rifier vos identifiants !");
}
else
{
JOptionPane.showMessageDialog(this,"<html><center>Connexion r<>ussie!<br> Bonjour " + unProfil.getLogin() + "</center></html>");
// ouvrir le menu g<>n<EFBFBD>ral
new Generale(unProfil);
this.txtMail.setText("");
this.txtMdp.setText("");
Gestion.rendreVisible(false);
}
}
}
}

View File

@@ -0,0 +1,62 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import controleur.Cours;
import modele.ModeleCours;
public class VueCours extends JPanel implements ActionListener
{
private JTable tableCours;
public VueCours ()
{ /*AFFICHAGE ECRAN*/
this.setBounds(50, 100, 900, 600);
this.setLayout(null);
this.setBackground(new Color(247,245,226));
/*TITRE*/
JLabel titre = new JLabel(" Liste des cours ");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
titre.setBounds(345, 5, 300, 50);
add(titre);
/*GRILLE BDD*/
String column [] = {"Date du cours", "D<EFBFBD>bute <20>", "Fini <20>", "ID d'<27>l<EFBFBD>ve", "ID Formateur","ID de Cheval" };
this.tableCours = new JTable(this.extraireCours(), column);
JScrollPane uneScroll = new JScrollPane(this.tableCours);
uneScroll.setBounds(10, 50, 880, 540);
tableCours.setEnabled(false);
this.add(uneScroll);
this.setVisible(false);
}
@Override
public void actionPerformed(ActionEvent e) {
}
//extraire les Cours BDD
public Object [][] extraireCours ()
{
ArrayList <Cours> lesCours = ModeleCours.selectAll();
Object [][] donnees = new Object [lesCours.size()][6];
int i =0;
for (Cours unCours : lesCours)
{
donnees[i][0] = unCours.getDateCours();
donnees[i][1] = unCours.getHeureDebut();
donnees[i][2] = unCours.getHeureFin();
donnees[i][3] = unCours.getIdEleve();
donnees[i][4] = unCours.getIdFormateur();
donnees[i][5] = unCours.getIdCheval();
i++;
}
return donnees;
}
}

View File

@@ -0,0 +1,171 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import controleur.Cours;
import modele.ModeleCours;
public class VueCoursA extends JPanel implements ActionListener
{
private JTextField txtDate = new JTextField();
private JTextField txtHeureD = new JTextField();
private JTextField txtHeureF = new JTextField();
private JTextField txtEleve = new JTextField();
private JTextField txtFormateur = new JTextField();
private JTextField txtCheval = new JTextField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Ajouter");
public VueCoursA()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel(""); JLabel lbVide4 = new JLabel(""); JLabel lbVide5 = new JLabel("");
JLabel lbVide6 = new JLabel("");
/* AFFICHAGE ECRAN*/
this.setBounds(50, 130, 900, 500);
this.setLayout(new GridLayout(8, 4));
this.setBackground(new Color(230,230,230));
/*TITRE & DONNEES BDD*/
JLabel titre = new JLabel("Ajouter un cours");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide1); this.add(lbVide5); this.add(lbVide6);
JLabel lbDate = new JLabel(" *Date du cours :");
lbDate.setFont(new Font(lbDate.getText(), Font.CENTER_BASELINE, 18));
this.add(lbDate); this.add(this.txtDate);
JLabel lbHeureD = new JLabel(" *Heure de d<>but :");
lbHeureD.setFont(new Font(lbHeureD.getText(), Font.CENTER_BASELINE, 18));
this.txtHeureD.setText("HH:MM:SS");
this.add(lbHeureD); this.add(this.txtHeureD);
JLabel lbHeureF = new JLabel(" *Heure de fin :");
lbHeureF.setFont(new Font(lbHeureF.getText(), Font.CENTER_BASELINE, 18));
this.txtHeureF.setText("HH:MM:SS");
this.add(lbHeureF); this.add(this.txtHeureF);
/*
JLabel lbEleve = new JLabel(" *Num<75>ro d'<27>l<EFBFBD>ve :");
lbEleve.setFont(new Font(lbEleve.getText(), Font.CENTER_BASELINE, 18));
this.add(lbEleve); this.add(this.txtEleve);
JLabel lbFormateur = new JLabel(" *Num<75>ro de formateur:");
lbFormateur.setFont(new Font(lbFormateur.getText(), Font.CENTER_BASELINE, 18));
this.add(lbFormateur); this.add(this.txtFormateur);
JLabel lbCheval = new JLabel(" *Num<75>ro de cheval :");
lbCheval.setFont(new Font(lbCheval.getText(), Font.CENTER_BASELINE, 18));
this.add(lbCheval); this.add(this.txtCheval);
*/
JLabel lbinfo = new JLabel(" Format Date : 2017-07-13 - Temps : 11:00:00 ");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.txtDate.setText("AAAA-MM-JJ");
this.add(lbinfo);
this.add(lbVide4);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
}
/*EVENT*/
@Override
public void actionPerformed(ActionEvent e) {
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtDate.setBackground(Color.WHITE);
this.txtHeureD.setBackground(Color.WHITE);
this.txtHeureF.setBackground(Color.WHITE);
this.txtEleve.setBackground(Color.WHITE);
this.txtFormateur.setBackground(Color.WHITE);
this.txtCheval.setBackground(Color.WHITE);
this.txtDate.setText("AAAA-MM-JJ");
this.txtHeureD.setText("HH:MM:SS");
this.txtHeureF.setText("HH:MM:SS");
this.txtEleve.setText(null);
this.txtFormateur.setText(null);
this.txtCheval.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
String datecours = this.txtDate.getText();
String heuredebut = this.txtHeureD.getText();
String heurefin = this.txtHeureF.getText();
try{
if(datecours.equals("")||heuredebut.equals("")||heurefin.equals("")||heuredebut.equals("HH:MM:SS")||heurefin.equals("HH:MM:SS")||datecours.equals("AAAA-MM-JJ"))
{
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs correcte dans les champs obligatoire");
}
else
{
Cours unCours = new Cours(datecours, heuredebut, heurefin);
ModeleCours.insert(unCours);
JOptionPane.showMessageDialog(this, "Insertion reussie");
this.txtFormateur.setText(null);
this.txtCheval.setText(null);
this.txtHeureD.setText("HH:MM:SS");
this.txtHeureF.setText("HH:MM:SS");
this.txtEleve.setText(null);
this.txtDate.setText("AAAA-MM-JJ");
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtDate.setBackground(Color.RED);
this.txtHeureD.setBackground(Color.RED);
this.txtHeureF.setBackground(Color.RED);
this.txtEleve.setBackground(Color.RED);
this.txtFormateur.setBackground(Color.RED);
this.txtCheval.setBackground(Color.RED);
}
}
}
class StateListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
}
}
}

View File

@@ -0,0 +1,177 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import controleur.Cours;
import modele.ModeleCours;
public class VueCoursM extends JPanel implements ActionListener
{
private JTextField txtDate = new JTextField();
private JTextField txtHeureD = new JTextField();
private JTextField txtHeureF = new JTextField();
private JTextField txtEleve = new JTextField();
private JTextField txtFormateur = new JTextField();
private JTextField txtCheval = new JTextField();
private JPasswordField txtMdp = new JPasswordField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Modifier");
public VueCoursM()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel(""); JLabel lbVide4 = new JLabel("");JLabel lbVide5 = new JLabel("");
JLabel lbVide6 = new JLabel("");
this.setBounds(50, 130, 900, 500);
this.setLayout(new GridLayout(11, 4));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Modifier un cours");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide1);
JLabel lbinfoM = new JLabel(" ! Tous les champs doivent <20>tre remplis ! ");
lbinfoM.setFont(new Font(lbinfoM.getText(), Font.CENTER_BASELINE, 12));
lbinfoM.setForeground(Color.red);
this.add(lbinfoM);
this.add(lbVide6);
JLabel lbDate = new JLabel(" *Date d'un cours existant :");
lbDate.setFont(new Font(lbDate.getText(), Font.CENTER_BASELINE, 18));
this.txtDate.setText("AAAA-MM-JJ");
this.add(lbDate); this.add(this.txtDate);
JLabel lbHeureD = new JLabel(" *Heure de d<>but du cours :");
lbHeureD.setFont(new Font(lbHeureD.getText(), Font.CENTER_BASELINE, 18));
this.txtHeureD.setText("HH:MM:SS");
this.add(lbHeureD); this.add(this.txtHeureD);
JLabel lbHeureF = new JLabel(" Heure de fin :");
lbHeureF.setFont(new Font(lbHeureF.getText(), Font.CENTER_BASELINE, 18));
this.txtHeureF.setText("HH:MM:SS");
this.add(lbHeureF); this.add(this.txtHeureF);
JLabel lbEleve = new JLabel(" Num<75>ro d'<27>l<EFBFBD>ve :");
lbEleve.setFont(new Font(lbEleve.getText(), Font.CENTER_BASELINE, 18));
this.add(lbEleve); this.add(this.txtEleve);
JLabel lbFormateur = new JLabel(" Num<75>ro de formateur:");
lbFormateur.setFont(new Font(lbFormateur.getText(), Font.CENTER_BASELINE, 18));
this.add(lbFormateur); this.add(this.txtFormateur);
JLabel lbCheval = new JLabel(" Num<75>ro de cheval :");
lbCheval.setFont(new Font(lbCheval.getText(), Font.CENTER_BASELINE, 18));
this.add(lbCheval); this.add(this.txtCheval);
JLabel lbinfoF = new JLabel(" Format Date : 2017-07-13 - Temps : 11:00:00 ");
lbinfoF.setFont(new Font(lbinfoF.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfoF);
this.add(lbVide4);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
JLabel lbinfo = new JLabel(" Les champs pr<70>c<EFBFBD>d<EFBFBD>s d'une * sont obligatoires ");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfo);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtDate.setBackground(Color.WHITE);
this.txtHeureD.setBackground(Color.WHITE);
this.txtHeureF.setBackground(Color.WHITE);
this.txtEleve.setBackground(Color.WHITE);
this.txtFormateur.setBackground(Color.WHITE);
this.txtCheval.setBackground(Color.WHITE);
this.txtMdp.setBackground(Color.WHITE);
this.txtFormateur.setText(null);
this.txtCheval.setText(null);
this.txtHeureD.setText("HH:MM:SS");
this.txtHeureF.setText("HH:MM:SS");
this.txtEleve.setText(null);
this.txtDate.setText("AAAA-MM-JJ");
}
else if (e.getSource()==this.btAjouter)
{
String datecours = this.txtDate.getText();
String heuredebut = this.txtHeureD.getText();
String heurefin = this.txtHeureF.getText();
int ideleve = Integer.parseInt(this.txtEleve.getText());
int idformateur = Integer.parseInt(this.txtFormateur.getText());
int idcheval = Integer.parseInt(this.txtCheval.getText());
try{
if(datecours.equals("")||heuredebut.equals("")||heurefin.equals("")||heuredebut.equals("HH:MM:SS")||heurefin.equals("HH:MM:SS")||datecours.equals("AAAA-MM-JJ"))
{
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs correcte dans les champs obligatoire");
}
else
{
Cours unCours = new Cours(datecours, heuredebut, heurefin, ideleve, idformateur, idcheval);
ModeleCours.update(unCours, datecours, heuredebut);
JOptionPane.showMessageDialog(this, "Modification reussie");
this.txtFormateur.setText(null);
this.txtCheval.setText(null);
this.txtHeureD.setText("HH:MM:SS");
this.txtHeureF.setText("HH:MM:SS");
this.txtEleve.setText(null);
this.txtDate.setText("AAAA-MM-JJ");
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtDate.setBackground(Color.RED);
this.txtHeureD.setBackground(Color.RED);
this.txtHeureF.setBackground(Color.RED);
this.txtEleve.setBackground(Color.RED);
this.txtFormateur.setBackground(Color.RED);
this.txtCheval.setBackground(Color.RED);
}
}
}
class StateListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
}
}
}

View File

@@ -0,0 +1,109 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import controleur.Cours;
import modele.ModeleCours;
public class VueCoursS extends JPanel implements ActionListener
{
private JTextField txtDate = new JTextField();
private JTextField txtHeureD = new JTextField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Supprimer");
public VueCoursS()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");JLabel lbVide5 = new JLabel("");
this.setBounds(150, 250, 700, 150);
this.setLayout(new GridLayout(6,2));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Supprimer un cours");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide3); this.add(lbVide4); this.add(lbVide5);
JLabel lbDate = new JLabel(" Date du cours :");
lbDate.setFont(new Font(lbDate.getText(), Font.CENTER_BASELINE, 18));
this.add(lbDate); this.add(this.txtDate);
JLabel lbHeure = new JLabel(" Heure du cours :");
lbHeure.setFont(new Font(lbHeure.getText(), Font.CENTER_BASELINE, 18));
this.add(lbHeure); this.add(this.txtHeureD);
JLabel lbinfo = new JLabel(" Format Date : 2017-07-13 - Temps : 11:00:00 ");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfo);
this.add(lbVide2);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtDate.setBackground(Color.WHITE);
this.txtHeureD.setBackground(Color.WHITE);
this.txtDate.setText(null);
this.txtHeureD.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
String datecours = this.txtDate.getText();
String heuredebut = this.txtHeureD.getText();
try{
Cours unCours = new Cours(datecours , heuredebut);
ModeleCours.delete(datecours,heuredebut);
JOptionPane.showMessageDialog(this, "<html>Suppression reussie du cours de <br> " + unCours.getHeureDebut() + " du <html>" + unCours.getDateCours());
this.txtDate.setText(null);
this.txtHeureD.setText(null);
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtDate.setBackground(Color.RED);
this.txtHeureD.setBackground(Color.RED);
}
}
}
}

View File

@@ -0,0 +1,66 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import controleur.Eleve;
import modele.ModeleEleve;
public class VueEleves extends JPanel implements ActionListener
{
private JTable tableEleves;
public VueEleves ()
{/*AFFICHAGE ECRAN*/
this.setBounds(50, 100, 900, 600);
this.setLayout(null);
this.setBackground(new Color(247,245,226));
/*TITRE*/
JLabel titre = new JLabel(" Liste des <20>l<EFBFBD>ves ");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
titre.setBounds(345, 5, 300, 50);
add(titre);
/*GRILLE BDD*/
String column [] = {"Nom", "Pr<EFBFBD>nom", "Email", "Sexe", "<EFBFBD>ge", "Galop optenu", "Adresse", "Pseudo", "Mot de passe"};
this.tableEleves = new JTable(this.extraireEleves(), column);
JScrollPane uneScroll = new JScrollPane(this.tableEleves);
uneScroll.setBounds(10, 50, 880, 540);
tableEleves.setEnabled(false);
this.add(uneScroll);
this.setVisible(false);
}
@Override
public void actionPerformed(ActionEvent e) {
}
//extraire les Eleves BDD
public Object [][] extraireEleves ()
{
ArrayList <Eleve> lesEleves = ModeleEleve.selectAll();
Object [][] donnees = new Object [lesEleves.size()][9];
int i =0;
for (Eleve unEleve : lesEleves)
{
donnees[i][0] = unEleve.getNom();
donnees[i][1] = unEleve.getPrenom();
donnees[i][2] = unEleve.getAdressEmail();
donnees[i][3] = unEleve.getSexe();
donnees[i][4] = unEleve.getAge();
donnees[i][5] = unEleve.getGalop();
donnees[i][6] = unEleve.getAdresse();
donnees[i][7] = unEleve.getPseudo();
donnees[i][8] = unEleve.getMdp();
i++;
}
return donnees;
}
}

View File

@@ -0,0 +1,214 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Eleve;
import modele.ModeleEleve;
public class VueElevesA extends JPanel implements ActionListener
{
private JTextField txtPseudo = new JTextField();
private JTextField txtNom = new JTextField();
private JTextField txtPrenom = new JTextField();
private JTextField txtAdresse = new JTextField();
private JTextField txtMail = new JTextField();
private JTextField txtImgE = new JTextField();
private JTextField txtGalop = new JTextField();
private ButtonGroup bg = new ButtonGroup();
private JRadioButton jrH = new JRadioButton("HOMME");
private JRadioButton jrF = new JRadioButton("FEMME");
private String txtSexe =null;
private JTextField txtAge = new JTextField();
private JPasswordField txtMdp = new JPasswordField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Ajouter");
public VueElevesA()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");JLabel lbVide5 = new JLabel("");
JLabel lbVide6 = new JLabel("");
/*AFFICHAGE ECRAN */
this.setBounds(50, 130, 900, 500);
this.setLayout(new GridLayout(16, 4));
this.setBackground(new Color(230,230,230));
/*TITRE & DONNEES BDD*/
JLabel titre = new JLabel("Ajouter un <20>l<EFBFBD>ve");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide1); this.add(lbVide5); this.add(lbVide6);
JLabel lbPseudo = new JLabel(" *Pseudo :");
lbPseudo.setFont(new Font(lbPseudo.getText(), Font.CENTER_BASELINE, 18));
this.add(lbPseudo); this.add(this.txtPseudo);
JLabel lbNom = new JLabel(" *Nom :");
lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbNom); this.add(this.txtNom);
JLabel lbPrenom = new JLabel(" *Prenom :");
lbPrenom.setFont(new Font(lbPrenom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbPrenom); this.add(this.txtPrenom);
JLabel lbAdresse = new JLabel(" Adresse :");
lbAdresse.setFont(new Font(lbAdresse.getText(), Font.CENTER_BASELINE, 18));
this.add(lbAdresse); this.add(this.txtAdresse);
JLabel lbMail = new JLabel(" *E-mail :");
lbMail.setFont(new Font(lbMail.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMail); this.add(this.txtMail);
JLabel lbMdp = new JLabel(" *Mot de passe :");
lbMdp.setFont(new Font(lbMdp.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMdp); this.add(this.txtMdp);
JLabel lbImgE = new JLabel(" Avatar :");
lbImgE.setFont(new Font(lbImgE.getText(), Font.CENTER_BASELINE, 18));
this.add(lbImgE); this.add(this.txtImgE);
JLabel lbSexe = new JLabel(" Sexe :");
lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
this.add(lbSexe); this.add(lbVide2);
jrH.setSelected(true);
bg.add(jrH); this.add(jrH);
bg.add(jrF); this.add(jrF);
JLabel lbAge = new JLabel(" <20>ge :");
lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
this.add(lbAge); this.add(this.txtAge);
JLabel lbGalop = new JLabel(" Galop :");
lbGalop.setFont(new Font(lbGalop.getText(), Font.CENTER_BASELINE, 18));
this.add(lbGalop); this.add(this.txtGalop);
this.add(lbVide3); this.add(lbVide4);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
JLabel lbinfo = new JLabel(" Les champs pr<70>c<EFBFBD>d<EFBFBD>s d'une * sont obligatoires ");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfo);
}
/*EVENT*/
@Override
public void actionPerformed(ActionEvent e) {
if (jrH.isSelected()) {
txtSexe = jrH.getText();
}
else if (jrF.isSelected()) {
txtSexe = jrF.getText();
}
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtAge.setBackground(Color.WHITE);
this.txtGalop.setBackground(Color.WHITE);
this.txtNom.setBackground(Color.WHITE);
this.txtPrenom.setBackground(Color.WHITE);
this.txtAdresse.setBackground(Color.WHITE);
this.txtMail.setBackground(Color.WHITE);
this.txtPseudo.setBackground(Color.WHITE);
this.txtMdp.setBackground(Color.WHITE);
this.txtImgE.setBackground(Color.WHITE);
this.txtPseudo.setText(null);
this.txtNom.setText(null);
this.txtPrenom.setText(null);
this.txtAdresse.setText(null);
this.txtMail.setText(null);
jrH.setSelected(true);
this.txtAge.setText(null);
this.txtGalop.setText(null);
this.txtMdp.setText(null);
this.txtImgE.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
int age=Integer.parseInt(this.txtAge.getText());
int galop=Integer.parseInt(this.txtGalop.getText());
String nom = this.txtNom.getText();
String prenom = this.txtPrenom.getText();
String adresse = this.txtAdresse.getText();
String adressemail = this.txtMail.getText();
String sexe = this.txtSexe;
String pseudo = this.txtPseudo.getText();
String mdp = (this.txtMdp.getText());
String imageeleve = this.txtImgE.getText();
try{
if(pseudo.equals("")||nom.equals("")||prenom.equals("")||adressemail.equals("")||mdp.equals(""))
{
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs obligatoire");
}
else
{
Eleve unEleve = new Eleve(age, galop, nom, prenom, adresse, adressemail, sexe, pseudo, mdp, imageeleve);
ModeleEleve.insert(unEleve);
JOptionPane.showMessageDialog(this, "Insertion reussie");
this.txtAge.setText(null);
this.txtGalop.setText(null);
this.txtNom.setText(null);
this.txtPrenom.setText(null);
this.txtAdresse.setText(null);
this.txtMail.setText(null);
jrH.setSelected(true);
this.txtSexe=(null);
this.txtPseudo.setText(null);
this.txtMdp.setText(null);
this.txtImgE.setText(null);
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtAge.setBackground(Color.RED);
this.txtGalop.setBackground(Color.RED);
this.txtNom.setBackground(Color.RED);
this.txtPrenom.setBackground(Color.RED);
this.txtAdresse.setBackground(Color.RED);
this.txtMail.setBackground(Color.RED);
this.txtPseudo.setBackground(Color.RED);
this.txtMdp.setBackground(Color.RED);
this.txtImgE.setBackground(Color.RED);
}
}
}
class StateListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
}
}
}

View File

@@ -0,0 +1,209 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Eleve;
import modele.ModeleEleve;
public class VueElevesM extends JPanel implements ActionListener
{
private JTextField txtPseudo = new JTextField();
private JTextField txtNom = new JTextField();
private JTextField txtPrenom = new JTextField();
private JTextField txtAdresse = new JTextField();
private JTextField txtMail = new JTextField();
private JTextField txtImgE = new JTextField();
private JTextField txtGalop = new JTextField();
private ButtonGroup bg = new ButtonGroup();
private JRadioButton jrH = new JRadioButton("HOMME");
private JRadioButton jrF = new JRadioButton("FEMME");
private String txtSexe =null;
private JTextField txtAge = new JTextField();
private JPasswordField txtMdp = new JPasswordField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Modifier");
public VueElevesM()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");JLabel lbVide5 = new JLabel("");
JLabel lbVide6 = new JLabel("");
this.setBounds(50, 130, 900, 500);
this.setLayout(new GridLayout(16, 4));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Modifier un <20>l<EFBFBD>ve");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide1);
JLabel lbinfoM = new JLabel(" ! Tous les champs doivent <20>tre remplis ! ");
lbinfoM.setFont(new Font(lbinfoM.getText(), Font.CENTER_BASELINE, 12));
lbinfoM.setForeground(Color.red);
this.add(lbinfoM);
this.add(lbVide6);
JLabel lbPseudo = new JLabel(" *Pseudo d'un <20>l<EFBFBD>ve <20>xistant:");
lbPseudo.setFont(new Font(lbPseudo.getText(), Font.CENTER_BASELINE, 18));
this.add(lbPseudo); this.add(this.txtPseudo);
JLabel lbNom = new JLabel(" Nom :");
lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbNom); this.add(this.txtNom);
JLabel lbPrenom = new JLabel(" Prenom :");
lbPrenom.setFont(new Font(lbPrenom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbPrenom); this.add(this.txtPrenom);
JLabel lbAdresse = new JLabel(" Adresse :");
lbAdresse.setFont(new Font(lbAdresse.getText(), Font.CENTER_BASELINE, 18));
this.add(lbAdresse); this.add(this.txtAdresse);
JLabel lbMail = new JLabel(" E-mail :");
lbMail.setFont(new Font(lbMail.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMail); this.add(this.txtMail);
JLabel lbMdp = new JLabel(" Mot de passe :");
lbMdp.setFont(new Font(lbMdp.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMdp); this.add(this.txtMdp);
JLabel lbImgE = new JLabel(" Avatar :");
lbImgE.setFont(new Font(lbImgE.getText(), Font.CENTER_BASELINE, 18));
this.add(lbImgE); this.add(this.txtImgE);
JLabel lbSexe = new JLabel(" Sexe :");
lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
this.add(lbSexe); this.add(lbVide2);
jrH.setSelected(true);
bg.add(jrH); this.add(jrH);
bg.add(jrF); this.add(jrF);
JLabel lbAge = new JLabel(" <20>ge :");
lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
this.add(lbAge); this.add(this.txtAge);
JLabel lbGalop = new JLabel(" Galop :");
lbGalop.setFont(new Font(lbGalop.getText(), Font.CENTER_BASELINE, 18));
this.add(lbGalop); this.add(this.txtGalop);
this.add(lbVide3); this.add(lbVide4);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
JLabel lbinfo = new JLabel(" Les champs pr<70>c<EFBFBD>d<EFBFBD>s d'une * sont obligatoires");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfo);
}
@Override
public void actionPerformed(ActionEvent e) {
if (jrH.isSelected()) {
txtSexe = jrH.getText();
}
else if (jrF.isSelected()) {
txtSexe = jrF.getText();
}
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtAge.setBackground(Color.WHITE);
this.txtGalop.setBackground(Color.WHITE);
this.txtNom.setBackground(Color.WHITE);
this.txtPrenom.setBackground(Color.WHITE);
this.txtAdresse.setBackground(Color.WHITE);
this.txtMail.setBackground(Color.WHITE);
this.txtPseudo.setBackground(Color.WHITE);
this.txtMdp.setBackground(Color.WHITE);
this.txtImgE.setBackground(Color.WHITE);
this.txtAge.setText(null);
this.txtGalop.setText(null);
this.txtNom.setText(null);
this.txtPrenom.setText(null);
this.txtAdresse.setText(null);
this.txtMail.setText(null);
jrH.setSelected(true);
this.txtSexe=(null);
this.txtPseudo.setText(null);
this.txtMdp.setText(null);
this.txtImgE.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
int age=Integer.parseInt(this.txtAge.getText());
int galop=Integer.parseInt(this.txtGalop.getText());
String nom = this.txtNom.getText();
String prenom = this.txtPrenom.getText();
String adresse = this.txtAdresse.getText();
String adressemail = this.txtMail.getText();
String sexe = this.txtSexe;
String pseudo = this.txtPseudo.getText();
String mdp = (this.txtMdp.getText());
String imageeleve = this.txtImgE.getText();
try{
if(pseudo.equals(""))
{
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs obligatoire");
}
else
{
Eleve unEleve = new Eleve(age, galop, nom, prenom, adresse, adressemail, sexe, pseudo, mdp, imageeleve);
ModeleEleve.update(unEleve, pseudo);
JOptionPane.showMessageDialog(this, "Modification reussie");
this.txtAge.setText(null);
this.txtGalop.setText(null);
this.txtNom.setText(null);
this.txtPrenom.setText(null);
this.txtAdresse.setText(null);
this.txtMail.setText(null);
jrH.setSelected(true);
this.txtSexe=(null);
this.txtPseudo.setText(null);
this.txtMdp.setText(null);
this.txtImgE.setText(null);
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtAge.setBackground(Color.RED);
this.txtGalop.setBackground(Color.RED);
this.txtNom.setBackground(Color.RED);
this.txtPrenom.setBackground(Color.RED);
this.txtAdresse.setBackground(Color.RED);
this.txtMail.setBackground(Color.RED);
this.txtPseudo.setBackground(Color.RED);
this.txtMdp.setBackground(Color.RED);
this.txtImgE.setBackground(Color.RED);
}
}
}
class StateListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
}
}
}

View File

@@ -0,0 +1,96 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Eleve;
import modele.ModeleEleve;
public class VueElevesS extends JPanel implements ActionListener
{
private JTextField txtPseudo = new JTextField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Supprimer");
public VueElevesS()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");JLabel lbVide5 = new JLabel("");
this.setBounds(150, 250, 700, 150);
this.setLayout(new GridLayout(5,2));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Supprimer un <20>l<EFBFBD>ve");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide3); this.add(lbVide4); this.add(lbVide5);
JLabel lbPseudo = new JLabel(" Pseudo :");
lbPseudo.setFont(new Font(lbPseudo.getText(), Font.CENTER_BASELINE, 18));
this.add(lbPseudo); this.add(this.txtPseudo);
this.add(lbVide1); this.add(lbVide2);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtPseudo.setBackground(Color.WHITE);
this.txtPseudo.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
String pseudo = this.txtPseudo.getText();
try{
Eleve unEleve = new Eleve(pseudo);
ModeleEleve.delete(pseudo);
JOptionPane.showMessageDialog(this, "Suppression reussie de " + unEleve.getPseudo());
this.txtPseudo.setText(null);
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtPseudo.setBackground(Color.RED);
}
}
}
}

View File

@@ -0,0 +1,63 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import controleur.Formateur;
import modele.ModeleFormateur;
public class VueFormateurs extends JPanel implements ActionListener
{
private JTable tableFormateurs;
public VueFormateurs ()
{ /*AFFICHAGE ECRAN*/
this.setBounds(50, 100, 900, 600);
this.setLayout(null);
this.setBackground(new Color(247,245,226));
/*TITRE*/
JLabel titre = new JLabel(" Liste des formateurs ");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
titre.setBounds(315, 5, 300, 50);
add(titre);
/*GRILLE BDD*/
String column [] = {"Nom", "Pr<EFBFBD>nom", "Email", "Sexe", "<EFBFBD>ge", "Galop optenu", "Login", "Mot de passe"};
this.tableFormateurs = new JTable(this.extraireFormateurs(), column);
JScrollPane uneScroll = new JScrollPane(this.tableFormateurs);
uneScroll.setBounds(10, 50, 880, 540);
tableFormateurs.setEnabled(false);
this.add(uneScroll);
this.setVisible(false);
}
@Override
public void actionPerformed(ActionEvent e) {
}
//extraire les Formateurs BDD
public Object [][] extraireFormateurs ()
{
ArrayList <Formateur> lesFormateurs = ModeleFormateur.selectAll();
Object [][] donnees = new Object [lesFormateurs.size()][8];
int i =0;
for (Formateur unFormateur : lesFormateurs)
{
donnees[i][0] = unFormateur.getNom();
donnees[i][1] = unFormateur.getPrenom();
donnees[i][2] = unFormateur.getAdressEmail();
donnees[i][3] = unFormateur.getSexe();
donnees[i][4] = unFormateur.getAge();
donnees[i][5] = unFormateur.getGalop();
donnees[i][6] = unFormateur.getLogin();
donnees[i][7] = unFormateur.getMdp();
i++;
}
return donnees;
}
}

View File

@@ -0,0 +1,198 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Formateur;
import modele.ModeleFormateur;
public class VueFormateursA extends JPanel implements ActionListener
{
private JTextField txtLogin = new JTextField();
private JTextField txtNom = new JTextField();
private JTextField txtPrenom = new JTextField();
private JTextField txtMail = new JTextField();
private JTextField txtAge = new JTextField();
private JTextField txtGalop = new JTextField();
private JPasswordField txtMdp = new JPasswordField();
private ButtonGroup bg = new ButtonGroup();
private JRadioButton jrH = new JRadioButton("HOMME");
private JRadioButton jrF = new JRadioButton("FEMME");
private String txtSexe =null;
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Ajouter");
public VueFormateursA()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel(""); JLabel lbVide4 = new JLabel(""); JLabel lbVide5 = new JLabel("");
JLabel lbVide6 = new JLabel("");
/* AFFICHAGE ECRAN*/
this.setBounds(50, 130, 900, 500);
this.setLayout(new GridLayout(14, 4));
this.setBackground(new Color(230,230,230));
/*TITRE & DONNEES BDD*/
JLabel titre = new JLabel("Ajouter un formateur");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide1); this.add(lbVide5); this.add(lbVide6);
JLabel lbLogin = new JLabel(" *Login :");
lbLogin.setFont(new Font(lbLogin.getText(), Font.CENTER_BASELINE, 18));
this.add(lbLogin); this.add(this.txtLogin);
JLabel lbNom = new JLabel(" *Nom :");
lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbNom); this.add(this.txtNom);
JLabel lbPrenom = new JLabel(" *Prenom :");
lbPrenom.setFont(new Font(lbPrenom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbPrenom); this.add(this.txtPrenom);
JLabel lbMail = new JLabel(" *E-mail :");
lbMail.setFont(new Font(lbMail.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMail); this.add(this.txtMail);
JLabel lbMdp = new JLabel(" *Mot de passe :");
lbMdp.setFont(new Font(lbMdp.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMdp); this.add(this.txtMdp);
JLabel lbSexe = new JLabel(" Sexe :");
lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
this.add(lbSexe); this.add(lbVide2);
jrH.setSelected(true);
bg.add(jrH); this.add(jrH);
bg.add(jrF); this.add(jrF);
JLabel lbAge = new JLabel(" <20>ge :");
lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
this.add(lbAge); this.add(this.txtAge);
JLabel lbGalop = new JLabel(" Galop :");
lbGalop.setFont(new Font(lbGalop.getText(), Font.CENTER_BASELINE, 18));
this.add(lbGalop); this.add(this.txtGalop);
this.add(lbVide3); this.add(lbVide4);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
JLabel lbinfo = new JLabel(" Les champs pr<70>c<EFBFBD>d<EFBFBD>s d'une * sont obligatoires ");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfo);
}
/*EVENT*/
@Override
public void actionPerformed(ActionEvent e) {
if(jrH.isSelected())
{
txtSexe = jrH.getText();
}
else if(jrF.isSelected())
{
txtSexe = jrF.getText();
}
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtLogin.setBackground(Color.WHITE);
this.txtNom.setBackground(Color.WHITE);
this.txtPrenom.setBackground(Color.WHITE);
this.txtMail.setBackground(Color.WHITE);
this.txtAge.setBackground(Color.WHITE);
this.txtGalop.setBackground(Color.WHITE);
this.txtMdp.setBackground(Color.WHITE);
this.txtLogin.setText(null);
this.txtNom.setText(null);
this.txtPrenom.setText(null);
this.txtMail.setText(null);
jrH.setSelected(true);
this.txtAge.setText(null);
this.txtGalop.setText(null);
this.txtMdp.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
String login = this.txtLogin.getText();
String nom = this.txtNom.getText();
String prenom = this.txtPrenom.getText();
String adressemail = this.txtMail.getText();
String sexe = this.txtSexe;
int age=Integer.parseInt(this.txtAge.getText());
int galop=Integer.parseInt(this.txtGalop.getText());
@SuppressWarnings("deprecation")
String mdp = (this.txtMdp.getText());
try{
if(login.equals("")||nom.equals("")||prenom.equals("")||adressemail.equals("")||mdp.equals(""))
{
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs obligatoire");
}
else
{
Formateur unFormateur = new Formateur(age, galop, nom, prenom, adressemail, sexe, login, mdp);
ModeleFormateur.insert(unFormateur);
JOptionPane.showMessageDialog(this, "Insertion reussie");
this.txtAge.setText(null);
this.txtGalop.setText(null);
this.txtNom.setText(null);
this.txtPrenom.setText(null);
this.txtMail.setText(null);
jrH.setSelected(true);
this.txtLogin.setText(null);
this.txtMdp.setText(null);
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtLogin.setBackground(Color.RED);
this.txtNom.setBackground(Color.RED);
this.txtPrenom.setBackground(Color.RED);
this.txtMail.setBackground(Color.RED);
this.txtAge.setBackground(Color.RED);
this.txtGalop.setBackground(Color.RED);
this.txtMdp.setBackground(Color.RED);
}
}
}
class StateListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
}
}
}

View File

@@ -0,0 +1,200 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Formateur;
import modele.ModeleFormateur;
public class VueFormateursM extends JPanel implements ActionListener
{
private JTextField txtLogin = new JTextField();
private JTextField txtNom = new JTextField();
private JTextField txtPrenom = new JTextField();
private JTextField txtMail = new JTextField();
private JTextField txtAge = new JTextField();
private JTextField txtGalop = new JTextField();
private JPasswordField txtMdp = new JPasswordField();
private ButtonGroup bg = new ButtonGroup();
private JRadioButton jrH = new JRadioButton("HOMME");
private JRadioButton jrF = new JRadioButton("FEMME");
private String txtSexe =null;
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Modifier");
public VueFormateursM()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel(""); JLabel lbVide4 = new JLabel("");JLabel lbVide5 = new JLabel("");
JLabel lbVide6 = new JLabel("");
this.setBounds(50, 130, 900, 500);
this.setLayout(new GridLayout(14, 4));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Modifier un formateur");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide1);
JLabel lbinfoM = new JLabel(" ! Tous les champs doivent <20>tre remplis ! ");
lbinfoM.setFont(new Font(lbinfoM.getText(), Font.CENTER_BASELINE, 12));
lbinfoM.setForeground(Color.red);
this.add(lbinfoM);
this.add(lbVide6);
JLabel lbLogin = new JLabel(" *Login d'un formateur existant :");
lbLogin.setFont(new Font(lbLogin.getText(), Font.CENTER_BASELINE, 18));
this.add(lbLogin); this.add(this.txtLogin);
JLabel lbNom = new JLabel(" Nom :");
lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbNom); this.add(this.txtNom);
JLabel lbPrenom = new JLabel(" Prenom :");
lbPrenom.setFont(new Font(lbPrenom.getText(), Font.CENTER_BASELINE, 18));
this.add(lbPrenom); this.add(this.txtPrenom);
JLabel lbMail = new JLabel(" E-mail :");
lbMail.setFont(new Font(lbMail.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMail); this.add(this.txtMail);
JLabel lbMdp = new JLabel(" Mot de passe :");
lbMdp.setFont(new Font(lbMdp.getText(), Font.CENTER_BASELINE, 18));
this.add(lbMdp); this.add(this.txtMdp);
JLabel lbSexe = new JLabel(" Sexe :");
lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
this.add(lbSexe); this.add(lbVide2);
jrH.setSelected(true);
bg.add(jrH); this.add(jrH);
bg.add(jrF); this.add(jrF);
JLabel lbAge = new JLabel(" <20>ge :");
lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
this.add(lbAge); this.add(this.txtAge);
JLabel lbGalop = new JLabel(" Galop :");
lbGalop.setFont(new Font(lbGalop.getText(), Font.CENTER_BASELINE, 18));
this.add(lbGalop); this.add(this.txtGalop);
this.add(lbVide3); this.add(lbVide4);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
JLabel lbinfo = new JLabel(" Les champs pr<70>c<EFBFBD>d<EFBFBD>s d'une * sont obligatoires ");
lbinfo.setFont(new Font(lbinfo.getText(), Font.CENTER_BASELINE, 12));
this.add(lbinfo);
}
@Override
public void actionPerformed(ActionEvent e) {
if(jrH.isSelected())
{
txtSexe = jrH.getText();
}
else if(jrF.isSelected())
{
txtSexe = jrF.getText();
}
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtLogin.setBackground(Color.WHITE);
this.txtNom.setBackground(Color.WHITE);
this.txtPrenom.setBackground(Color.WHITE);
this.txtMail.setBackground(Color.WHITE);
this.txtAge.setBackground(Color.WHITE);
this.txtGalop.setBackground(Color.WHITE);
this.txtMdp.setBackground(Color.WHITE);
this.txtAge.setText(null);
this.txtGalop.setText(null);
this.txtNom.setText(null);
this.txtPrenom.setText(null);
this.txtMail.setText(null);
jrH.setSelected(true);
this.txtLogin.setText(null);
this.txtMdp.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
String login = this.txtLogin.getText();
String nom = this.txtNom.getText();
String prenom = this.txtPrenom.getText();
String adressemail = this.txtMail.getText();
String sexe = this.txtSexe;
int age=Integer.parseInt(this.txtAge.getText());
int galop=Integer.parseInt(this.txtGalop.getText());
String mdp = (this.txtMdp.getText());
try{
if(login.equals(""))
{
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs obligatoire");
}
else
{
Formateur unFormateur = new Formateur(age, galop, nom, prenom, adressemail, sexe, login, mdp);
ModeleFormateur.update(unFormateur, login);
JOptionPane.showMessageDialog(this, "Modification reussie");
this.txtAge.setText(null);
this.txtGalop.setText(null);
this.txtNom.setText(null);
this.txtPrenom.setText(null);
this.txtMail.setText(null);
jrH.setSelected(true);
this.txtLogin.setText(null);
this.txtMdp.setText(null);
}
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtLogin.setBackground(Color.RED);
this.txtNom.setBackground(Color.RED);
this.txtPrenom.setBackground(Color.RED);
this.txtMail.setBackground(Color.RED);
this.txtAge.setBackground(Color.RED);
this.txtGalop.setBackground(Color.RED);
this.txtMdp.setBackground(Color.RED);
}
}
}
class StateListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
}
}
}

View File

@@ -0,0 +1,97 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import controleur.Formateur;
import modele.ModeleFormateur;
public class VueFormateursS extends JPanel implements ActionListener
{
private JTextField txtLogin = new JTextField();
private JButton btAnnuler = new JButton("Annuler");
private JButton btAjouter = new JButton("Supprimer");
public VueFormateursS()
{
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");JLabel lbVide5 = new JLabel("");
this.setBounds(150, 250, 700, 150);
this.setLayout(new GridLayout(5,2));
this.setBackground(new Color(230,230,230));
/*TITRE*/
JLabel titre = new JLabel("Supprimer un formateur");
titre.setFont(new Font(titre.getText(), Font.ROMAN_BASELINE + Font.BOLD, 25));
this.add(titre);
this.add(lbVide1); this.add(lbVide2); this.add(lbVide3);
JLabel lbLogin = new JLabel(" Login :");
lbLogin.setFont(new Font(lbLogin.getText(), Font.CENTER_BASELINE, 18));
this.add(lbLogin); this.add(this.txtLogin);
this.add(lbVide4); this.add(lbVide5);
this.add(this.btAnnuler);
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAnnuler.addActionListener(this);
this.add(this.btAjouter);
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
this.btAjouter.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
if(e.getSource()==this.btAnnuler)
{
this.txtLogin.setBackground(Color.WHITE);
this.txtLogin.setText(null);
}
else if (e.getSource()==this.btAjouter)
{
String login = this.txtLogin.getText();
try{
Formateur unFormateur = new Formateur(login);
ModeleFormateur.delete(login);
JOptionPane.showMessageDialog(this, "Suppression reussie de " + unFormateur.getLogin());
this.txtLogin.setText(null);
this.setVisible(true); // fin d'enregistrement
}
catch (NumberFormatException exp)
{
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
this.txtLogin.setBackground(Color.RED);
}
}
}
}

View File

@@ -0,0 +1,75 @@
package vue;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class VueInformation extends JPanel
{
public VueInformation()
{
/* FENETRE */
this.setBounds(50, 130, 900, 500);
this.setBackground(new Color(230,230,230));
this.setLayout(null);
/* TITRE */
JLabel lbAbout = new JLabel("A propos");
lbAbout.setFont(new Font(lbAbout.getText(),Font.ROMAN_BASELINE + Font.BOLD, 25));
lbAbout.setBounds(390, 20, 250, 40);
this.add(lbAbout);
/*TEXT LIEN*/
JLabel txtPC = new JLabel("Politique de confidentialit<69>");
txtPC.setFont(new Font(txtPC.getText(),Font.ROMAN_BASELINE, 20));
txtPC.setBounds(335, 210, 250, 30);
this.add(txtPC);
/*LIEN*/
JLabel txtlink = new JLabel("http://localhost:82/les_ecuries_de_la_boissiere/privacy_policy.php");
txtlink.setFont(new Font(txtlink.getText(),Font.ROMAN_BASELINE, 25));
txtlink.setForeground(new Color(230,230,230));
txtlink.setBounds(335, 210, 230, 30);
this.add(txtlink);
/* Clickable */
txtPC.setFocusable(false);
txtPC.setCursor(new Cursor(Cursor.HAND_CURSOR));
txtlink.setFocusable(false);
txtlink.setCursor(new Cursor(Cursor.HAND_CURSOR));
addListener(txtlink);
/*DESCRIPTION*/
JLabel txtLabel = new JLabel();
txtLabel.setText("Les Ecuries de la Boissi<73>re <20> 2017 Tous droits r<>serv<72>s");
txtLabel.setFont(new Font(txtLabel.getText(),Font.ROMAN_BASELINE + Font.BOLD, 20));
txtLabel.setBounds(180, 450, 550, 30);
this.add(txtLabel);
}
/* EVENT CLICKABLE */
private void addListener(JLabel txtlink) {
txtlink.addMouseListener(new MouseAdapter() {
//Click sur le lien
public void mouseClicked(MouseEvent e) {
JLabel label=(JLabel)e.getSource();
String plainText = label.getText().replaceAll("/<.*?/>", "");
try {
Desktop.getDesktop().browse(new URI(plainText));
} catch (URISyntaxException ex) {
Logger.getLogger(VueInformation.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(VueInformation.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
this.setVisible(true);
}
}

View File

@@ -0,0 +1,45 @@
package vue;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import controleur.Profil;
public class VueProfil extends JPanel {
public VueProfil(Profil unProfil)
{
this.setBounds(50, 130, 900, 500);
this.setBackground(new Color(230,230,230));
this.setLayout(null);
JLabel lbProfil = new JLabel("Votre Profil");
lbProfil.setBounds(90, 10, 150, 40);
lbProfil.setFont(new Font(lbProfil.getText(), Font.PLAIN + Font.BOLD, 18));
this.add(lbProfil);
JTextArea txtTitre = new JTextArea();
txtTitre.setBounds(20, 50, 280, 200);
//txtTitre.setBounds(x, y, width, height);
txtTitre.setEditable(false);
txtTitre.setBackground(Color.pink);
txtTitre.setFont(new Font(txtTitre.getText(), Font.PLAIN, 15));
// txtTitre.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
txtTitre.setText("\n ID : " + unProfil.getIdformateur()
+"\n Nom : " + unProfil.getNom()
+ "\n Pr<50>nom : " + unProfil.getPrenom()
+ "\n Mail : " + unProfil.getEmail()
+ "\n Sexe : " + unProfil.getSexe()
+ "\n Age : " + unProfil.getAge()
+ "\n Galop : " + unProfil.getGalop()
+ "\n privilege : " + unProfil.getPrivilege()
+ "\n login : " + unProfil.getLogin()
+ "\n Mot de passe : " + unProfil.getMdp());
this.add(txtTitre);
this.setVisible(true);
}
}