use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class ColumnSet method calculateKeyIndexes.
private void calculateKeyIndexes() {
List<Integer> keyIndexes = new ArrayList<Integer>();
for (int modelIndex = 0; modelIndex < getColumnCount(); modelIndex++) {
IColumn col = getColumn(modelIndex);
if (col.isPrimaryKey()) {
keyIndexes.add(modelIndex);
}
}
m_keyIndexes = new int[keyIndexes.size()];
int viewIndex = 0;
for (int modelIndex : keyIndexes) {
m_keyIndexes[viewIndex++] = modelIndex;
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class ColumnSet method calculateVisibleIndexes.
private void calculateVisibleIndexes() {
int viewIndex = 0;
Map<CompositeObject, Integer> visibleMap = new TreeMap<CompositeObject, Integer>();
for (int modelIndex = 0; modelIndex < getColumnCount(); modelIndex++) {
IColumn col = getColumn(modelIndex);
if (col.isDisplayable() && col.isVisible()) {
double viewHint = col.getVisibleColumnIndexHint();
if (viewHint < 0) {
viewHint = col.getOrder();
}
if (viewHint < 0) {
viewHint = viewIndex;
}
visibleMap.put(new CompositeObject(viewHint, viewIndex), modelIndex);
viewIndex++;
}
}
m_visibleIndexes = new int[visibleMap.size()];
viewIndex = 0;
for (int modelIndex : visibleMap.values()) {
m_visibleIndexes[viewIndex++] = modelIndex;
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class ColumnSet method checkMultiline.
private void checkMultiline() {
if (m_table != null && !m_table.isInitialMultilineText() && !ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "getConfiguredMultilineText", null, m_table.getClass())) {
// do automatic check for wrapping columns
boolean m = false;
for (IColumn col : getVisibleColumns()) {
if (col instanceof IStringColumn && ((IStringColumn) col).isTextWrap()) {
m = true;
break;
}
}
m_table.setMultilineText(m);
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class ColumnSet method applySortingAndGroupingInternal.
private void applySortingAndGroupingInternal(Map<IColumn, P_SortingAndGroupingConfig> columnConfigs) {
TreeMap<CompositeObject, IColumn> sortMap = new TreeMap<CompositeObject, IColumn>();
int index = 0;
for (IColumn col : getColumns()) {
int sortIndex = -1;
if (col.isInitialAlwaysIncludeSortAtBegin()) {
sortIndex = col.getInitialSortIndex();
if (sortIndex < 0) {
LOG.warn("AlwaysIncludeSortAtBegin is set but no sort index configured. Table: {}", m_table.getClass().getName());
}
} else if (col.isInitialAlwaysIncludeSortAtEnd()) {
sortIndex = col.getInitialSortIndex();
if (sortIndex < 0) {
LOG.warn("AlwaysIncludeSortAtEnd is set but no sort index configured. Table: {}", m_table.getClass().getName());
}
} else {
sortIndex = columnConfigs.get(col).getSortIndex();
}
if (sortIndex >= 0) {
sortMap.put(new CompositeObject(sortIndex, index), col);
}
// aggregation function:
if (col instanceof INumberColumn) {
((INumberColumn) col).setAggregationFunction(columnConfigs.get(col).getAggregationFunction());
}
index++;
}
clearSortColumns();
clearPermanentHeadSortColumns();
clearPermanentTailSortColumns();
boolean asc;
for (IColumn col : sortMap.values()) {
if (col.isInitialAlwaysIncludeSortAtBegin()) {
asc = col.isInitialSortAscending();
addPermanentHeadSortColumn(col, asc);
} else if (col.isInitialAlwaysIncludeSortAtEnd()) {
asc = col.isInitialSortAscending();
addPermanentTailSortColumn(col, asc);
} else {
asc = columnConfigs.get(col).isAscending();
addSortColumn(col, asc);
}
}
applyGrouping(columnConfigs);
}
use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class ColumnSet method clearSortColumns.
/**
* only clears user sort columns.
* <p>
* see also {@link #clearPermanentHeadSortColumns()} and {@link #clearPermanentTailSortColumns()}
*/
public void clearSortColumns() {
if (m_userSortColumns.size() == 0) {
return;
}
List<IColumn<?>> userSortColumnsBackup = new ArrayList<IColumn<?>>(m_userSortColumns);
m_userSortColumns.clear();
for (IColumn col : userSortColumnsBackup) {
HeaderCell cell = (HeaderCell) col.getHeaderCell();
cell.setSortActive(false);
cell.setGroupingActive(false);
}
for (IColumn c : userSortColumnsBackup) {
rebuildHeaderCell(c);
}
fireColumnHeadersUpdated(userSortColumnsBackup);
}
Aggregations