Skip to content

Commit

Permalink
Merge pull request #8 from Iuzziel/prototype
Browse files Browse the repository at this point in the history
Prototype
  • Loading branch information
Iuzziel authored Aug 22, 2017
2 parents c9a63fc + b83f01c commit 616d167
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 103 deletions.
13 changes: 7 additions & 6 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,6 +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"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="U:/dl101/Exercices/Eclipse/Workspace/JAR/ojdbc6.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
4 changes: 2 additions & 2 deletions src/application/Principale.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class Principale {
//Donnees static de l'application
public static FenetreClient fenetrePrincipale;
public static FenetrePrincipale fenetrePrincipale;

//*********************************Début de la Main*********************************//
public static void main (String [] args){
Expand All @@ -17,7 +17,7 @@ public static void main (String [] args){
}catch(Exception e) {
System.out.println("echec du chargement lookAndFeel systeme");
}
fenetrePrincipale = new FenetreClient();
fenetrePrincipale = new FenetrePrincipale();

//recuperation de la resolution de la taille de l'affichage
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Expand Down
77 changes: 0 additions & 77 deletions src/fenetres/FenetreClient.java

This file was deleted.

21 changes: 6 additions & 15 deletions src/fenetres/FenetreConnexion.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package fenetres;

import application.Principale;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import javax.swing.JLabel;
Expand Down Expand Up @@ -30,7 +29,7 @@ public class FenetreConnexion extends JFrame {
private JPasswordField pwdFieldConnexion;
private JButton btnConnexionValider = new JButton("Valider");
private JButton btnConnexionAnnuler = new JButton("Annuler");
private boolean estConnecte = false;
private static boolean estConnecte = false;

// Constructeur de la fenetre
public FenetreConnexion() {
Expand Down Expand Up @@ -92,19 +91,11 @@ public FenetreConnexion() {
private void connexion(String login, String password) {
if(login.equals("root") && password.equals("toor")) {
this.setVisible(false);
Principale.fenetrePrincipale.remove(FenetreClient.partieVisiteur);
FenetreClient.setPartieEmploye(new PartieEmploye());
Principale.fenetrePrincipale.add(FenetreClient.partieEmploye);
Principale.fenetrePrincipale.validate();
Principale.fenetrePrincipale.repaint();
setEstConnecte(true);
FenetrePrincipale.changerPartieClient();
}else{
Principale.fenetrePrincipale.remove(FenetreClient.partieEmploye);
Principale.fenetrePrincipale.add(FenetreClient.partieVisiteur);
Principale.fenetrePrincipale.validate();
Principale.fenetrePrincipale.repaint();
JOptionPane.showMessageDialog(this, "Mauvais identifiants");
setEstConnecte(false);
JOptionPane.showMessageDialog(this, "Mauvais identifiants");
}
return;
}
Expand Down Expand Up @@ -140,11 +131,11 @@ public void setPwdFieldConnexion(JPasswordField pwdFieldConnexion) {
this.pwdFieldConnexion = pwdFieldConnexion;
}

public boolean isEstConnecte() {
public static boolean isEstConnecte() {
return estConnecte;
}
public void setEstConnecte(boolean estConnecte) {
this.estConnecte = estConnecte;
public static void setEstConnecte(boolean estConnecte) {
FenetreConnexion.estConnecte = estConnecte;
}

}
64 changes: 64 additions & 0 deletions src/fenetres/FenetrePrincipale.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package fenetres;

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;

public final class FenetrePrincipale extends JFrame {
/**
*
*/
private static final long serialVersionUID = -629171735000729382L;

//Donnees membres
public static PartieVisiteur partieVisiteur;
public static PartieEmploye partieEmploye;
public static JPanel contentPane;

// Constructeur de la fenetre
public FenetrePrincipale() {
contentPane = (JPanel) this.getContentPane();
contentPane.setMinimumSize(new Dimension(800, 600));
contentPane.setLayout(new BorderLayout(5, 5));
contentPane.setVisible(true);

//Par defaut l'application s'ouvrre sur la partie visiteur
partieVisiteur = new PartieVisiteur();

contentPane.add(partieVisiteur, BorderLayout.CENTER);
System.out.println("Constructeur atteint : Fenetre client");
}

//Accesseurs
public static PartieVisiteur getPartieVisiteur() {
return partieVisiteur;
}

public static void setPartieVisiteur(PartieVisiteur partieVisiteur) {
FenetrePrincipale.partieVisiteur = partieVisiteur;
}

public static PartieEmploye getPartieEmploye() {
return partieEmploye;
}

public static void setPartieEmploye(PartieEmploye partieEmploye) {
FenetrePrincipale.partieEmploye = partieEmploye;
}

public static void changerPartieClient() {
if(FenetreConnexion.isEstConnecte()) {
FenetrePrincipale.contentPane.remove(FenetrePrincipale.partieVisiteur);
FenetrePrincipale.setPartieEmploye(new PartieEmploye());
FenetrePrincipale.contentPane.add(FenetrePrincipale.partieEmploye);
FenetrePrincipale.contentPane.validate();
FenetrePrincipale.contentPane.repaint();
}else{
FenetrePrincipale.contentPane.remove(FenetrePrincipale.partieEmploye);
FenetrePrincipale.contentPane.add(FenetrePrincipale.partieVisiteur);
FenetrePrincipale.contentPane.validate();
FenetrePrincipale.contentPane.repaint();
}
}
}
6 changes: 3 additions & 3 deletions src/panneaux/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javax.swing.JLabel;
import javax.swing.border.TitledBorder;

import fenetres.FenetreClient;
import fenetres.FenetrePrincipale;
import fenetres.FenetreConnexion;
import java.awt.Color;
import java.awt.Font;
Expand Down Expand Up @@ -108,8 +108,8 @@ public void mouseClicked(MouseEvent e) {
fenetreConnexion.setAlwaysOnTop(true);
}
if (e.getSource() == lblHeaderSeConnecter && lblHeaderSeConnecter.getText().equals("Se deconnecter")) {
FenetreClient.changerPartieClient();
fenetreConnexion.setEstConnecte(false);
FenetreConnexion.setEstConnecte(false);
FenetrePrincipale.changerPartieClient();
}
}

Expand Down

0 comments on commit 616d167

Please sign in to comment.