Index: extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/ConnexionDialog.java
===================================================================
--- extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/ConnexionDialog.java	(revision 7070)
+++ extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/ConnexionDialog.java	(revision 7221)
@@ -16,5 +16,4 @@
 import java.util.Arrays;
 import java.util.Locale;
-
 import javax.swing.AbstractListModel;
 import javax.swing.ComboBoxModel;
@@ -27,5 +26,4 @@
 import javax.swing.JPasswordField;
 import javax.swing.JTextField;
-
 import fr.mael.jiwigo.Main;
 import fr.mael.jiwigo.transverse.enumeration.PreferencesEnum;
@@ -33,4 +31,5 @@
 import fr.mael.jiwigo.transverse.util.Messages;
 import fr.mael.jiwigo.transverse.util.preferences.PreferencesManagement;
+
 
 /**
@@ -64,261 +63,280 @@
  */
 public class ConnexionDialog extends JDialog implements ActionListener, ItemListener, KeyListener, WindowListener {
-    /**
-     * Logger
-     */
-    public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
-	    .getLog(ConnexionDialog.class);
-    /**
-     * field that contains the url
-     */
-    private JTextField fieldUrl;
-    /**
-     * field that contains the login
-     */
-    private JTextField loginField;
-    /**
-     * field that contains de password
-     */
-    private JPasswordField passwordField;
-    /**
-     * label of the url field
-     */
-    private JLabel labelUrl;
-    /**
-     * label of the login field
-     */
-    private JLabel labelLogin;
-    /**
-     *  label of the password field
-     */
-    private JLabel labelPass;
-    /**
-     * ok button for the connection
-     */
-    private JButton boutonOk;
-
-    /**
-     * Box that allows to save informations
-     */
-    private JCheckBox checkBoxRetenir;
-
-    /**
-     * Combo containing all locales
-     */
-    private JComboBox comboLocales;
-
-    /**
-     * Constructor 
-     */
-    public ConnexionDialog() {
-	Locale defautLocale = Messages.usedLocale;
-	labelUrl = new JLabel(Messages.getMessage("connexionDialog_urlSite"));
-	labelLogin = new JLabel(Messages.getMessage("connexionDialog_login"));
-	labelPass = new JLabel(Messages.getMessage("connexionDialog_pass"));
-	comboLocales = new JComboBox();
-	boutonOk = new JButton("Ok");
-	String url = PreferencesManagement.getValue(PreferencesEnum.URL_SITE.getLabel());
-	String login = PreferencesManagement.getValue(PreferencesEnum.LOGIN.getLabel());
-	String pass = PreferencesManagement.getValue(PreferencesEnum.PASSWORD.getLabel());
-	fieldUrl = new JTextField(url);
-	loginField = new JTextField(login);
-	passwordField = new JPasswordField(pass);
-	checkBoxRetenir = new JCheckBox(Messages.getMessage("connexionDialog_sauvegarder"));
-	if (!url.equals("") && !login.equals("") && !pass.equals("")) {
-	    checkBoxRetenir.setSelected(true);
-	}
-	Dimension fieldDimensions = new Dimension(300, 30);
-	fieldUrl.setPreferredSize(fieldDimensions);
-	fieldUrl.addActionListener(this);
-	loginField.setPreferredSize(fieldDimensions);
-	loginField.addActionListener(this);
-	passwordField.setPreferredSize(fieldDimensions);
-	passwordField.addActionListener(this);
-	this.getContentPane().setLayout(new GridBagLayout());
-	GridBagConstraints constraints = new GridBagConstraints();
-	constraints.gridx = 0;
-	constraints.gridy = 0;
-	constraints.insets = new Insets(3, 3, 3, 3);
-	this.getContentPane().add(labelUrl, constraints);
-	constraints.gridx++;
-	this.getContentPane().add(fieldUrl, constraints);
-	constraints.gridx = 0;
-	constraints.gridy++;
-	this.getContentPane().add(labelLogin, constraints);
-	constraints.gridx++;
-	this.getContentPane().add(loginField, constraints);
-	constraints.gridx = 0;
-	constraints.gridy++;
-	this.getContentPane().add(labelPass, constraints);
-	constraints.gridx++;
-	this.getContentPane().add(passwordField, constraints);
-	constraints.gridx = 0;
-	constraints.gridy++;
-	this.getContentPane().add(comboLocales, constraints);
-	constraints.gridx++;
-	this.getContentPane().add(checkBoxRetenir, constraints);
-	constraints.gridx = 0;
-	constraints.gridy++;//  
-	//	for (Locale locale : SimpleDateFormat.getAvailableLocales()) {
-	//	    comboLocales.addItem(locale.getDisplayName(Locale.ENGLISH));
-	//	}
-	comboLocales.setPreferredSize(new Dimension(130, 25));
-	comboLocales.addItemListener(this);
-	localeModel model = new localeModel();
-	comboLocales.setModel(model);
-	model.setSelectedItem(defautLocale.getDisplayLanguage(Locale.ENGLISH));
-	this.getContentPane().add(boutonOk, constraints);
-	boutonOk.setPreferredSize(new Dimension(80, 30));
-	boutonOk.addActionListener(this);
-	this.addWindowListener(this);
-    }
-
-    public void showDialog() {
-	this.pack();
-	this.setLocationRelativeTo(null);
-	this.setVisible(true);
-    }
-
-    @Override
-    public void actionPerformed(ActionEvent paramActionEvent) {
-	//if one field is empty, an error is displayed
-	if (fieldUrl.getText().equals("") || loginField.getText().equals("") || passwordField.getText().equals("")) {
-	    JOptionPane.showMessageDialog(null, Messages.getMessage("connexionDialog_emptyField"), Messages
-		    .getMessage("error"), JOptionPane.ERROR_MESSAGE);
-	} else {
-	    if (!fieldUrl.getText().startsWith("http://")) {
-		fieldUrl.setText("http://" + fieldUrl.getText());
-	    }
-	    //instanciation of the session manager
-	    Main.sessionManager = new SessionManager(loginField.getText(), passwordField.getText(), fieldUrl.getText());
-	    if (checkBoxRetenir.isSelected()) {
-		PreferencesManagement.setValue(PreferencesEnum.LOGIN.getLabel(), loginField.getText());
-		PreferencesManagement.setValue(PreferencesEnum.PASSWORD.getLabel(), passwordField.getText());
-		PreferencesManagement.setValue(PreferencesEnum.URL_SITE.getLabel(), fieldUrl.getText());
-	    } else {
-		PreferencesManagement.setValue(PreferencesEnum.LOGIN.getLabel(), "");
-		PreferencesManagement.setValue(PreferencesEnum.PASSWORD.getLabel(), "");
-		PreferencesManagement.setValue(PreferencesEnum.URL_SITE.getLabel(), "");
-	    }
-	    if (!Main.sessionManager.processLogin()) {
-		//if the login fails, an error is displayed
-		JOptionPane.showMessageDialog(null, Messages.getMessage("connexionDialog_connexionError"), Messages
-			.getMessage("error"), JOptionPane.ERROR_MESSAGE);
-	    } else {
-		//		Locale.setDefault((Locale) comboLocales.getSelectedItem());
-		Main.showFrame();
-		//hides the dialog
-		this.dispose();
-	    }
-	}
-    }
-
-    /**
-     * @author mael
-     * Internal class that represents the model of the combobox that allows
-     * to choose a locale
-     */
-    class localeModel extends AbstractListModel implements ComboBoxModel {
-	Locale[] locales = SimpleDateFormat.getAvailableLocales();
-	//List<Locale> locales = Messages.getAvailableBundles();
-	String[] localesNames;
-
-	String selection = null;
-
-	public localeModel() {
-	    localesNames = new String[locales.length];
-	    int compteur = 0;
-	    for (Locale locale : locales) {
-		localesNames[compteur] = locale.getDisplayName(Locale.ENGLISH);
-		compteur++;
-	    }
-	    Arrays.sort(localesNames);
-	}
-
-	public Object getElementAt(int index) {
-	    return localesNames[index];
-	}
-
-	public int getSize() {
-	    return locales.length;
-	}
-
-	public void setSelectedItem(Object anItem) {
-	    selection = (String) anItem;
-	}
-
-	public Object getSelectedItem() {
-	    if (selection != null)
-		return selection;
-	    else
-		return null;
-	}
-    }
-
-    @Override
-    public void itemStateChanged(ItemEvent paramItemEvent) {
-	for (Locale locale : SimpleDateFormat.getAvailableLocales()) {
-	    if (locale.getDisplayName(Locale.ENGLISH).equals(paramItemEvent.getItem())) {
-		Messages.usedLocale = locale;
-		dispose();
-		ConnexionDialog dial = new ConnexionDialog();
-		dial.showDialog();
-
-	    }
-
-	}
-    }
-
-    @Override
-    public void keyPressed(KeyEvent arg0) {
-    }
-
-    @Override
-    public void keyReleased(KeyEvent arg0) {
-
-    }
-
-    @Override
-    public void keyTyped(KeyEvent arg0) {
-    }
-
-    @Override
-    public void windowActivated(WindowEvent e) {
-	// TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void windowClosed(WindowEvent e) {
-	System.out.println("closed");
-    }
-
-    @Override
-    public void windowClosing(WindowEvent e) {
-	System.exit(0);
-    }
-
-    @Override
-    public void windowDeactivated(WindowEvent e) {
-	// TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void windowDeiconified(WindowEvent e) {
-	// TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void windowIconified(WindowEvent e) {
-	// TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void windowOpened(WindowEvent e) {
-	// TODO Auto-generated method stub
-
-    }
+
+	/**
+	 * Logger
+	 */
+	public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(ConnexionDialog.class);
+	/**
+	 * field that contains the url
+	 */
+	private JTextField fieldUrl;
+	/**
+	 * field that contains the login
+	 */
+	private JTextField loginField;
+	/**
+	 * field that contains de password
+	 */
+	private JPasswordField passwordField;
+	/**
+	 * label of the url field
+	 */
+	private JLabel labelUrl;
+	/**
+	 * label of the login field
+	 */
+	private JLabel labelLogin;
+	/**
+	 *  label of the password field
+	 */
+	private JLabel labelPass;
+	/**
+	 * ok button for the connection
+	 */
+	private JButton boutonOk;
+
+	/**
+	 * Box that allows to save informations
+	 */
+	private JCheckBox checkBoxRetenir;
+
+	/**
+	 * Combo containing all locales
+	 */
+	private JComboBox comboLocales;
+
+
+	/**
+	 * Constructor 
+	 */
+	public ConnexionDialog() {
+		Locale defautLocale = Messages.usedLocale;
+		labelUrl = new JLabel(Messages.getMessage("connexionDialog_urlSite"));
+		labelLogin = new JLabel(Messages.getMessage("connexionDialog_login"));
+		labelPass = new JLabel(Messages.getMessage("connexionDialog_pass"));
+		comboLocales = new JComboBox();
+		boutonOk = new JButton("Ok");
+		String url = PreferencesManagement.getValue(PreferencesEnum.URL_SITE.getLabel());
+		String login = PreferencesManagement.getValue(PreferencesEnum.LOGIN.getLabel());
+		String pass = PreferencesManagement.getValue(PreferencesEnum.PASSWORD.getLabel());
+		fieldUrl = new JTextField(url);
+		loginField = new JTextField(login);
+		passwordField = new JPasswordField(pass);
+		checkBoxRetenir = new JCheckBox(Messages.getMessage("connexionDialog_sauvegarder"));
+		if (!url.equals("") && !login.equals("") && !pass.equals("")) {
+			checkBoxRetenir.setSelected(true);
+		}
+		Dimension fieldDimensions = new Dimension(300, 30);
+		fieldUrl.setPreferredSize(fieldDimensions);
+		fieldUrl.addActionListener(this);
+		loginField.setPreferredSize(fieldDimensions);
+		loginField.addActionListener(this);
+		passwordField.setPreferredSize(fieldDimensions);
+		passwordField.addActionListener(this);
+		this.getContentPane().setLayout(new GridBagLayout());
+		GridBagConstraints constraints = new GridBagConstraints();
+		constraints.gridx = 0;
+		constraints.gridy = 0;
+		constraints.insets = new Insets(3, 3, 3, 3);
+		this.getContentPane().add(labelUrl, constraints);
+		constraints.gridx++;
+		this.getContentPane().add(fieldUrl, constraints);
+		constraints.gridx = 0;
+		constraints.gridy++;
+		this.getContentPane().add(labelLogin, constraints);
+		constraints.gridx++;
+		this.getContentPane().add(loginField, constraints);
+		constraints.gridx = 0;
+		constraints.gridy++;
+		this.getContentPane().add(labelPass, constraints);
+		constraints.gridx++;
+		this.getContentPane().add(passwordField, constraints);
+		constraints.gridx = 0;
+		constraints.gridy++;
+		this.getContentPane().add(comboLocales, constraints);
+		constraints.gridx++;
+		this.getContentPane().add(checkBoxRetenir, constraints);
+		constraints.gridx = 0;
+		constraints.gridy++;//  
+		//	for (Locale locale : SimpleDateFormat.getAvailableLocales()) {
+		//	    comboLocales.addItem(locale.getDisplayName(Locale.ENGLISH));
+		//	}
+		comboLocales.setPreferredSize(new Dimension(130, 25));
+		comboLocales.addItemListener(this);
+		localeModel model = new localeModel();
+		comboLocales.setModel(model);
+		model.setSelectedItem(defautLocale.getDisplayLanguage(Locale.ENGLISH));
+		this.getContentPane().add(boutonOk, constraints);
+		boutonOk.setPreferredSize(new Dimension(80, 30));
+		boutonOk.addActionListener(this);
+		this.addWindowListener(this);
+	}
+
+
+	public void showDialog() {
+		this.pack();
+		this.setLocationRelativeTo(null);
+		this.setVisible(true);
+	}
+
+
+	@Override
+	public void actionPerformed(ActionEvent paramActionEvent) {
+		//if one field is empty, an error is displayed
+		if (fieldUrl.getText().equals("") || loginField.getText().equals("") || passwordField.getText().equals("")) {
+			JOptionPane.showMessageDialog(null, Messages.getMessage("connexionDialog_emptyField"),
+					Messages.getMessage("error"), JOptionPane.ERROR_MESSAGE);
+		} else {
+			if (!fieldUrl.getText().startsWith("http://")) {
+				fieldUrl.setText("http://" + fieldUrl.getText());
+			}
+			//instanciation of the session manager
+			Main.sessionManager = new SessionManager(loginField.getText(), passwordField.getText(), fieldUrl.getText());
+			if (checkBoxRetenir.isSelected()) {
+				PreferencesManagement.setValue(PreferencesEnum.LOGIN.getLabel(), loginField.getText());
+				PreferencesManagement.setValue(PreferencesEnum.PASSWORD.getLabel(), passwordField.getText());
+				PreferencesManagement.setValue(PreferencesEnum.URL_SITE.getLabel(), fieldUrl.getText());
+			} else {
+				PreferencesManagement.setValue(PreferencesEnum.LOGIN.getLabel(), "");
+				PreferencesManagement.setValue(PreferencesEnum.PASSWORD.getLabel(), "");
+				PreferencesManagement.setValue(PreferencesEnum.URL_SITE.getLabel(), "");
+			}
+			if (!Main.sessionManager.processLogin()) {
+				//if the login fails, an error is displayed
+				JOptionPane.showMessageDialog(null, Messages.getMessage("connexionDialog_connexionError"),
+						Messages.getMessage("error"), JOptionPane.ERROR_MESSAGE);
+			} else {
+				//		Locale.setDefault((Locale) comboLocales.getSelectedItem());
+				Main.showFrame();
+				//hides the dialog
+				this.dispose();
+			}
+		}
+	}
+
+	/**
+	 * @author mael
+	 * Internal class that represents the model of the combobox that allows
+	 * to choose a locale
+	 */
+	class localeModel extends AbstractListModel implements ComboBoxModel {
+
+		Locale[] locales = SimpleDateFormat.getAvailableLocales();
+		//List<Locale> locales = Messages.getAvailableBundles();
+		String[] localesNames;
+
+		String selection = null;
+
+
+		public localeModel() {
+			localesNames = new String[locales.length];
+			int compteur = 0;
+			for (Locale locale : locales) {
+				localesNames[compteur] = locale.getDisplayName(Locale.ENGLISH);
+				compteur++;
+			}
+			Arrays.sort(localesNames);
+		}
+
+
+		public Object getElementAt(int index) {
+			return localesNames[index];
+		}
+
+
+		public int getSize() {
+			return locales.length;
+		}
+
+
+		public void setSelectedItem(Object anItem) {
+			selection = (String) anItem;
+		}
+
+
+		public Object getSelectedItem() {
+			if (selection != null)
+				return selection;
+			else
+				return null;
+		}
+	}
+
+
+	@Override
+	public void itemStateChanged(ItemEvent paramItemEvent) {
+		for (Locale locale : SimpleDateFormat.getAvailableLocales()) {
+			if (locale.getDisplayName(Locale.ENGLISH).equals(paramItemEvent.getItem())) {
+				Messages.usedLocale = locale;
+				dispose();
+				ConnexionDialog dial = new ConnexionDialog();
+				dial.showDialog();
+
+			}
+
+		}
+	}
+
+
+	@Override
+	public void keyPressed(KeyEvent arg0) {
+	}
+
+
+	@Override
+	public void keyReleased(KeyEvent arg0) {
+
+	}
+
+
+	@Override
+	public void keyTyped(KeyEvent arg0) {
+	}
+
+
+	@Override
+	public void windowActivated(WindowEvent e) {
+		// TODO Auto-generated method stub
+
+	}
+
+
+	@Override
+	public void windowClosed(WindowEvent e) {
+	}
+
+
+	@Override
+	public void windowClosing(WindowEvent e) {
+		System.exit(0);
+	}
+
+
+	@Override
+	public void windowDeactivated(WindowEvent e) {
+		// TODO Auto-generated method stub
+
+	}
+
+
+	@Override
+	public void windowDeiconified(WindowEvent e) {
+		// TODO Auto-generated method stub
+
+	}
+
+
+	@Override
+	public void windowIconified(WindowEvent e) {
+		// TODO Auto-generated method stub
+
+	}
+
+
+	@Override
+	public void windowOpened(WindowEvent e) {
+		// TODO Auto-generated method stub
+
+	}
 }
