Skip to content

Commit 1153c0f

Browse files
author
BarbDev
committed
le plus dur c'est la fin
1 parent 754729e commit 1153c0f

15 files changed

+499
-536
lines changed

src/main/java/bdd/BaseDeDonnee.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,10 @@ public Connection getConnection() {
4545
return bdd;
4646
}
4747

48-
4948
public void createTable(Table t, String csv) {
5049
t.create(csv);
5150
}
5251

53-
/*
54-
public void addFromCSV(String path, String table) {
55-
try{
56-
Csv csv = new Csv();
57-
csv.setFieldSeparatorRead('|');
58-
csv.setCaseSensitiveColumnNames(true);
59-
ResultSet rs = csv.read(path, null, null);
60-
ResultSetMetaData meta = rs.getMetaData();
61-
while (rs.next()) {
62-
for (int i = 0; i < meta.getColumnCount(); i++) {
63-
System.out.println(
64-
meta.getColumnLabel(i + 1) + ": " +
65-
rs.getString(i + 1));
66-
}
67-
System.out.println();
68-
}
69-
rs.close();
70-
} catch (SQLException e) {
71-
e.printStackTrace();
72-
}
73-
} */
74-
7552
/**
7653
* Permet d'executer une action simple sur la BDD (sans paramètre ni retour)
7754
* @param action l'action au format SQL à effectuer
@@ -85,12 +62,4 @@ public void execute(String action) {
8562
e.printStackTrace();
8663
}
8764
}
88-
89-
static public void main(String[] args) {
90-
//baseDeDonnee.ajouter(new Film(1, "Mr Bean", 160, 7.8f, 20, new Date(Date.valueOf("1994-6-10").getTime()),
91-
// "drole", "Mr bean par en vacs :D", new String[]{"Le magnifique", "lul"}));
92-
93-
//for (Film f : baseDeDonnee.getFilms())
94-
// System.out.println(f);
95-
}
9665
}

src/main/java/core/UserInfo.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package core;
22

3+
import bdd.Film;
34
import bdd.Utilisateur;
45

6+
import java.util.ArrayList;
7+
58
public class UserInfo {
69
private static UserInfo ourInstance = new UserInfo();
710

@@ -11,6 +14,8 @@ public static UserInfo getInstance() {
1114

1215
private Utilisateur user = null;
1316

17+
private ArrayList<Film> panier = new ArrayList<>();
18+
1419
private UserInfo() {
1520
}
1621

@@ -26,4 +31,20 @@ public boolean isConnected() {
2631
return user != null;
2732
}
2833

34+
public void ajouterPanier(Film f) {
35+
if (!panier.contains(f))
36+
panier.add(f);
37+
}
38+
39+
public void enleverDuPanier(Film f) {
40+
panier.remove(f);
41+
}
42+
43+
public float getPrixPanier() {
44+
float prix = 0;
45+
for (Film f : panier)
46+
prix += f.getPrix();
47+
return prix;
48+
}
49+
2950
}

src/main/java/ihm/alza/Checkout/DetailPanier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public DetailPanier(Frame parent) {
2828
this.setVisible(true);
2929
}
3030

31-
public class PannPanier extends JPanel{
31+
public class PannPanier extends JPanel {
3232

3333
public PannPanier() {
3434
//Apres reflexion, je pense qu'il faut faire une JTable puisque c'est un retour de requete BDD non ?
Lines changed: 187 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,202 @@
11
package ihm.alza.InformationCompte;
22

3-
import java.awt.GridBagLayout;
3+
import ihm.alza.ModifCompte.ChangerMdp;
4+
import ihm.alza.PannAdmin.GestionAdmin;
45

5-
import javax.swing.JFrame;
6+
import java.awt.*;
7+
import java.awt.event.ActionEvent;
8+
import java.awt.event.ActionListener;
9+
10+
import javax.swing.*;
611

712
@SuppressWarnings("serial")
8-
public class InformationAdmin extends JFrame{
13+
public class InformationAdmin extends JDialog {
914

1015
private PannInfAd centre;
11-
public InformationAdmin() {
12-
centre = new PannInfAd(this);
16+
public InformationAdmin(Frame parent) {
17+
super(parent, "Informations", true);
18+
centre = new PannInfAd();
1319
this.setSize(750, 460);
1420
this.setTitle("Information de compte");
15-
this.setLocationRelativeTo(null);
21+
this.setLocationRelativeTo(parent);
1622
this.setLayout(new GridBagLayout());
1723

1824
this.setContentPane(centre);
19-
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
25+
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
2026
this.setVisible(true);
2127
}
22-
// public static void main(String[] args) {
23-
// InformationAdmin fen = new InformationAdmin();
24-
// }
28+
29+
public class PannInfAd extends JPanel{
30+
31+
private JTextField prenom;
32+
private JTextField nom ;
33+
private JTextField mail;
34+
35+
36+
public PannInfAd() {
37+
GridLayout g = new GridLayout(1,3);
38+
this.setLayout(g);
39+
40+
GridBagLayout gb = new GridBagLayout();
41+
JPanel p = new JPanel();
42+
p.setLayout(gb);
43+
44+
GridBagConstraints gbc = new GridBagConstraints();
45+
gbc.gridx = 0;
46+
gbc.gridy = 0;
47+
48+
JLabel mess = new JLabel("Information du compte ",JLabel.CENTER);
49+
mess.setFont(new Font("Serif", Font.BOLD, 30));
50+
JLabel info = new JLabel("Infos Personnels ", JLabel.CENTER);
51+
JLabel noml = new JLabel("Nom", JLabel.CENTER);
52+
JLabel prenoml = new JLabel("Prenom", JLabel.CENTER);
53+
JLabel maill = new JLabel("e-mail ", JLabel.CENTER);
54+
55+
nom = new JTextField(10);
56+
nom.setEditable(false);
57+
prenom = new JTextField(10);
58+
prenom.setEditable(false);
59+
mail = new JTextField(10);
60+
mail.setEditable(false);
61+
62+
63+
noml.setLabelFor(nom);
64+
prenoml.setLabelFor(prenom);
65+
maill.setLabelFor(mail);
66+
67+
68+
JButton modifinf = new JButton("Modifier infos");
69+
JButton modifmdp = new JButton ("Modifier mot de passe");
70+
71+
JButton bdd = new JButton("Gestion de la BDD");
72+
JButton retour = new JButton("Retour");
73+
74+
gbc.insets = new Insets(10, 10, 10,10);
75+
76+
gbc.gridx=0;
77+
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
78+
p.add(mess,gbc);
79+
80+
gbc.gridy=3;
81+
gbc.gridx = 0;
82+
83+
p.add(info, gbc);
84+
85+
gbc.gridx=0;
86+
gbc.gridy=4;
87+
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
88+
p.add(noml, gbc);
89+
gbc.anchor = GridBagConstraints.BASELINE;
90+
p.add(nom, gbc);
91+
92+
gbc.gridx = 0;
93+
gbc.gridy=5;
94+
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
95+
p.add(prenoml, gbc);
96+
gbc.anchor = GridBagConstraints.BASELINE;
97+
p.add(prenom,gbc);
98+
99+
gbc.gridx = 0;
100+
gbc.gridy=6;
101+
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
102+
p.add(maill, gbc);
103+
gbc.anchor = GridBagConstraints.BASELINE;
104+
p.add(mail,gbc);
105+
106+
107+
gbc.gridx = 0;
108+
gbc.gridy=7;
109+
p.add(modifinf, gbc);
110+
modifinf.addActionListener(new GestAcLis('I'));
111+
112+
gbc.gridy=8;
113+
p.add(modifmdp, gbc);
114+
modifmdp.addActionListener(new GestAcLis('M'));
115+
116+
this.add(p);
117+
118+
gbc.gridx = gbc.gridy = 0;
119+
p = new JPanel();
120+
p.setLayout(gb);
121+
122+
123+
gbc.gridy++;
124+
p.add(new JLabel(),gbc);
125+
gbc.gridy++;
126+
p.add(new JLabel(),gbc);
127+
gbc.gridy++;
128+
p.add(new JLabel(),gbc);
129+
gbc.gridy++;
130+
p.add(new JLabel(),gbc);
131+
gbc.gridy++;
132+
p.add(new JLabel(),gbc);
133+
gbc.gridy++;
134+
p.add(new JLabel(),gbc);
135+
gbc.gridy++;
136+
137+
gbc.gridwidth = GridBagConstraints.REMAINDER;
138+
p.add(bdd, gbc);
139+
bdd.addActionListener(new GestAcLis('B'));
140+
141+
p.add(new JLabel(),gbc);
142+
gbc.gridy++;
143+
p.add(new JLabel(),gbc);
144+
gbc.gridy++;
145+
p.add(new JLabel(),gbc);
146+
gbc.gridy++;
147+
p.add(new JLabel(),gbc);
148+
gbc.gridy++;
149+
p.add(new JLabel(),gbc);
150+
gbc.gridy++;
151+
p.add(new JLabel(),gbc);
152+
gbc.gridy++;
153+
154+
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
155+
p.add(retour,gbc);
156+
retour.addActionListener(new GestAcLis('R')); //inutile en soit, peut etre regrouper
157+
158+
this.add(p);
159+
160+
}
161+
162+
class GestAcLis implements ActionListener {
163+
164+
private char c;
165+
166+
public GestAcLis(char c) {
167+
this.c=c;
168+
}
169+
170+
@Override
171+
public void actionPerformed(ActionEvent e) {
172+
if (c=='I' ) {//Modif Info
173+
//Alors ca ne marche pas donc je vais faire une autre fenetre ^^'
174+
new ModifInfAd(null, InformationAdmin.this);
175+
176+
// modifinf = new JButton("Valider Modifications");
177+
// nom.setEditable(true);
178+
// prenom.setEditable(true);
179+
// mail.setEditable(true);
180+
// modifinf.addActionListener(new GestAcLis('V'));
181+
}
182+
// if(c=='V') {
183+
// modifinf = new JButton("Modifications Informations");
184+
// nom.setEditable(false);
185+
// prenom.setEditable(false);
186+
// mail.setEditable(false);
187+
// modifinf.addActionListener(new GestAcLis('I'));
188+
// }
189+
190+
if (c=='M' )//Modif Mdp
191+
new ChangerMdp(null,'A');
192+
if (c=='B')
193+
new GestionAdmin();
194+
if (c=='R')
195+
dispose();
196+
}
197+
198+
}
199+
200+
}
201+
25202
}

src/main/java/ihm/alza/InformationCompte/InformationClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public void actionPerformed(ActionEvent e) {
205205
new ModifInfCl(null, InformationClient.this);
206206
}
207207
if (c=='M' )//Modif Mdp
208-
new ChangerMdp('C');
208+
new ChangerMdp(null,'C');
209209
if (c=='S' )//Supprimer
210210
new SuppressionCompte();
211211
if (c=='R' ) {

0 commit comments

Comments
 (0)