View Javadoc

1   /*
2    * This file is part of NetPisteur.
3    * 
4    * Copyright 2001-2002 : Olivier CORNEC, David BOUANCHEAU, Loic LOPEZ,
5    *                       Gaetan BOUDARD, Mael LE LANNOU, Julien ROBINEAU
6    * 
7    * Copyright 2002-2003 : Olivier BRIENS, Simon DEZE, Florence FRIGOULT,
8    *                       Olivier JOURNEAULT, Francois MARTINIER, Damien RAUDE-MORVAN
9    * 
10   * Copyright 2004-2007 : Damien RAUDE-MORVAN
11   * 
12   * NetPisteur is free software; you can redistribute it and/or modify it under
13   * the terms of the GNU General Public License as published by the Free Software
14   * Foundation; either version 2 of the License, or (at your option) any later
15   * version.
16   * 
17   * NetPisteur is distributed in the hope that it will be useful, but WITHOUT ANY
18   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19   * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU General Public License along with
22   * NetPisteur; if not, write to the Free Software Foundation, Inc., 59 Temple
23   * Place, Suite 330, Boston, MA 02110-1301 USA
24   *  
25   */
26  package com.drazzib.netpisteur.ui;
27  
28  import java.awt.BorderLayout;
29  import java.awt.Font;
30  import java.awt.GridLayout;
31  import java.awt.event.ItemEvent;
32  import java.awt.event.ItemListener;
33  import java.awt.event.MouseAdapter;
34  import java.awt.event.MouseEvent;
35  import java.awt.event.WindowAdapter;
36  import java.awt.event.WindowEvent;
37  
38  import javax.swing.JButton;
39  import javax.swing.JCheckBox;
40  import javax.swing.JFrame;
41  import javax.swing.JLabel;
42  import javax.swing.JMenu;
43  import javax.swing.JMenuBar;
44  import javax.swing.JMenuItem;
45  import javax.swing.JOptionPane;
46  import javax.swing.JPanel;
47  import javax.swing.JPasswordField;
48  import javax.swing.JTextField;
49  import javax.swing.SwingConstants;
50  
51  import org.apache.commons.logging.Log;
52  import org.apache.commons.logging.LogFactory;
53  
54  import com.drazzib.netpisteur.configuration.Cobaye;
55  import com.drazzib.netpisteur.configuration.Configuration;
56  import com.drazzib.netpisteur.configuration.ListUtilisateurs;
57  import com.drazzib.netpisteur.configuration.Utilisateur;
58  import com.drazzib.netpisteur.util.Messages;
59  
60  public class ConfigFrame extends JFrame {
61  	
62  	private static Log log = LogFactory.getLog(ConfigFrame.class);
63  
64  	private static final long serialVersionUID = -513902715037672612L;
65  
66  	private JMenuBar menuBar;
67  
68  	private JMenu fichierMenu, aideMenu;
69  
70  	private JMenuItem quitterMenuItem, aProposMenuItem, manuelMenuItem;
71  
72  	private JPanel panelEst, panelOuest, panelSud, panelCentre, formulaire,
73  			saisieTps, changeMotP;
74  
75  	private JTextField nomTextField, saisieHeure, saisieMin, saisieSec,
76  			prenomTextField, refTextField;
77  
78  	private JLabel prenomLabel, refLabel, motDePLabel, sousMotDePLabel,
79  			choixParam, chronoONTestLabel, dureeTestLabel, nveauTeLabel,
80  			nomLabel, remplir;
81  
82  	private JPasswordField jPasswordField4;
83  
84  	private JButton ok, annuler, changeButton, option, creation;
85  
86  	private JCheckBox positionSourisClickCheckBox, mvtiSourisCheckBox,
87  			historiquePagesCheckBox, listeLiensCheckBox, activeChronoCheckBox;
88  
89  	// Cobaye
90  	private static Cobaye leCobaye;
91  
92  	// Utilisateur de la session
93  	private static Utilisateur lUtilisateur;
94  
95  	// Variable used for the validation of the timer
96  	private static int dureeH;
97  
98  	private static int dureeMin;
99  
100 	private static int dureeSec;
101 
102 	// //////////////////////////////
103 	// constructor
104 
105 	/** Creates new form Config */
106 	public ConfigFrame() {
107 		initComponents();
108 	}
109 
110 	// //////////////////////////////
111 	// operations
112 
113 	private void initComponents() {
114 
115 		this.menuBar = new JMenuBar();
116 		this.fichierMenu = new JMenu();
117 		this.quitterMenuItem = new JMenuItem();
118 		this.aideMenu = new JMenu();
119 		this.aProposMenuItem = new JMenuItem();
120 		this.manuelMenuItem = new JMenuItem();
121 		this.panelEst = new JPanel();
122 		this.panelOuest = new JPanel();
123 		this.panelSud = new JPanel();
124 		this.panelCentre = new JPanel();
125 		this.changeMotP = new JPanel();
126 		this.changeButton = new JButton(Messages.getString("Config.CHANGE")); //$NON-NLS-1$
127 		this.formulaire = new JPanel();
128 		this.nveauTeLabel = new JLabel();
129 		this.nomLabel = new JLabel();
130 		this.nomTextField = new JTextField();
131 		this.prenomLabel = new JLabel();
132 		this.prenomTextField = new JTextField();
133 		this.refLabel = new JLabel();
134 		this.refTextField = new JTextField();
135 		this.motDePLabel = new JLabel();
136 		this.jPasswordField4 = new JPasswordField();
137 		this.sousMotDePLabel = new JLabel();
138 		this.ok = new JButton();
139 		this.annuler = new JButton();
140 		this.option = new JButton();
141 		this.creation = new JButton();
142 		this.choixParam = new JLabel();
143 		this.positionSourisClickCheckBox = new JCheckBox();
144 		this.mvtiSourisCheckBox = new JCheckBox();
145 		this.historiquePagesCheckBox = new JCheckBox();
146 		this.listeLiensCheckBox = new JCheckBox();
147 		this.chronoONTestLabel = new JLabel();
148 		this.remplir = new JLabel();
149 		this.activeChronoCheckBox = new JCheckBox();
150 		this.dureeTestLabel = new JLabel();
151 		this.saisieTps = new JPanel();
152 		this.saisieHeure = new JTextField();
153 		this.saisieMin = new JTextField();
154 		this.saisieSec = new JTextField();
155 		this.fichierMenu.setText(Messages.getString("Config.FILE")); //$NON-NLS-1$
156 		// fichierMenu.setName("fichierMenu"); //$NON-NLS-1$
157 		this.quitterMenuItem.setText(Messages.getString("Config.QUIT")); //$NON-NLS-1$
158 		// quitterMenuItem.setName("quitterMenuItem"); //$NON-NLS-1$
159 		this.fichierMenu.add(this.quitterMenuItem);
160 		this.menuBar.add(this.fichierMenu);
161 		this.aideMenu.setText(Messages.getString("Config.HELP")); //$NON-NLS-1$
162 		// aideMenu.setName("aideMenu"); //$NON-NLS-1$
163 		this.aProposMenuItem.setText(Messages.getString("Config.ABOUT")); //$NON-NLS-1$
164 		// aProposMenuItem.setName("aProposMenuItem"); //$NON-NLS-1$
165 		this.aideMenu.add(this.aProposMenuItem);
166 		this.manuelMenuItem.setText(Messages.getString("Config.USER_HELP")); //$NON-NLS-1$
167 		// manuelMenuItem.setName("manuelMenuItem"); //$NON-NLS-1$
168 		this.aideMenu.add(this.manuelMenuItem);
169 		this.menuBar.add(this.aideMenu);
170 
171 		addWindowListener(new WindowAdapter() {
172 			public void windowClosing(WindowEvent evt) {
173 				exitForm(evt);
174 			}
175 		});
176 
177 		getContentPane().add(this.panelEst, BorderLayout.NORTH);
178 		getContentPane().add(this.panelEst, BorderLayout.EAST);
179 		getContentPane().add(this.panelOuest, BorderLayout.WEST);
180 		getContentPane().add(this.panelSud, BorderLayout.SOUTH);
181 
182 		this.formulaire.setLayout(new GridLayout(20, 2));
183 
184 		//this.formulaire.setMaximumSize(new Dimension(400, 400));
185 
186 		// Fonts creation
187 		Font titre = new Font("Arial", Font.BOLD, 15); //$NON-NLS-1$
188 		Font petit = new Font("Arial", Font.ITALIC, 9); //$NON-NLS-1$
189 
190 		this.nveauTeLabel.setText(Messages.getString("Config.IDENT_TESTER")); //$NON-NLS-1$
191 		this.nveauTeLabel.setFont(titre);
192 		// nveauTeLabel.setName("nveauTeLabel"); //$NON-NLS-1$
193 		this.formulaire.add(this.nveauTeLabel);
194 
195 		this.formulaire.add(new JLabel());
196 
197 		this.nomLabel.setText(Messages.getString("Config.NAME")); //$NON-NLS-1$
198 		// nomLabel.setName("nomLabel"); //$NON-NLS-1$
199 		this.formulaire.add(this.nomLabel);
200 
201 		this.nomTextField.setName("nomTextField"); //$NON-NLS-1$
202 		this.formulaire.add(this.nomTextField);
203 
204 		this.prenomLabel.setText(Messages.getString("Config.FIRST_NAME")); //$NON-NLS-1$
205 		// prenomLabel.setName("prenomLabel"); //$NON-NLS-1$
206 		this.formulaire.add(this.prenomLabel);
207 
208 		this.prenomTextField.setName("prenomTextField"); //$NON-NLS-1$
209 		this.formulaire.add(this.prenomTextField);
210 
211 		this.refLabel.setText(Messages.getString("Config.REF_COBAYE")); //$NON-NLS-1$
212 		// refLabel.setName("refLabel"); //$NON-NLS-1$
213 		this.formulaire.add(this.refLabel);
214 		// refTextField.setName("refTextField"); //$NON-NLS-1$
215 		this.formulaire.add(this.refTextField);
216 
217 		this.motDePLabel.setText(Messages.getString("Config.TESTER_PASSWORD")); //$NON-NLS-1$
218 		// motDePLabel.setName("motDePLabel"); //$NON-NLS-1$
219 		this.formulaire.add(this.motDePLabel);
220 
221 		this.changeMotP.setLayout(new GridLayout(1, 2));
222 		this.changeButton.addMouseListener(new MouseAdapter() {
223 			public void mouseReleased(MouseEvent evt) {
224 				nouveauPasswordMouseReleased(evt);
225 			}
226 		});
227 		this.changeMotP.add(this.jPasswordField4);
228 		this.changeMotP.add(this.changeButton);
229 		this.formulaire.add(this.changeMotP);
230 		// sousMotDePLabel.setName("sousMotDePLabel"); //$NON-NLS-1$
231 		this.formulaire.add(this.sousMotDePLabel);
232 		this.creation.setText(Messages.getString("Config.TESTER_CREATE")); //$NON-NLS-1$
233 		// creation.setName("create"); //$NON-NLS-1$
234 		this.creation.addMouseListener(new MouseAdapter() {
235 			public void mouseClicked(MouseEvent evt) {
236 				creationMouseReleased(evt);
237 			}
238 		});
239 		this.formulaire.add(this.creation);
240 
241 		// Timer
242 		JLabel titreDuree = new JLabel(Messages.getString("Config.LENGTH")); //$NON-NLS-1$
243 		titreDuree.setFont(titre);
244 		this.formulaire.add(titreDuree);
245 		this.formulaire.add(new JLabel());
246 		this.chronoONTestLabel.setText(Messages
247 				.getString("Config.CHRONO_LENGTH")); //$NON-NLS-1$
248 		// chronoONTestLabel.setName("progTestLabel"); //$NON-NLS-1$
249 		this.formulaire.add(this.chronoONTestLabel);
250 
251 		if (Configuration.getHandle().isTimerActif()) {
252 			this.activeChronoCheckBox.setSelected(true);
253 		} else {
254 			this.activeChronoCheckBox.setSelected(false);
255 		}
256 		this.activeChronoCheckBox.setHorizontalAlignment(SwingConstants.CENTER);
257 		this.activeChronoCheckBox.addItemListener(new ItemListener() {
258 			public void itemStateChanged(ItemEvent e) {
259 				activeChrono(e);
260 			}
261 		});
262 
263 		this.formulaire.add(this.activeChronoCheckBox);
264 
265 		this.dureeTestLabel.setText(Messages.getString("Config.TEST_LENGTH")); //$NON-NLS-1$
266 		// dureeTestLabel.setName("chronoLabel"); //$NON-NLS-1$
267 		this.formulaire.add(this.dureeTestLabel);
268 
269 		this.saisieHeure.setColumns(2);
270 		this.saisieMin.setColumns(2);
271 		this.saisieSec.setColumns(2);
272 		this.saisieTps.add(this.saisieHeure);
273 		this.saisieTps.add(this.saisieMin);
274 		this.saisieTps.add(this.saisieSec);
275 		this.saisieHeure.setEditable(false);
276 		this.saisieMin.setEditable(false);
277 		this.saisieSec.setEditable(false);
278 		this.formulaire.add(this.saisieTps);
279 		this.formulaire.add(new JLabel());
280 		this.formulaire.add(new JLabel());
281 		// End timer
282 
283 		// Parameters
284 		JLabel titrePara = new JLabel(Messages.getString("Config.PARAM")); //$NON-NLS-1$
285 		titrePara.setFont(titre);
286 		this.formulaire.add(titrePara);
287 		this.formulaire.add(new JLabel());
288 
289 		this.choixParam.setText(Messages.getString("Config.CHOICE_PARAMS")); //$NON-NLS-1$
290 		this.formulaire.add(this.choixParam);
291 
292 		this.formulaire.add(new JLabel());
293 		this.formulaire.add(new JLabel());
294 
295 		// Mouse click position
296 		this.positionSourisClickCheckBox.setText(Messages
297 				.getString("Config.CLICK_POSITION")); //$NON-NLS-1$
298 		this.positionSourisClickCheckBox.setSelected(Configuration.getHandle().isMesureClick());
299 		// positionSourisClickCheckBox.setName("nbClics"); //$NON-NLS-1$
300 		// listener of the CheckBox mouse click
301 		this.positionSourisClickCheckBox.addItemListener(new ItemListener() {
302 			public void itemStateChanged(ItemEvent e) {
303 				treatClickCheckBox(e);
304 			}
305 		});
306 		this.formulaire.add(this.positionSourisClickCheckBox);
307 		// End click mouse
308 		this.formulaire.add(new JLabel());
309 
310 		// Movement mouse
311 		this.mvtiSourisCheckBox.setText(Messages
312 				.getString("Config.MOUSE_MOUVEMENT")); //$NON-NLS-1$
313 		this.mvtiSourisCheckBox.setSelected(Configuration.getHandle().isMesurePlacement());
314 		// mvtiSourisCheckBox.setName("posiSouris"); //$NON-NLS-1$
315 		this.mvtiSourisCheckBox.addItemListener(new ItemListener() {
316 			public void itemStateChanged(ItemEvent e) {
317 				treatPlacementCheckBox(e);
318 			}
319 		});
320 		this.formulaire.add(this.mvtiSourisCheckBox);
321 		// end movement mouse
322 		this.formulaire.add(new JLabel());
323 
324 		// Visited pages
325 		this.historiquePagesCheckBox.setText(Messages
326 				.getString("Config.HISTORY")); //$NON-NLS-1$
327 		this.historiquePagesCheckBox.setSelected(Configuration.getHandle().isMesureURL());
328 		// historiquePagesCheckBox.setName("histPages"); //$NON-NLS-1$
329 		this.historiquePagesCheckBox.addItemListener(new ItemListener() {
330 			public void itemStateChanged(ItemEvent e) {
331 				treatUrlCheckBox(e);
332 			}
333 		});
334 
335 		this.formulaire.add(this.historiquePagesCheckBox);
336 		// end visited pages
337 		this.formulaire.add(new JLabel());
338 
339 		// Link activated
340 		this.listeLiensCheckBox.setText(Messages
341 				.getString("Config.HISTORY_LINKS")); //$NON-NLS-1$
342 		this.listeLiensCheckBox.setSelected(Configuration.getHandle().isMesureHL());
343 		// listeLiensCheckBox.setName("histLiens"); //$NON-NLS-1$
344 		this.listeLiensCheckBox.addItemListener(new ItemListener() {
345 			public void itemStateChanged(ItemEvent e) {
346 				treatHlCheckBox(e);
347 			}
348 		});
349 
350 		this.formulaire.add(this.listeLiensCheckBox);
351 		// end link activated
352 		this.formulaire.add(new JLabel());
353 		this.formulaire.add(new JLabel());
354 
355 		this.formulaire.add(new JLabel());
356 
357 		this.option.setText(Messages.getString("Config.ADVANCED_OPTION")); //$NON-NLS-1$
358 		// option.setName("options"); //$NON-NLS-1$
359 		this.option.addMouseListener(new MouseAdapter() {
360 			public void mouseClicked(MouseEvent evt) {
361 				optionMouseReleased(evt);
362 			}
363 		});
364 		this.formulaire.add(this.option);
365 		this.formulaire.add(new JLabel());
366 
367 		this.remplir.setText(Messages.getString("Config.IDENT_FIELD")); //$NON-NLS-1$
368 		this.remplir.setFont(petit);
369 		this.formulaire.add(this.remplir);
370 
371 		this.ok.setText(Messages.getString("Config.OK")); //$NON-NLS-1$
372 		// ok.setName("ok"); //$NON-NLS-1$
373 		this.ok.addMouseListener(new MouseAdapter() {
374 			public void mouseClicked(MouseEvent evt) {
375 				okMouseReleased(evt);
376 			}
377 		});
378 		this.formulaire.add(this.ok);
379 
380 		this.annuler.setText(Messages.getString("Config.CANCEL")); //$NON-NLS-1$
381 		// annuler.setName("annuler"); //$NON-NLS-1$
382 		this.annuler.addMouseListener(new MouseAdapter() {
383 			public void mouseReleased(MouseEvent evt) {
384 				annulerMouseReleased(evt);
385 			}
386 		});
387 		this.formulaire.add(this.annuler);
388 
389 		this.panelCentre.add(this.formulaire);
390 		getContentPane().add(this.panelCentre, BorderLayout.CENTER);
391 
392 		//this.setLocationRelativeTo(null);
393 		setTitle(Messages.getString("Config.FORM_TITLE")); //$NON-NLS-1$
394 		this.setSize(540,800);
395 		this.setResizable(false);
396 
397 	} // initComponents()
398 
399 	/**
400 	 * Check the timer
401 	 */
402 	private boolean checkTimer() {
403 
404 		boolean bok = true;
405 
406 		if (Configuration.getHandle().isTimerActif()) {
407 			try {
408 				if (this.saisieHeure.getText().equals("")) { //$NON-NLS-1$
409 					dureeH = 0;
410 				} else {
411 					dureeH = Integer.parseInt(this.saisieHeure.getText());
412 				}// fin des tests de la validit des heures
413 
414 				if (this.saisieMin.getText().equals("")) { //$NON-NLS-1$
415 					dureeMin = 0;
416 				} else {
417 					dureeMin = Integer.parseInt(this.saisieMin.getText());
418 				}// fin des tests de la validit des minutes
419 
420 				if (this.saisieSec.getText().equals("")) { //$NON-NLS-1$
421 					dureeSec = 0;
422 				} else {
423 					dureeSec = Integer.parseInt(this.saisieSec.getText());
424 				}// fin des tests des secondes
425 
426 				if ((dureeH == 0 && dureeMin == 0 && dureeSec == 0)
427 						|| (dureeH < 0 || dureeH > 24)
428 						|| (dureeMin < 0 || dureeMin > 59)
429 						|| (dureeSec < 0 || dureeSec > 59)) {
430 					bok = false;
431 				}// if
432 
433 			}// try
434 			catch (java.lang.NumberFormatException e) {
435 				bok = false;
436 			}
437 		}// if
438 		return bok;
439 
440 	} // tempsOkBout()
441 
442 	/**
443 	 * Save the time in differents variable of configuration
444 	 */
445 	private void saveTimer() {
446 		if (Configuration.getHandle().isTimerActif()) {
447 			Configuration.getHandle().setTimerHeure(dureeH);
448 			Configuration.getHandle().setTimerMinute(dureeMin);
449 			Configuration.getHandle().setTimerSeconde(dureeSec);
450 
451 		}// if
452 	}// sauveHorloge
453 
454 	/**
455 	 * Check if the user exits
456 	 */
457 	private boolean checkUser() {
458 
459 		String refCobaye;
460 		String nomUtilisateur;
461 		String prenomUtilisateur;
462 		String motDePasseSaisie;
463 
464 		refCobaye = this.refTextField.getText();
465 		nomUtilisateur = this.nomTextField.getText();
466 		prenomUtilisateur = this.prenomTextField.getText();
467 
468 		motDePasseSaisie = new String(this.jPasswordField4.getPassword());
469 
470 		lUtilisateur = new Utilisateur(nomUtilisateur, prenomUtilisateur,
471 				motDePasseSaisie, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
472 		leCobaye = new Cobaye(refCobaye);
473 
474 		// chargement des utilisateurs
475 		ListUtilisateurs.readUtilisateurInfoFromDisk();
476 
477 		return (ListUtilisateurs.isIn(lUtilisateur));
478 
479 	} // verifUtilisateur()
480 
481 	/**
482 	 * Save the user parameters in differents variable of configuration
483 	 */
484 	private void saveUser() {
485 
486 		Configuration.getHandle().setRootNom(lUtilisateur.getNom());
487 		Configuration.getHandle().setRootPrenom(lUtilisateur.getPrenom());
488 		Configuration.getHandle().setRootPassword(lUtilisateur.getMotDePasse());
489 		Configuration.getHandle().setRootSeparator(
490 				lUtilisateur.getSeparateur());
491 		Configuration.getHandle().setRootPage(
492 				lUtilisateur.getPage());
493 		Configuration.getHandle().setCobayeName(leCobaye.getReference());
494 	}// sauveUtilisateur
495 
496 	/**
497 	 * Open a new frame which allows to change a password
498 	 * 
499 	 * @param MouseEvent
500 	 *            evt
501 	 */
502 	void nouveauPasswordMouseReleased(MouseEvent evt) {
503 		boolean motdepasseOk = checkUser();
504 
505 		if (motdepasseOk == true) {
506 
507 			saveUser();
508 			ChangePassword nouveauMot = new ChangePassword(lUtilisateur, this);
509 			nouveauMot.setLocationRelativeTo(null);
510 			nouveauMot.setVisible(true);
511 
512 		} else {
513 			JOptionPane
514 					.showMessageDialog(
515 							null,
516 							Messages.getString("Config.BAD_PASSWORD"), Messages.getString("Config.ERROR"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$ //$NON-NLS-2$
517 		}
518 
519 	} // nouveauPasswordMouseReleased()
520 
521 	/**
522 	 * Print the name and the first name of the user on the frame when a new
523 	 * user is created
524 	 * 
525 	 * @param nom
526 	 *            the name of the user
527 	 * @param prenom
528 	 *            the first name of the user
529 	 */
530 	public void setFields(String nom, String prenom) {
531 		this.nomTextField.setText(nom);
532 		this.prenomTextField.setText(prenom);
533 		this.jPasswordField4.setText(""); //$NON-NLS-1$
534 		this.refTextField.setText(""); //$NON-NLS-1$
535 	} // setFields()
536 
537 	/**
538 	 * Print the name, the first name and the password of the user on the frame
539 	 * when the password is changed.
540 	 * 
541 	 * This method use the method setFields(String, String)
542 	 * 
543 	 * @param nom
544 	 *            the name of the user
545 	 * @param prenom
546 	 *            the first name of the user
547 	 * @param motDePasse
548 	 *            the password of the user
549 	 */
550 	public void setAllFields(String nom, String prenom, String motDePasse) {
551 		this.nomTextField.setText(nom);
552 		this.prenomTextField.setText(prenom);
553 		this.jPasswordField4.setText(motDePasse);
554 		this.refTextField.setText(""); //$NON-NLS-1$
555 	} // setFields()
556 
557 	/**
558 	 * Search if the option "Historique des pages visites" is activated
559 	 * 
560 	 * @param ItemEvent
561 	 *            evt
562 	 */
563 	void treatHlCheckBox(java.awt.event.ItemEvent evt) {
564 		if (evt.getStateChange() == ItemEvent.SELECTED) {
565 			Configuration.getHandle().setMesureHL(true);
566 		} else {
567 			Configuration.getHandle().setMesureHL(false);
568 		}
569 	} // HlCheckBox()
570 
571 	/**
572 	 * Search if the option "Liste des liens activs" is activated
573 	 * 
574 	 * @param ItemEvent
575 	 *            evt
576 	 */
577 	void treatUrlCheckBox(ItemEvent evt) {
578 		if (evt.getStateChange() == ItemEvent.SELECTED) {
579 			Configuration.getHandle().setMesureURL(true);
580 		} else {
581 			Configuration.getHandle().setMesureURL(false);
582 		}
583 	} // UrlCheckBox()
584 
585 	/**
586 	 * Search if the option "Positions des clics de souris" is activated
587 	 * 
588 	 * @param ItemEvent
589 	 *            evt
590 	 */
591 	void treatClickCheckBox(ItemEvent evt) {
592 		if (evt.getStateChange() == ItemEvent.SELECTED) {
593 			Configuration.getHandle().setMesureClick(true);
594 		} else {
595 			Configuration.getHandle().setMesureClick(false);
596 		}
597 	} // ClickCheckBox()
598 
599 	/**
600 	 * Search if the option "Mouvement de la souris" is activated
601 	 * 
602 	 * @param ItemEvent
603 	 *            evt
604 	 */
605 	void treatPlacementCheckBox(ItemEvent evt) {
606 		if (evt.getStateChange() == ItemEvent.SELECTED) {
607 			Configuration.getHandle().setMesurePlacement(true);
608 		} else {
609 			Configuration.getHandle().setMesurePlacement(false);
610 		}
611 	} // PlacementCheckBox()
612 
613 	/**
614 	 * Exit the application when the user click on "Annuler"
615 	 * 
616 	 * @param MouseEvent
617 	 *            evt
618 	 */
619 	void annulerMouseReleased(MouseEvent evt) {
620 		System.exit(0);
621 	} // annulerMouseReleased()
622 
623 	/**
624 	 * Open the option frame
625 	 * 
626 	 * To open this frame, the user and the timer must be good
627 	 * 
628 	 * @param MouseEvent
629 	 *            evt
630 	 */
631 	void optionMouseReleased(MouseEvent evt) {
632 
633 		boolean motdepasseOk = checkUser();
634 		
635 		if (motdepasseOk == true) {
636 
637 			saveUser();
638 			AdvancedOptionsFrame optionAv = new AdvancedOptionsFrame(
639 					lUtilisateur);
640 			optionAv.setLocationRelativeTo(null);
641 			optionAv.setVisible(true);
642 
643 		} else {
644 			JOptionPane
645 					.showMessageDialog(
646 							null,
647 							Messages.getString("Config.BAD_PASSWORD"), Messages.getString("Config.ERROR"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$ //$NON-NLS-2$
648 		}
649 	} // optionMouseReleased()
650 
651 	void creationMouseReleased(MouseEvent evt) {
652 		CreateTestorFrame creatTest = new CreateTestorFrame(this);
653 		creatTest.setLocationRelativeTo(null);
654 		creatTest.setVisible(true);
655 	} // creationMouseReleased()
656 
657 	/**
658 	 * Open the beginning frame
659 	 * 
660 	 * To open this frame, the user and the timer must be good
661 	 * 
662 	 * @param MouseEvent
663 	 *            evt
664 	 */
665 	void okMouseReleased(MouseEvent evt) {
666 
667 		boolean motdepasseOk = checkUser();
668 		boolean tempsOk = checkTimer();
669 		if (motdepasseOk == true && tempsOk == true) {
670 
671 			// enregistrement des variables de configuration
672 			this.saveTimer();
673 			this.saveUser();
674 			// masquage de la fenetre et affichage de la fenetre du navigateur
675 			WaitSplashScreen demarrage = new WaitSplashScreen();
676 			demarrage.setLocationRelativeTo(null);
677 			this.dispose();
678 			demarrage.setVisible(true);
679 			
680 
681 		} else {
682 			if (motdepasseOk == false && tempsOk == false) {
683 				JOptionPane
684 						.showMessageDialog(
685 								null,
686 								Messages.getString("Config.BAD_PASSWORD_TIME"), Messages.getString("Config.ERROR"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$ //$NON-NLS-2$
687 			} else {
688 				if (motdepasseOk == false) {
689 					JOptionPane
690 							.showMessageDialog(
691 									null,
692 									Messages.getString("Config.BAD_PASSWORD"), Messages.getString("Config.ERROR"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$ //$NON-NLS-2$
693 				}
694 				if (tempsOk == false) {
695 					JOptionPane
696 							.showMessageDialog(
697 									null,
698 									Messages.getString("Config.BAD_TIME"), Messages.getString("Config.ERROR"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$ //$NON-NLS-2$
699 				}
700 			}
701 		}
702 	} // okMouseReleased()
703 
704 	/**
705 	 * Check if the timer is selected
706 	 */
707 	void activeChrono(ItemEvent e) {
708 
709 		if (e.getStateChange() == ItemEvent.SELECTED) {
710 			Configuration.getHandle().setTimerActif(true);
711 			this.saisieHeure.setEditable(true);
712 			this.saisieMin.setEditable(true);
713 			this.saisieSec.setEditable(true);
714 		} else {
715 			Configuration.getHandle().setTimerActif(false);
716 			this.saisieHeure.setEditable(false);
717 			this.saisieMin.setEditable(false);
718 			this.saisieSec.setEditable(false);
719 		}
720 	} // activeChrono ()
721 
722 	/** Exit the Application */
723 	void exitForm(WindowEvent evt) {
724 		System.exit(0);
725 	} // exitForm()
726 
727 } // class Config
728