public void setMetricsResults(MetricDisplaySpecification displaySpecification, MetricsRun run) { final MetricCategory[] categories = MetricCategory.values(); for (final MetricCategory category : categories) { final JTable table = tables.get(category); final String type = MetricsCategoryNameUtil.getShortNameForCategory(category); final MetricTableSpecification tableSpecification = displaySpecification.getSpecification(category); final MetricsResult results = run.getResultsForCategory(category); final MetricTableModel model = new MetricTableModel(results, type, tableSpecification); table.setModel(model); final Container tab = table.getParent().getParent(); if (model.getRowCount() == 0) { tabbedPane.remove(tab); continue; } final String longName = MetricsCategoryNameUtil.getLongNameForCategory(category); tabbedPane.add(tab, longName); final MyColumnListener columnListener = new MyColumnListener(tableSpecification, table); final TableColumnModel columnModel = table.getColumnModel(); columnModel.addColumnModelListener(columnListener); final int columnCount = columnModel.getColumnCount(); for (int i = 0; i < columnCount; i++) { final TableColumn column = columnModel.getColumn(i); column.addPropertyChangeListener(columnListener); } setRenderers(table, type); setColumnWidths(table, tableSpecification); } }
public void removeDiffOverlay(MetricDisplaySpecification displaySpecification) { final MetricCategory[] categories = MetricCategory.values(); for (final MetricCategory category : categories) { final JTable table = tables.get(category); final MetricTableModel model = (MetricTableModel) table.getModel(); model.setPrevResults(null); final Container tab = table.getParent().getParent(); if (model.getRowCount() == 0) { tabbedPane.remove(tab); continue; } final String longName = MetricsCategoryNameUtil.getLongNameForCategory(category); tabbedPane.add(tab, longName); final String shortName = MetricsCategoryNameUtil.getShortNameForCategory(category); setRenderers(table, shortName); final MetricTableSpecification specification = displaySpecification.getSpecification(category); setColumnWidths(table, specification); } hasOverlay = false; }