private void createTableColumnsFromDisplayerSettings( PagedTable<Integer> table, List<DisplayerSettingsColumn> displayerSettingsColumns ) {
int columnIndex = 0;
for ( int i = 0; i < displayerSettingsColumns.size(); i++ ) {
DisplayerSettingsColumn displayerSettingsColumn = displayerSettingsColumns.get( i );
DataColumn dataColumn;
if (displayerSettingsColumn.getColumnId() != null) dataColumn = dataSet.getColumnById( displayerSettingsColumn.getColumnId() );
else dataColumn = dataSet.getColumnByIndex( columnIndex++ );
if (dataColumn == null) {
String msg = "Displayer column not found in the data set: " + displayerSettingsColumn.getDisplayName();
GWT.log( msg );
throw new RuntimeException( msg );
}
String columnId = dataColumn.getId();
String displayName = displayerSettingsColumn.getDisplayName();
String caption = null;
if ( displayName != null && !"".equals( displayName ) ) {
caption = displayName;
columnCaptionIds.put( displayName, columnId );
} else {
caption = columnId;
}
int colIndex = dataSet.getColumnIndex( dataColumn );
Column<Integer, ?> column = createColumn( dataColumn.getColumnType(), columnId, colIndex );
if ( column != null ) {
column.setSortable( true );
table.addColumn( column, caption );
}
}