use of pcgen.gui2.util.treeview.DataViewColumn in project pcgen by PCGen.
the class JTreeViewTable method createTableColumnModel.
private DynamicTableColumnModel createTableColumnModel(TreeView<?> startingView, DataView<?> dataView) {
@SuppressWarnings("unchecked") ListMap<Visibility, TableColumn, List<TableColumn>> listMap = CollectionMaps.createListMap(HashMap.class, ArrayList.class);
int index = 1;
for (DataViewColumn column : dataView.getDataColumns()) {
TableColumn tableColumn = new TableColumn(index++);
tableColumn.setHeaderValue(column.getName());
Visibility vis = column.getVisibility();
listMap.add(vis, tableColumn);
}
List<TableColumn> columns = listMap.get(Visibility.ALWAYS_VISIBLE);
if (columns == null) {
columns = Collections.emptyList();
}
PrefTableColumnModel model = new PrefTableColumnModel(this.viewModel.getDataView().getPrefsKey(), columns.size() + 1);
TableColumn viewColumn = new TableColumn();
viewColumn.setHeaderValue(startingView.getViewName());
viewColumn.setIdentifier(TREE_VIEW_COL_PREFS_KEY);
model.addColumn(viewColumn, true, 150);
for (TableColumn column : columns) {
model.addColumn(column, true, 75);
}
columns = listMap.get(Visibility.INITIALLY_VISIBLE);
if (columns != null) {
for (TableColumn column : columns) {
model.addColumn(column, true, 75);
}
}
columns = listMap.get(Visibility.INITIALLY_INVISIBLE);
if (columns != null) {
for (TableColumn column : columns) {
model.addColumn(column, false, 75);
}
}
return model;
}
Aggregations