Class AbstractTmfTreeViewer

All Implemented Interfaces:
ITmfComponent, ITmfTimeProvider, ITmfViewer, ITmfPinnable
Direct Known Subclasses:
AbstractSegmentsStatisticsViewer, AbstractSelectTreeViewer2

public abstract class AbstractTmfTreeViewer extends TmfTimeViewer
Abstract class for viewers who will display data using a TreeViewer. It automatically synchronizes with time information of the UI. It also implements some common functionalities for all tree viewer, such as managing the column data, content initialization and update. The viewer implementing this does not have to worry about whether some code runs in the UI thread or not.
Author:
Geneviève Bastien
  • Constructor Details

    • AbstractTmfTreeViewer

      public AbstractTmfTreeViewer(org.eclipse.swt.widgets.Composite parent, boolean allowMultiSelect)
      Constructor
      Parameters:
      parent - The parent composite that holds this viewer
      allowMultiSelect - Whether multiple selections are allowed
    • AbstractTmfTreeViewer

      public AbstractTmfTreeViewer(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.viewers.TreeViewer treeViewer)
      Constructor
      Parameters:
      parent - The parent composite that holds this viewer
      treeViewer - The tree viewer to use
      Since:
      3.1
  • Method Details

    • setTreeColumns

      public void setTreeColumns(List<TmfTreeColumnData> columns)
      Sets the tree columns for this tree viewer
      Parameters:
      columns - The tree column data
    • getTreeViewer

      public org.eclipse.jface.viewers.TreeViewer getTreeViewer()
      Get the tree viewer object
      Returns:
      The tree viewer object displayed by this viewer
      Since:
      2.2
    • getControl

      public org.eclipse.swt.widgets.Control getControl()
      Description copied from interface: ITmfViewer
      Returns the primary control associated with this viewer.
      Returns:
      the SWT control which displays this viewer's contents
    • refresh

      public void refresh()
      Description copied from interface: ITmfViewer
      Tells the viewer to refresh its contents.
    • loadTrace

      public void loadTrace(ITmfTrace trace)
      Description copied from class: TmfTimeViewer
      A Method to load a trace into the viewer.
      Overrides:
      loadTrace in class TmfTimeViewer
      Parameters:
      trace - A trace to apply in the viewer
    • getRoot

      public @Nullable TmfTreeViewerEntry getRoot(ITmfTrace trace)
      Gets the root element for the specified trace. Using a fixed root element helps the tree maintain its state when the model is updated or sorted.
      Parameters:
      trace - the trace
      Returns:
      the root element, or null if the trace is closed
      Since:
      6.2
    • setSelection

      public void setSelection(@NonNull List<ITmfTreeViewerEntry> selection)
      Set the currently selected items in the treeviewer
      Parameters:
      selection - The list of selected items
    • addSelectionChangeListener

      public void addSelectionChangeListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
      Add a selection listener to the tree viewer. This will be called when the selection changes and contain all the selected items. The selection change listener can be used like this:
       getTreeViewer().addSelectionChangeListener(new ISelectionChangedListener() {
           @Override
           public void selectionChanged(SelectionChangedEvent event) {
               if (event.getSelection() instanceof IStructuredSelection) {
                   Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
                   if (selection instanceof ITmfTreeViewerEntry) {
                       // Do something
                   }
               }
           }
       });
       
      Parameters:
      listener - The ISelectionChangedListener
    • setAutoExpandLevel

      public void setAutoExpandLevel(int level)
      Sets the auto-expand level to be used for the input of the viewer. The value 0 means that there is no auto-expand; 1 means that top-level elements are expanded, but not their children; 2 means that top-level elements are expanded, and their children, but not grand-children; and so on.

      The value AbstractTreeViewer.ALL_LEVELS means that all subtrees should be expanded.

      Parameters:
      level - non-negative level, or AbstractTreeViewer.ALL_LEVELS to expand all levels of the tree
      Since:
      4.0
    • windowRangeUpdated

      public void windowRangeUpdated(TmfWindowRangeUpdatedSignal signal)
      Signal handler for handling of the window range signal. This time range is the visible zone of the view.
      Overrides:
      windowRangeUpdated in class TmfTimeViewer
      Parameters:
      signal - The TmfWindowRangeUpdatedSignal
    • traceClosed

      public void traceClosed(@Nullable TmfTraceClosedSignal signal)
      Description copied from class: TmfTimeViewer
      Signal handler for handling of the trace closed signal.
      Overrides:
      traceClosed in class TmfTimeViewer
      Parameters:
      signal - The trace closed signal TmfTraceClosedSignal
    • reset

      public void reset()
      Description copied from class: TmfTimeViewer
      Resets the content of the viewer
      Overrides:
      reset in class TmfTimeViewer