use of javax.swing.table.TableColumn 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;
}
use of javax.swing.table.TableColumn in project pcgen by PCGen.
the class Utilities method createTableColumn.
public static TableColumn createTableColumn(int index, String headerValue, TableCellRenderer headerRenderer, boolean resizable) {
TableColumn column = new TableColumn(index);
if (headerValue.startsWith("in_")) {
column.setHeaderValue(LanguageBundle.getString(headerValue));
} else {
column.setHeaderValue(headerValue);
}
column.setHeaderRenderer(headerRenderer);
if (!resizable) {
column.sizeWidthToFit();
column.setMaxWidth(column.getMaxWidth() + 10);
column.setPreferredWidth(column.getPreferredWidth() + 10);
}
column.setResizable(resizable);
return column;
}
use of javax.swing.table.TableColumn in project pcgen by PCGen.
the class DomainInfoTab method createDomainColumnModel.
public DynamicTableColumnModel createDomainColumnModel() {
PrefTableColumnModel model = new PrefTableColumnModel("DomainList", 1);
TableColumn column = new TableColumn(0);
//$NON-NLS-1$
column.setHeaderValue(LanguageBundle.getString("in_domains"));
model.addColumn(column, true, 150);
column = new TableColumn(1);
//$NON-NLS-1$
column.setHeaderValue(LanguageBundle.getString("in_descrip"));
model.addColumn(column, false, 150);
column = new TableColumn(2);
//$NON-NLS-1$
column.setHeaderValue(LanguageBundle.getString("in_source"));
model.addColumn(column, true, 150);
return model;
}
use of javax.swing.table.TableColumn in project pcgen by PCGen.
the class EquipmentModel method initializeTreeTable.
public static void initializeTreeTable(JTreeTable treeTable) {
treeTable.getTree().setRowHeight(0);
treeTable.setFocusable(false);
treeTable.getTree().putClientProperty("JTree.lineStyle", "Horizontal");
normFont = treeTable.getFont();
headerFont = FontManipulation.title(normFont);
biggerFont = FontManipulation.title(FontManipulation.xxlarge(normFont));
lessFont = FontManipulation.less(normFont);
treeTable.setAutoCreateColumnsFromModel(false);
{
DefaultTableColumnModel model = new DefaultTableColumnModel();
CellRenderer renderer = new CellRenderer();
TableColumn column = new TableColumn(0);
column.setResizable(true);
model.addColumn(column);
model.addColumn(createFixedColumn(1, 75, renderer));
model.addColumn(createFixedColumn(2, 75, renderer));
model.addColumn(createFixedColumn(3, 50, renderer));
model.addColumn(createFixedColumn(4, 50, renderer));
treeTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
treeTable.setColumnModel(model);
treeTable.getTableHeader().setResizingAllowed(false);
}
treeTable.setTreeCellRenderer(new TreeRenderer());
}
use of javax.swing.table.TableColumn in project pcgen by PCGen.
the class CompanionInfoTab method initComponents.
private void initComponents() {
{
DefaultTableColumnModel model = new DefaultTableColumnModel();
TableColumn column = new TableColumn(0);
column.setResizable(true);
model.addColumn(column);
column = new TableColumn(1, 120, new ButtonCellRenderer(), null);
column.setMaxWidth(120);
column.setResizable(false);
model.addColumn(column);
companionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
companionsTable.getTableHeader().setResizingAllowed(false);
companionsTable.setAutoCreateColumnsFromModel(false);
companionsTable.setColumnModel(model);
}
companionsTable.setIntercellSpacing(new Dimension(0, 0));
companionsTable.setFocusable(false);
companionsTable.setRowHeight(23);
companionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
setLeftComponent(new JScrollPane(companionsTable));
JPanel rightPane = new JPanel(new BorderLayout());
infoPane.setOpaque(false);
infoPane.setEditable(false);
infoPane.setFocusable(true);
//$NON-NLS-1$
infoPane.setContentType("text/html");
rightPane.add(new JScrollPane(infoPane), BorderLayout.CENTER);
JPanel buttonPane = new JPanel(new FlowLayout());
buttonPane.add(loadButton);
rightPane.add(buttonPane, BorderLayout.SOUTH);
setRightComponent(rightPane);
}
Aggregations