< prev index next >
application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/common/DataPageToolkit.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
* v 1.0 as shown at http://oss.oracle.com/licenses/upl
--- 1,8 ----
/*
! * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
! * Copyright (c) 2019, Red Hat Inc. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
* v 1.0 as shown at http://oss.oracle.com/licenses/upl
*** 137,146 ****
--- 138,148 ----
import org.openjdk.jmc.flightrecorder.ui.pages.itemhandler.ItemHandlerPage.ItemHandlerUiStandIn;
import org.openjdk.jmc.flightrecorder.ui.selection.IFilterFlavor;
import org.openjdk.jmc.flightrecorder.ui.selection.SelectionStore.SelectionStoreEntry;
import org.openjdk.jmc.flightrecorder.ui.selection.SelectionStoreActionToolkit;
import org.openjdk.jmc.ui.charts.AWTChartToolkit.IColorProvider;
+ import org.openjdk.jmc.ui.charts.ChartFilterControlBar;
import org.openjdk.jmc.ui.charts.IQuantitySeries;
import org.openjdk.jmc.ui.charts.ISpanSeries;
import org.openjdk.jmc.ui.charts.IXDataRenderer;
import org.openjdk.jmc.ui.charts.QuantitySeries;
import org.openjdk.jmc.ui.charts.RendererToolkit;
*** 153,162 ****
--- 155,165 ----
import org.openjdk.jmc.ui.column.TableSettings;
import org.openjdk.jmc.ui.column.TableSettings.ColumnSettings;
import org.openjdk.jmc.ui.handlers.ActionToolkit;
import org.openjdk.jmc.ui.handlers.MCContextMenuManager;
import org.openjdk.jmc.ui.misc.ChartCanvas;
+ import org.openjdk.jmc.ui.misc.ChartTextCanvas;
import org.openjdk.jmc.ui.misc.CompositeToolkit;
import org.openjdk.jmc.ui.misc.DisplayToolkit;
import org.openjdk.jmc.ui.misc.FilterEditor;
import org.openjdk.jmc.ui.misc.FilterEditor.AttributeValueProvider;
import org.openjdk.jmc.ui.misc.OverlayImageDescriptor;
*** 310,319 ****
--- 313,326 ----
public static void setChart(ChartCanvas canvas, XYChart chart, Consumer<IItemCollection> selectionListener) {
setChart(canvas, chart, selectionListener, null);
}
+ public static void setChart(ChartTextCanvas canvas, XYChart chart, Consumer<IItemCollection> selectionListener) {
+ setChart(canvas, chart, selectionListener, null);
+ }
+
public static void setChart(
ChartCanvas canvas, XYChart chart, Consumer<IItemCollection> selectionListener,
Consumer<IRange<IQuantity>> selectRangeConsumer) {
IMenuManager contextMenu = canvas.getContextMenu();
contextMenu.removeAll();
*** 331,340 ****
--- 338,378 ----
}
});
canvas.setSelectionListener(() -> {
selectionListener.accept(ItemRow.getRangeSelection(chart, JfrAttributes.LIFETIME));
+ IQuantity start = chart.getSelectionStart();
+ IQuantity end = chart.getSelectionEnd();
+ if (selectRangeConsumer != null) {
+ selectRangeConsumer
+ .accept(start != null && end != null ? QuantityRange.createWithEnd(start, end) : null);
+ }
+ });
+ canvas.setChart(chart);
+ }
+
+ public static void setChart(
+ ChartTextCanvas canvas, XYChart chart, Consumer<IItemCollection> selectionListener,
+ Consumer<IRange<IQuantity>> selectRangeConsumer) {
+ IMenuManager contextMenu = canvas.getContextMenu();
+ contextMenu.removeAll();
+ canvas.getContextMenu().add(new Action(Messages.CHART_ZOOM_TO_SELECTED_RANGE) {
+ @Override
+ public void run() {
+ IQuantity selectionStart = chart.getSelectionStart();
+ IQuantity selectionEnd = chart.getSelectionEnd();
+ if (selectionStart == null || selectionEnd == null) {
+ chart.clearVisibleRange();
+ } else {
+ chart.setVisibleRange(selectionStart, selectionEnd);
+ }
+ canvas.redrawChartText();
+ }
+ });
+
+ canvas.setSelectionListener(() -> {
+ selectionListener.accept(ItemRow.getRangeSelection(chart, JfrAttributes.LIFETIME));
IQuantity start = chart.getSelectionStart();
IQuantity end = chart.getSelectionEnd();
if (selectRangeConsumer != null) {
selectRangeConsumer
.accept(start != null && end != null ? QuantityRange.createWithEnd(start, end) : null);
< prev index next >