/* (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(); } }
static { try { loadHelper = new LoadHelper<Entite, Map<String, Object>>( new SqlLoadHandler<Entite>(ApplicationCore.dbConnection, Entite.class)); resultSetLoadHelper = new LoadHelper<Entite, ResultSet>(new ResultSetLoadHandler<Entite>(Entite.class)); } catch (ObjectPersistenceException e) { e.printStackTrace(); } }