コード例 #1
0
 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);
   }
 }
コード例 #2
0
 public void updateMetricsResults(
     MetricsRun run, 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.setResults(run.getResultsForCategory(category));
     final String shortName = MetricsCategoryNameUtil.getShortNameForCategory(category);
     setRenderers(table, shortName);
     final MetricTableSpecification specification =
         displaySpecification.getSpecification(category);
     setColumnWidths(table, specification);
   }
 }
コード例 #3
0
 private static void setRenderers(JTable table, String type) {
   final MetricTableModel model = (MetricTableModel) table.getModel();
   final MetricInstance[] metrics = model.getMetricsInstances();
   Arrays.sort(metrics, new MetricInstanceAbbreviationComparator());
   final TableColumnModel columnModel = table.getColumnModel();
   for (int i = 0; i < model.getColumnCount(); i++) {
     final String columnName = model.getColumnName(i);
     final TableColumn column = columnModel.getColumn(i);
     if (columnName.equals(type)) {
       column.setCellRenderer(new MetricCellRenderer(null));
       column.setHeaderRenderer(new HeaderRenderer(null, model, SwingConstants.LEFT));
     } else {
       final MetricInstance metricInstance = model.getMetricForColumn(i);
       final TableCellRenderer renderer = new MetricCellRenderer(metricInstance);
       column.setCellRenderer(renderer);
       final Metric metric = metricInstance.getMetric();
       final String displayName = metric.getDisplayName();
       column.setHeaderRenderer(new HeaderRenderer(displayName, model, SwingConstants.RIGHT));
     }
   }
 }
コード例 #4
0
 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;
 }