Search in sources :

Example 1 with TablePresentationsLayout

use of io.jmix.ui.component.presentation.TablePresentationsLayout in project jmix by jmix-framework.

the class AbstractTableSettingsBinder method applySettings.

@Override
public void applySettings(Table table, SettingsWrapper wrapper) {
    TableSettings tableSettings = wrapper.getSettings();
    if (tableSettings.getTextSelection() != null) {
        table.setTextSelectionEnabled(tableSettings.getTextSelection());
        com.vaadin.ui.Component presentationsLayout = getEnhancedTable(table).getPresentationsLayout();
        if (presentationsLayout != null) {
            ((TablePresentationsLayout) presentationsLayout).updateTextSelection();
        }
    }
    List<TableSettings.ColumnSettings> columnSettings = tableSettings.getColumns();
    if (columnSettings != null) {
        boolean refreshWasEnabled = getEnhancedTable(table).disableContentBufferRefreshing();
        Collection<String> modelIds = new ArrayList<>();
        for (Object column : getVTable(table).getVisibleColumns()) {
            modelIds.add(String.valueOf(column));
        }
        Collection<String> loadedIds = new ArrayList<>();
        for (TableSettings.ColumnSettings column : columnSettings) {
            loadedIds.add(column.getId());
        }
        if (CollectionUtils.isEqualCollection(modelIds, loadedIds)) {
            applyColumnSettings(tableSettings, table);
        }
        getEnhancedTable(table).enableContentBufferRefreshing(refreshWasEnabled);
    }
}
Also used : TableSettings(io.jmix.ui.settings.component.TableSettings) TablePresentationsLayout(io.jmix.ui.component.presentation.TablePresentationsLayout)

Aggregations

TablePresentationsLayout (io.jmix.ui.component.presentation.TablePresentationsLayout)1 TableSettings (io.jmix.ui.settings.component.TableSettings)1