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();
}
}
Aggregations