Search in sources :

Example 1 with AbstractColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn in project scout.rt by eclipse.

the class AbstractTable method resetColumnsInternal.

private void resetColumnsInternal(Set<String> options) {
    if (options.contains(IResetColumnsOption.SORTING)) {
        setSortValid(false);
    }
    if (options.contains(IResetColumnsOption.ORDER)) {
        TreeMap<CompositeObject, IColumn<?>> orderMap = new TreeMap<CompositeObject, IColumn<?>>();
        int index = 0;
        for (IColumn<?> col : getColumns()) {
            if (col.isDisplayable()) {
                orderMap.put(new CompositeObject(col.getOrder(), index), col);
                index++;
            }
        }
        getColumnSet().setVisibleColumns(orderMap.values());
    }
    if (options.contains(IResetColumnsOption.VISIBILITY)) {
        ArrayList<IColumn<?>> list = new ArrayList<IColumn<?>>();
        for (IColumn<?> col : getColumnSet().getAllColumnsInUserOrder()) {
            if (col.isDisplayable()) {
                boolean configuredVisible = ((AbstractColumn<?>) col).isInitialVisible();
                if (configuredVisible) {
                    list.add(col);
                }
            }
        }
        getColumnSet().setVisibleColumns(list);
    }
    if (options.contains(IResetColumnsOption.SORTING)) {
        getColumnSet().resetSortingAndGrouping();
    }
    if (options.contains(IResetColumnsOption.WIDTHS)) {
        for (IColumn<?> col : getColumns()) {
            if (col.isDisplayable()) {
                col.setWidth(col.getInitialWidth());
            }
        }
    }
    if (options.contains(IResetColumnsOption.BACKGROUND_EFFECTS)) {
        for (IColumn<?> col : getColumns()) {
            if (col instanceof INumberColumn) {
                ((INumberColumn) col).setBackgroundEffect(((INumberColumn) col).getInitialBackgroundEffect());
            }
        }
    }
    if (options.contains(IResetColumnsOption.FILTERS)) {
        removeUserRowFilters();
    }
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) INumberColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.INumberColumn) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) ArrayList(java.util.ArrayList) TreeMap(java.util.TreeMap) AbstractColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn)

Aggregations

ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1 AbstractColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn)1 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)1 INumberColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.INumberColumn)1 CompositeObject (org.eclipse.scout.rt.platform.util.CompositeObject)1