Search in sources :

Example 1 with NullCheckComparator

use of de.alpharogroup.comparators.NullCheckComparator in project bundle-app-ui by astrapi69.

the class OverviewResourceBundleAddEntryPanel method reloadTableModelList.

private void reloadTableModelList() {
    tableModelList = new ArrayList<>();
    final ResourcebundlesService resourcebundlesService = SpringApplicationContext.getInstance().getResourcebundlesService();
    BundleApplications bundleApplication = getModelObject().getBundleApplication();
    final String baseName = getModelObject().getSelectedBundleName().getBaseName().getName();
    final Locale locale = LocaleResolver.resolveLocale(getModelObject().getSelectedBundleName().getLocale().getLocale());
    final List<Resourcebundles> list = resourcebundlesService.findResourceBundles(bundleApplication, baseName, locale);
    for (final Resourcebundles resourcebundle : list) {
        tableModelList.add(Quattro.<String, String, Resourcebundles, Resourcebundles>builder().topLeft(resourcebundle.getKey().getName()).topRight(resourcebundle.getValue()).bottomLeft(resourcebundle).bottomRight(resourcebundle).build());
    }
    Collections.sort(tableModelList, NullCheckComparator.<Quattro<String, String, Resourcebundles, Resourcebundles>>of((o1, o2) -> o1.getTopLeft().compareTo(o2.getTopLeft())));
}
Also used : Locale(java.util.Locale) PropertiesKeysService(de.alpharogroup.db.resource.bundles.service.api.PropertiesKeysService) TableCellButtonEditor(de.alpharogroup.swing.table.editor.TableCellButtonEditor) BundleApplications(de.alpharogroup.db.resource.bundles.entities.BundleApplications) BaseModel(de.alpharogroup.model.BaseModel) MainFrame(de.alpharogroup.bundle.app.MainFrame) ArrayList(java.util.ArrayList) PropertiesExtensions(de.alpharogroup.collections.properties.PropertiesExtensions) LocaleResolver(de.alpharogroup.resourcebundle.locale.LocaleResolver) Locale(java.util.Locale) StringResourcebundlesTableModel(de.alpharogroup.bundle.app.table.model.StringResourcebundlesTableModel) BasePanel(de.alpharogroup.swing.base.BasePanel) JFileChooser(javax.swing.JFileChooser) SpringApplicationContext(de.alpharogroup.bundle.app.spring.SpringApplicationContext) Properties(java.util.Properties) Resourcebundles(de.alpharogroup.db.resource.bundles.entities.Resourcebundles) ResourcebundlesService(de.alpharogroup.db.resource.bundles.service.api.ResourcebundlesService) TableColumn(javax.swing.table.TableColumn) Model(de.alpharogroup.model.api.Model) FileOutputStream(java.io.FileOutputStream) ApplicationDashboardContentPanel(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardContentPanel) IOException(java.io.IOException) JOptionPane(javax.swing.JOptionPane) Component(java.awt.Component) ActionEvent(java.awt.event.ActionEvent) File(java.io.File) NullCheckComparator(de.alpharogroup.comparators.NullCheckComparator) ResourceBundlesDomainObjectFactory(de.alpharogroup.db.resource.bundles.factories.ResourceBundlesDomainObjectFactory) GenericJXTable(de.alpharogroup.swing.x.GenericJXTable) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) ReturnToDashboardAction(de.alpharogroup.bundle.app.actions.ReturnToDashboardAction) JCheckBox(javax.swing.JCheckBox) ApplicationDashboardBean(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardBean) JTable(javax.swing.JTable) PropertiesKeys(de.alpharogroup.db.resource.bundles.entities.PropertiesKeys) TableCellButtonRenderer(de.alpharogroup.swing.renderer.TableCellButtonRenderer) Collections(java.util.Collections) Quattro(de.alpharogroup.collections.pairs.Quattro) ResourcebundlesService(de.alpharogroup.db.resource.bundles.service.api.ResourcebundlesService) BundleApplications(de.alpharogroup.db.resource.bundles.entities.BundleApplications) Resourcebundles(de.alpharogroup.db.resource.bundles.entities.Resourcebundles)

Example 2 with NullCheckComparator

use of de.alpharogroup.comparators.NullCheckComparator in project bundle-app-ui by astrapi69.

the class OverviewOfAllResourceBundlesPanel method getTableModelList.

private List<Triple<String, String, BundleNames>> getTableModelList() {
    if (tableModelList == null) {
        tableModelList = new ArrayList<>();
        BundleApplications bundleApplication = getModelObject().getBundleApplication();
        getModelObject().setBundleNames(SpringApplicationContext.getInstance().getBundleApplicationsService().find(bundleApplication));
        final Set<BundleNames> set = getModelObject().getBundleNames();
        if (CollectionExtensions.isNotEmpty(set)) {
            for (final BundleNames bundleNames : set) {
                tableModelList.add(Triple.<String, String, BundleNames>builder().left(bundleNames.getBaseName().getName()).middle(bundleNames.getLocale().getLocale()).right(bundleNames).build());
            }
        }
        Collections.sort(tableModelList, NullCheckComparator.<Triple<String, String, BundleNames>>of((o1, o2) -> o1.getLeft().compareTo(o2.getLeft())));
    }
    return tableModelList;
}
Also used : TableCellButtonEditor(de.alpharogroup.swing.table.editor.TableCellButtonEditor) BundleApplications(de.alpharogroup.db.resource.bundles.entities.BundleApplications) BaseModel(de.alpharogroup.model.BaseModel) MainFrame(de.alpharogroup.bundle.app.MainFrame) Triple(de.alpharogroup.collections.pairs.Triple) ArrayList(java.util.ArrayList) CollectionExtensions(de.alpharogroup.collections.CollectionExtensions) BasePanel(de.alpharogroup.swing.base.BasePanel) SpringApplicationContext(de.alpharogroup.bundle.app.spring.SpringApplicationContext) TableColumn(javax.swing.table.TableColumn) Model(de.alpharogroup.model.api.Model) BundleNames(de.alpharogroup.db.resource.bundles.entities.BundleNames) Set(java.util.Set) StringBundleNamesTableModel(de.alpharogroup.bundle.app.table.model.StringBundleNamesTableModel) Component(java.awt.Component) ActionEvent(java.awt.event.ActionEvent) NullCheckComparator(de.alpharogroup.comparators.NullCheckComparator) GenericJXTable(de.alpharogroup.swing.x.GenericJXTable) List(java.util.List) ReturnToDashboardAction(de.alpharogroup.bundle.app.actions.ReturnToDashboardAction) JCheckBox(javax.swing.JCheckBox) ApplicationDashboardBean(de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardBean) JTable(javax.swing.JTable) TableCellButtonRenderer(de.alpharogroup.swing.renderer.TableCellButtonRenderer) Collections(java.util.Collections) BundleNames(de.alpharogroup.db.resource.bundles.entities.BundleNames) BundleApplications(de.alpharogroup.db.resource.bundles.entities.BundleApplications)

Aggregations

MainFrame (de.alpharogroup.bundle.app.MainFrame)2 ReturnToDashboardAction (de.alpharogroup.bundle.app.actions.ReturnToDashboardAction)2 ApplicationDashboardBean (de.alpharogroup.bundle.app.panels.dashboard.ApplicationDashboardBean)2 SpringApplicationContext (de.alpharogroup.bundle.app.spring.SpringApplicationContext)2 NullCheckComparator (de.alpharogroup.comparators.NullCheckComparator)2 BundleApplications (de.alpharogroup.db.resource.bundles.entities.BundleApplications)2 BaseModel (de.alpharogroup.model.BaseModel)2 Model (de.alpharogroup.model.api.Model)2 BasePanel (de.alpharogroup.swing.base.BasePanel)2 TableCellButtonRenderer (de.alpharogroup.swing.renderer.TableCellButtonRenderer)2 TableCellButtonEditor (de.alpharogroup.swing.table.editor.TableCellButtonEditor)2 GenericJXTable (de.alpharogroup.swing.x.GenericJXTable)2 Component (java.awt.Component)2 ActionEvent (java.awt.event.ActionEvent)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 JCheckBox (javax.swing.JCheckBox)2 JTable (javax.swing.JTable)2 TableColumn (javax.swing.table.TableColumn)2