use of org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColumnHeaderVerticalRenderer in project EnrichmentMapApp by BaderLab.
the class HeatMapMainPanel method createTableHeader.
private void createTableHeader(int expressionColumnWidth) {
JTableHeader header = table.getTableHeader();
header.setReorderingAllowed(false);
HeatMapTableModel tableModel = (HeatMapTableModel) table.getModel();
TableColumnModel columnModel = table.getColumnModel();
TableCellRenderer vertRenderer = new ColumnHeaderVerticalRenderer();
TableCellRenderer vertRendererPheno1 = new ColumnHeaderVerticalRenderer(EMStyleBuilder.Colors.LIGHTEST_PHENOTYPE_1);
TableCellRenderer vertRendererPheno2 = new ColumnHeaderVerticalRenderer(EMStyleBuilder.Colors.LIGHTEST_PHENOTYPE_2);
TableColumn rankColumn = columnModel.getColumn(HeatMapTableModel.RANK_COL);
rankColumn.setHeaderRenderer(columnHeaderRankOptionRendererFactory.create(this, HeatMapTableModel.RANK_COL));
rankColumn.setPreferredWidth(100);
((TableRowSorter<?>) table.getRowSorter()).setSortable(HeatMapTableModel.RANK_COL, false);
int colCount = tableModel.getColumnCount();
for (int col = HeatMapTableModel.DESC_COL_COUNT; col < colCount; col++) {
EMDataSet dataset = tableModel.getDataSet(col);
String pheno1 = dataset.getEnrichments().getPhenotype1();
String pheno2 = dataset.getEnrichments().getPhenotype2();
Optional<String> pheno = tableModel.getPhenotype(col);
TableCellRenderer renderer;
if (pheno.filter(p -> p.equals(pheno1)).isPresent())
renderer = vertRendererPheno1;
else if (pheno.filter(p -> p.equals(pheno2)).isPresent())
renderer = vertRendererPheno2;
else
renderer = vertRenderer;
TableColumn column = columnModel.getColumn(col);
column.setHeaderRenderer(renderer);
column.setPreferredWidth(expressionColumnWidth);
}
}
Aggregations