Search in sources :

Example 1 with CountriesComboBoxModel

use of de.alpharogroup.bundle.app.combobox.model.CountriesComboBoxModel 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);
    }
}
Also used : LanguageLocales(de.alpharogroup.db.resource.bundles.entities.LanguageLocales) Countries(de.alpharogroup.db.resource.bundles.entities.Countries) Languages(de.alpharogroup.db.resource.bundles.entities.Languages) CountriesComboBoxModel(de.alpharogroup.bundle.app.combobox.model.CountriesComboBoxModel) LanguagesComboBoxModel(de.alpharogroup.bundle.app.combobox.model.LanguagesComboBoxModel)

Example 2 with CountriesComboBoxModel

use of de.alpharogroup.bundle.app.combobox.model.CountriesComboBoxModel 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;
}
Also used : Countries(de.alpharogroup.db.resource.bundles.entities.Countries) CountriesComboBoxRenderer(de.alpharogroup.bundle.app.combobox.renderer.CountriesComboBoxRenderer) CountriesComboBoxModel(de.alpharogroup.bundle.app.combobox.model.CountriesComboBoxModel)

Aggregations

CountriesComboBoxModel (de.alpharogroup.bundle.app.combobox.model.CountriesComboBoxModel)2 Countries (de.alpharogroup.db.resource.bundles.entities.Countries)2 LanguagesComboBoxModel (de.alpharogroup.bundle.app.combobox.model.LanguagesComboBoxModel)1 CountriesComboBoxRenderer (de.alpharogroup.bundle.app.combobox.renderer.CountriesComboBoxRenderer)1 LanguageLocales (de.alpharogroup.db.resource.bundles.entities.LanguageLocales)1 Languages (de.alpharogroup.db.resource.bundles.entities.Languages)1