}
int index = 0;
for (DatasetColumnState columnState : columnStates) {
DBColumn column = dataset.getColumn(columnState.getName());
ColumnInfo columnInfo = new DatasetEditorColumnInfo(column, index, column.getPosition());
addColumnInfo(columnInfo);
index++;
}
} else {
ResultSetMetaData metaData = resultSet.getMetaData();
int columnCount = metaData.getColumnCount();
for (int i = 0; i < columnCount; i++) {
String name = metaData.getColumnName(i+1);
DBColumn column = dataset.getColumn(name);
ColumnInfo columnInfo = new DatasetEditorColumnInfo(column, i, i+1);
addColumnInfo(columnInfo);
}
}
}