Search in sources :

Example 1 with ILegendImageProvider2

use of org.eclipse.tracecompass.tmf.ui.viewers.ILegendImageProvider2 in project tracecompass by tracecompass.

the class TmfChartView method coupleSelectViewer.

/**
 * Method to couple {@link AbstractSelectTreeViewer2} and
 * {@link TmfFilteredXYChartViewer} so that they use the same legend and that
 * the chart listens to selected items in the tree
 */
private void coupleSelectViewer() {
    TmfViewer tree = getLeftChildViewer();
    TmfXYChartViewer chart = getChartViewer();
    if (tree instanceof AbstractSelectTreeViewer2 && chart instanceof TmfFilteredXYChartViewer) {
        ILegendImageProvider2 legendImageProvider = new XYChartLegendImageProvider((TmfCommonXAxisChartViewer) chart);
        AbstractSelectTreeViewer2 selectTree = (AbstractSelectTreeViewer2) tree;
        selectTree.addTreeListener((TmfFilteredXYChartViewer) chart);
        selectTree.setLegendImageProvider(legendImageProvider);
        TriStateFilteredCheckboxTree checkboxTree = selectTree.getTriStateFilteredCheckboxTree();
        checkboxTree.addPreCheckStateListener(new ManyEntriesSelectedDialogPreCheckedListener(checkboxTree));
    }
}
Also used : TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) AbstractSelectTreeViewer2(org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractSelectTreeViewer2) ILegendImageProvider2(org.eclipse.tracecompass.tmf.ui.viewers.ILegendImageProvider2) XYChartLegendImageProvider(org.eclipse.tracecompass.tmf.ui.viewers.xychart.XYChartLegendImageProvider) ManyEntriesSelectedDialogPreCheckedListener(org.eclipse.tracecompass.tmf.ui.views.ManyEntriesSelectedDialogPreCheckedListener) TmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer) TriStateFilteredCheckboxTree(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.TriStateFilteredCheckboxTree) TmfFilteredXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfFilteredXYChartViewer)

Example 2 with ILegendImageProvider2

use of org.eclipse.tracecompass.tmf.ui.viewers.ILegendImageProvider2 in project tracecompass by tracecompass.

the class AbstractSelectTreeViewer2 method getLegendImage.

/**
 * Get the legend image for a entry's ID
 *
 * @param id
 *            the entry's unique ID
 * @return the correctly dimensioned image if there is a legend image provider
 * @since 6.0
 */
protected Image getLegendImage(@NonNull Long id) {
    /* If the image height match the row height, row height will increment */
    ILegendImageProvider2 legendImageProvider = fLegendImageProvider;
    int legendColumnIndex = fLegendIndex;
    if (legendImageProvider != null && legendColumnIndex >= 0) {
        Tree tree = getTreeViewer().getTree();
        int imageWidth = tree.getColumn(legendColumnIndex).getWidth();
        int imageHeight = tree.getItemHeight() - 1;
        if (imageHeight > 0 && imageWidth > 0) {
            return legendImageProvider.getLegendImage(imageHeight, imageWidth, id);
        }
    }
    return null;
}
Also used : ILegendImageProvider2(org.eclipse.tracecompass.tmf.ui.viewers.ILegendImageProvider2) TriStateFilteredCheckboxTree(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.TriStateFilteredCheckboxTree) Tree(org.eclipse.swt.widgets.Tree)

Aggregations

ILegendImageProvider2 (org.eclipse.tracecompass.tmf.ui.viewers.ILegendImageProvider2)2 TriStateFilteredCheckboxTree (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.TriStateFilteredCheckboxTree)2 Tree (org.eclipse.swt.widgets.Tree)1 TmfViewer (org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer)1 AbstractSelectTreeViewer2 (org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractSelectTreeViewer2)1 TmfXYChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer)1 XYChartLegendImageProvider (org.eclipse.tracecompass.tmf.ui.viewers.xychart.XYChartLegendImageProvider)1 TmfFilteredXYChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfFilteredXYChartViewer)1 ManyEntriesSelectedDialogPreCheckedListener (org.eclipse.tracecompass.tmf.ui.views.ManyEntriesSelectedDialogPreCheckedListener)1