private void completePanel() {
    jlFederationLocaleNiveau.setText(profile.getConfiguration().getLangue());

    if (federation == null) return;

    jtfFederatonSigle.setText(federation.getSigleFederation());
    jtfFederatonName.setText(federation.getNomFederation());
    ccbCountryFederation.setSelectedCountry(federation.getCodeCountry());

    for (CompetitionLevel cl : federation.getCompetitionLevels()) {
      if (cl.getLang().equals(profile.getConfiguration().getLangue())) {
        String tmp = ""; // $NON-NLS-1$
        if (!jtfFederationNiveau.getText().isEmpty())
          tmp = jtfFederationNiveau.getText() + ","; // $NON-NLS-1$
        tmp += cl.getLibelle();
        jtfFederationNiveau.setText(tmp);
      } else {
        if (!mTraduction.containsKey(cl.getLang())) {
          addLocaleLevelField(cl.getLang());
          jcbAvailableLocale.removeItem(new Locale(cl.getLang()));
          if (jcbAvailableLocale.getItemCount() == 0) {
            jcbAvailableLocale.setEnabled(false);
            jbAddLocale.setEnabled(false);
          }
          jlAddLocaleInfo.setVisible(true);
        }
        String tmp = ""; // $NON-NLS-1$
        JTextField tmpTF = mTraduction.get(cl.getLang());
        if (!tmpTF.getText().isEmpty()) tmp = tmpTF.getText() + ","; // $NON-NLS-1$
        tmp += cl.getLibelle();
        tmpTF.setText(tmp);
      }
    }
  }
  public FederationDialog(Window parentframe, Profile profile) {
    super(parentframe, ModalityType.TOOLKIT_MODAL);

    this.profile = profile;
    this.localisation = profile.getLocalisation();

    init();
    affectLabels();
  }
 /* (non-Javadoc)
  * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
  */
 @Override
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == jbValider) {
     if (federation == null)
       federation = new Federation(jtfFederatonName.getText(), jtfFederatonSigle.getText());
     else {
       federation.setNomFederation(jtfFederatonName.getText());
       federation.setSigleFederation(jtfFederatonSigle.getText());
     }
     federation.setCodeCountry(
         ((Country) ccbCountryFederation.getSelectedItem()).getCode().toLowerCase());
     federation.getCompetitionLevels().clear();
     boolean first = true;
     for (String level : jtfFederationNiveau.getText().split(",")) { // $NON-NLS-1$
       CompetitionLevel cl = new CompetitionLevel();
       cl.setDefaut(first);
       first = false;
       cl.setLang(profile.getConfiguration().getLangue());
       cl.setLibelle(level);
       federation.addCompetitionLevel(cl);
     }
     for (Entry<String, JTextField> le : mTraduction.entrySet()) {
       first = true;
       for (String level : le.getValue().getText().split(",")) { // $NON-NLS-1$
         CompetitionLevel cl = new CompetitionLevel();
         cl.setDefaut(first);
         first = false;
         cl.setLang(le.getKey());
         cl.setLibelle(level);
         federation.addCompetitionLevel(cl);
       }
     }
     try {
       federation.save();
     } catch (ObjectPersistenceException e1) {
       federation = null;
       DisplayableErrorHelper.displayException(e1);
       e1.printStackTrace();
     }
     setVisible(false);
   } else if (e.getSource() == jbAnnuler) {
     setVisible(false);
   } else if (e.getSource() == jbAddLocale) {
     Locale loc = (Locale) jcbAvailableLocale.getSelectedItem();
     addLocaleLevelField(loc.toString());
     mTraduction.get(loc.toString()).setText(jtfFederationNiveau.getText());
     jcbAvailableLocale.removeItem(loc);
     if (jcbAvailableLocale.getItemCount() == 0) {
       jcbAvailableLocale.setEnabled(false);
       jbAddLocale.setEnabled(false);
     }
     jlAddLocaleInfo.setVisible(true);
     redimDialog();
   }
 }
  private void init() {
    JPanel jpPrincipal = new JPanel();
    JPanel jpAction = new JPanel();

    GridbagComposer gbComposer = new GridbagComposer();
    GridBagConstraints c = new GridBagConstraints();

    GlossPainter gloss = new GlossPainter();
    jxhFederation.setBackground(new Color(200, 200, 255));
    jxhFederation.setBackgroundPainter(gloss);
    jxhFederation.setTitleFont(jxhFederation.getTitleFont().deriveFont(16.0f));

    jlFederationLocaleNiveau.setOpaque(true);
    jlFederationLocaleNiveau.setBackground(Color.WHITE);

    gbcTraduction.setParentPanel(jpTraduction);
    cTraduction.gridy = -1;
    cTraduction.anchor = GridBagConstraints.WEST;
    cTraduction.fill = GridBagConstraints.HORIZONTAL;

    String[] libelleLangues = Configuration.listLangue();

    jcbAvailableLocale.setRenderer(
        new DefaultListCellRenderer() {
          /* (non-Javadoc)
           * @see javax.swing.DefaultListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
           */
          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

            if (value != null) value = ((Locale) value).getDisplayLanguage((Locale) value);
            else value = ""; // $NON-NLS-1$
            return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
          }
        });
    for (int i = 0; i < libelleLangues.length; i++) {
      if (!new Locale(libelleLangues[i]).equals(new Locale(profile.getConfiguration().getLangue())))
        jcbAvailableLocale.addItem(new Locale(libelleLangues[i]));
    }
    if (libelleLangues.length < 2) {
      jcbAvailableLocale.setEnabled(false);
    }

    jlAddLocaleInfo.setVisible(false);
    jbAddLocale.addActionListener(this);
    jbValider.addActionListener(this);
    jbAnnuler.addActionListener(this);

    gbComposer.setParentPanel(jpPrincipal);
    c.gridy = 0;
    c.anchor = GridBagConstraints.WEST;
    gbComposer.addComponentIntoGrid(jlFederationSigle, c);
    c.gridwidth = 2;
    gbComposer.addComponentIntoGrid(jtfFederatonSigle, c);
    c.gridy++;
    c.gridwidth = 1;
    gbComposer.addComponentIntoGrid(jlFederationName, c);
    c.gridwidth = 2;
    gbComposer.addComponentIntoGrid(jtfFederatonName, c);
    c.gridy++;
    c.gridwidth = 1;
    gbComposer.addComponentIntoGrid(jlCountry, c);
    c.gridwidth = 2;
    gbComposer.addComponentIntoGrid(ccbCountryFederation, c);
    c.gridy++;
    c.gridwidth = 1;
    gbComposer.addComponentIntoGrid(jlFederationNiveau, c);
    c.gridwidth = 2;
    gbComposer.addComponentIntoGrid(jtfFederationNiveau, c);
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    gbComposer.addComponentIntoGrid(jlFederationLocaleNiveau, c);
    c.gridy++;
    c.gridx = 1;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.NONE;
    gbComposer.addComponentIntoGrid(jlFederationNiveauInfo, c);
    c.gridy++;
    gbComposer.addComponentIntoGrid(jpTraduction, c);
    c.gridy++;
    gbComposer.addComponentIntoGrid(jlAddLocaleInfo, c);
    c.gridy++;
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridwidth = 1;
    gbComposer.addComponentIntoGrid(jlAddLocale, c);
    gbComposer.addComponentIntoGrid(jcbAvailableLocale, c);
    gbComposer.addComponentIntoGrid(jbAddLocale, c);

    jpAction.setLayout(new FlowLayout(FlowLayout.RIGHT));
    jpAction.add(jbValider);
    jpAction.add(jbAnnuler);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(jxhFederation, BorderLayout.NORTH);
    getContentPane().add(jpPrincipal, BorderLayout.CENTER);
    getContentPane().add(jpAction, BorderLayout.SOUTH);
  }