Search in sources :

Example 1 with LocalesComboBoxRenderer

use of de.alpharogroup.bundle.app.combobox.renderer.LocalesComboBoxRenderer 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)

Example 2 with LocalesComboBoxRenderer

use of de.alpharogroup.bundle.app.combobox.renderer.LocalesComboBoxRenderer in project bundle-app-ui by astrapi69.

the class ImportBundleApplicationStartPanel method onInitializeComponents.

@Override
protected void onInitializeComponents() {
    super.onInitializeComponents();
    fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    lblWelcomeImportHeader = new javax.swing.JLabel();
    lblBundleAppName = new javax.swing.JLabel();
    txtBundleAppName = new javax.swing.JTextField();
    final Model<String> bundleAppNameModel = model(from(getModelObject().getModelObject()).getBundleAppName());
    txtBundleAppName.getDocument().addDocumentListener(new StringBindingListener(bundleAppNameModel));
    txtBundleAppName.addActionListener(e -> onBundleAppName(e));
    lblHeaderChooseBundleAppName = new javax.swing.JLabel();
    btnChooseRootDir = new javax.swing.JButton();
    btnChooseRootDir.addActionListener(actionEvent -> onChooseRootDir(actionEvent));
    lblChooseRootDir = new javax.swing.JLabel();
    lblDefaultLocale = new javax.swing.JLabel();
    cmbDefaultLocale = new javax.swing.JComboBox<>(LocalesComboBoxModel.get());
    cmbDefaultLocale.addItemListener(e -> onChangeDefaultLocale(e));
    final Model<Locale> defaultLocaleModel = model(from(getModelObject().getModelObject()).getDefaultLocale());
    cmbDefaultLocale.setRenderer(new LocalesComboBoxRenderer(defaultLocaleModel));
    lblSelectedRootDir = new javax.swing.JLabel();
    txtSelectedRootDir = new javax.swing.JTextField();
    lblWelcomeImportHeader.setText("Import of an existing application with the bundle-manager ");
    lblBundleAppName.setText("Application name");
    lblHeaderChooseBundleAppName.setText("Give your imported bundle-application a name");
    btnChooseRootDir.setText("Choose root directory");
    lblChooseRootDir.setText("Choose the root directory of your project");
    lblDefaultLocale.setText("Choose default locale");
    lblSelectedRootDir.setText("Selected root directory of your project");
    txtSelectedRootDir.setText("None");
}
Also used : Locale(java.util.Locale) LocalesComboBoxRenderer(de.alpharogroup.bundle.app.combobox.renderer.LocalesComboBoxRenderer) JFileChooser(javax.swing.JFileChooser) StringBindingListener(de.alpharogroup.swing.bind.StringBindingListener)

Aggregations

LocalesComboBoxRenderer (de.alpharogroup.bundle.app.combobox.renderer.LocalesComboBoxRenderer)2 Locale (java.util.Locale)2 LocalesComboBoxModel (de.alpharogroup.bundle.app.combobox.model.LocalesComboBoxModel)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 StringBindingListener (de.alpharogroup.swing.bind.StringBindingListener)1 JFileChooser (javax.swing.JFileChooser)1