Search in sources :

Example 1 with LocalesComboBoxModel

use of de.alpharogroup.bundle.app.combobox.model.LocalesComboBoxModel in project bundle-app-ui by astrapi69.

the class NewBundleApplicationPanel method newCmbDefaultLocale.

protected javax.swing.JComboBox<Locale> newCmbDefaultLocale(final Model<ApplicationDashboardBean> model) {
    ApplicationDashboardBean bean = model.getObject();
    BundleApplications bundleApplication = bean.getBundleApplication();
    LocalesComboBoxModel cmbModel = LocalesComboBoxModel.get();
    Locale dl = Locale.getDefault();
    if (bundleApplication != null) {
        LanguageLocales defaultLocale = bundleApplication.getDefaultLocale();
        if (defaultLocale != null) {
            dl = SpringApplicationContext.getInstance().getLanguageLocalesService().resolveLocale(defaultLocale);
        }
    }
    cmbModel.setSelectedItem(dl);
    final javax.swing.JComboBox<Locale> cmbDefaultLocale = new javax.swing.JComboBox<>(cmbModel);
    cmbDefaultLocale.addItemListener(e -> onChangeDefaultLocale(e));
    final Model<Locale> defaultLocaleModel = model(from(getModel()).getDefaultLocale());
    cmbDefaultLocale.setRenderer(new LocalesComboBoxRenderer(defaultLocaleModel));
    return cmbDefaultLocale;
}
Also used : Locale(java.util.Locale) LocalesComboBoxModel(de.alpharogroup.bundle.app.combobox.model.LocalesComboBoxModel) LanguageLocales(de.alpharogroup.db.resource.bundles.entities.LanguageLocales) LocalesComboBoxRenderer(de.alpharogroup.bundle.app.combobox.renderer.LocalesComboBoxRenderer) ApplicationDashboardBean(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardBean) BundleApplications(de.alpharogroup.db.resource.bundles.entities.BundleApplications)

Aggregations

LocalesComboBoxModel (de.alpharogroup.bundle.app.combobox.model.LocalesComboBoxModel)1 LocalesComboBoxRenderer (de.alpharogroup.bundle.app.combobox.renderer.LocalesComboBoxRenderer)1 ApplicationDashboardBean (de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardBean)1 BundleApplications (de.alpharogroup.db.resource.bundles.entities.BundleApplications)1 LanguageLocales (de.alpharogroup.db.resource.bundles.entities.LanguageLocales)1 Locale (java.util.Locale)1