< prev index next >

application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/common/DataPageToolkit.java

Print this page




 497         }
 498 
 499         public static ItemRow buildTimestampHistogram(
 500                 String title, String description, IItemCollection items, IAggregator<IQuantity, ?> aggregator,
 501                 IAttribute<IQuantity> timestampAttribute, Color color) {
 502                 return new ItemRow(title, description,
 503                                 buildTimestampHistogramRenderer(items, aggregator, timestampAttribute, color), items);
 504         }
 505 
 506         public static ItemRow buildTimestampHistogram(
 507                 String title, String description, IItemCollection items, IAggregator<IQuantity, ?> aggregator, Color color) {
 508                 return new ItemRow(title, description, buildTimestampHistogramRenderer(items, aggregator, color), items);
 509         }
 510 
 511         public static ItemHistogram createDistinctItemsTable(
 512                 Composite parent, IItemCollection items, IItemQuery query, TableSettings settings) {
 513                 CompositeKeyHistogramBuilder histogramBuilder = new CompositeKeyHistogramBuilder();
 514                 for (IAttribute<?> attribute : query.getAttributes()) {
 515                         histogramBuilder.addKeyColumn(attribute);
 516                 }



 517                 ItemHistogram table = histogramBuilder.buildWithoutBorder(parent, settings);
 518                 return table;
 519         }
 520 
 521         public static IBaseLabelProvider createTableHighlightProvider(Pattern highlightPattern, boolean isWarning) {
 522                 return new StyledCellLabelProvider() {
 523                         @Override
 524                         public void update(ViewerCell cell) {
 525                                 org.eclipse.swt.graphics.Color color = isWarning
 526                                                 ? new org.eclipse.swt.graphics.Color(Display.getCurrent(), 240, 120, 140)
 527                                                 : new org.eclipse.swt.graphics.Color(Display.getCurrent(), 255, 144, 4);
 528                                 String text = getText(cell.getElement(), cell.getColumnIndex());
 529                                 Matcher matcher = highlightPattern.matcher(text);
 530                                 if (matcher.find()) {
 531                                         cell.getViewerRow().setBackground(0, color);
 532                                         cell.getViewerRow().setBackground(1, color);
 533                                 }
 534                                 cell.setText(text);
 535                                 super.update(cell);
 536                         }




 497         }
 498 
 499         public static ItemRow buildTimestampHistogram(
 500                 String title, String description, IItemCollection items, IAggregator<IQuantity, ?> aggregator,
 501                 IAttribute<IQuantity> timestampAttribute, Color color) {
 502                 return new ItemRow(title, description,
 503                                 buildTimestampHistogramRenderer(items, aggregator, timestampAttribute, color), items);
 504         }
 505 
 506         public static ItemRow buildTimestampHistogram(
 507                 String title, String description, IItemCollection items, IAggregator<IQuantity, ?> aggregator, Color color) {
 508                 return new ItemRow(title, description, buildTimestampHistogramRenderer(items, aggregator, color), items);
 509         }
 510 
 511         public static ItemHistogram createDistinctItemsTable(
 512                 Composite parent, IItemCollection items, IItemQuery query, TableSettings settings) {
 513                 CompositeKeyHistogramBuilder histogramBuilder = new CompositeKeyHistogramBuilder();
 514                 for (IAttribute<?> attribute : query.getAttributes()) {
 515                         histogramBuilder.addKeyColumn(attribute);
 516                 }
 517                 for (IAggregator<?, ?> aggregator : query.getAggregators()) {
 518                         histogramBuilder.addColumn(aggregator.getName(), aggregator);
 519                 }
 520                 ItemHistogram table = histogramBuilder.buildWithoutBorder(parent, settings);
 521                 return table;
 522         }
 523 
 524         public static IBaseLabelProvider createTableHighlightProvider(Pattern highlightPattern, boolean isWarning) {
 525                 return new StyledCellLabelProvider() {
 526                         @Override
 527                         public void update(ViewerCell cell) {
 528                                 org.eclipse.swt.graphics.Color color = isWarning
 529                                                 ? new org.eclipse.swt.graphics.Color(Display.getCurrent(), 240, 120, 140)
 530                                                 : new org.eclipse.swt.graphics.Color(Display.getCurrent(), 255, 144, 4);
 531                                 String text = getText(cell.getElement(), cell.getColumnIndex());
 532                                 Matcher matcher = highlightPattern.matcher(text);
 533                                 if (matcher.find()) {
 534                                         cell.getViewerRow().setBackground(0, color);
 535                                         cell.getViewerRow().setBackground(1, color);
 536                                 }
 537                                 cell.setText(text);
 538                                 super.update(cell);
 539                         }


< prev index next >