use of de.alpharogroup.db.resource.bundles.entities.Countries in project bundle-app-ui by astrapi69.
the class NewCustomLocalePanel method onSave.
private void onSave(final ActionEvent e) {
System.out.println("de.alpharogroup.bundle.app.panels.creation.NewCustomLocalePanel.onSave()");
Languages selectedLanguage = (Languages) cmbLanguage.getSelectedItem();
Countries selectedCountry = (Countries) cmbCountry.getSelectedItem();
String variant = txtVariant.getText();
String localeCode = selectedLanguage.getIso639Dash1() + "_" + selectedCountry.getIso3166A2name() + "_" + variant;
LanguageLocales languageLocales = SpringApplicationContext.getInstance().getLanguageLocalesService().find(localeCode);
if (languageLocales == null) {
SpringApplicationContext.getInstance().getLanguageLocalesService().merge(LanguageLocales.builder().locale(localeCode).build());
cmbCountry.setModel(new CountriesComboBoxModel());
cmbLanguage.setModel(new LanguagesComboBoxModel());
txtVariant.setText("");
this.revalidate();
this.repaint();
} else {
// no owner frame
JOptionPane.showMessageDialog(// no owner frame
null, // text to display
"Locale already exists", // title
"Invalid Value", JOptionPane.WARNING_MESSAGE);
}
}
use of de.alpharogroup.db.resource.bundles.entities.Countries in project bundle-app-ui by astrapi69.
the class NewCustomLocalePanel method newCmbCountry.
protected javax.swing.JComboBox<Countries> newCmbCountry(final Model<ApplicationDashboardBean> model) {
CountriesComboBoxModel cmbModel = CountriesComboBoxModel.get();
final javax.swing.JComboBox<Countries> comboBox = new javax.swing.JComboBox<>(cmbModel);
comboBox.addItemListener(e -> onChangeCountry(e));
comboBox.setRenderer(new CountriesComboBoxRenderer());
return comboBox;
}
Aggregations