Class DeferredContentProvider

java.lang.Object
com._1c.g5.v8.dt.common.ui.jface.viewers.deferred.DeferredContentProvider
All Implemented Interfaces:
IContentProvider, ILazyContentProvider

public class DeferredContentProvider extends Object implements ILazyContentProvider
Content provider that performs sorting and filtering in a background thread. Requires a TableViewer created with the SWT.VIRTUAL flag and an IConcurrentModel as input.

The sorter and filter must be set directly on the content provider. Any sorter or filter on the TableViewer will be ignored.

The real implementation is in BackgroundContentProvider. This object is a lightweight wrapper that adapts the algorithm to work with TableViewer.

Since:
3.1
See Also:
  • DeferredContentProvider
  • Constructor Details

    • DeferredContentProvider

      public DeferredContentProvider(Comparator sortOrder)
      Creates a DeferredContentProvider with the given sort order.
      Parameters:
      sortOrder - a comparator that sorts the content, cannot be null
    • DeferredContentProvider

      public DeferredContentProvider(Comparator sortOrder, Object selection)
      Creates a DeferredContentProvider with the given sort order and default selection.
      Parameters:
      sortOrder - a comparator that sorts the content, cannot be null
      selection - object at the table to be selected as initial, can be null
  • Method Details

    • dispose

      public void dispose()
      Specified by:
      dispose in interface IContentProvider
    • inputChanged

      public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
      Specified by:
      inputChanged in interface IContentProvider
    • setSortOrder

      public void setSortOrder(Comparator sortOrder)
      Sets the sort order for this content provider. This sort order takes priority over anything that was supplied to the TableViewer.
      Parameters:
      sortOrder - new sort order. The comparator must be able to support being used in a background thread.
    • setFilter

      public void setFilter(IFilter toSet)
      Sets the filter for this content provider. This filter takes priority over anything that was supplied to the TableViewer. The filter must be capable of being used in a background thread.
      Parameters:
      toSet - filter to set
    • setLimit

      public void setLimit(int limit)
      Sets the maximum number of rows in the table. If the model contains more than this number of elements, only the top elements will be shown based on the current sort order.
      Parameters:
      limit - maximum number of rows to show or -1 if unbounded
    • getLimit

      public int getLimit()
      Returns the current maximum number of rows or -1 if unbounded
      Returns:
      the current maximum number of rows or -1 if unbounded
    • updateElement

      public void updateElement(int element)
      Specified by:
      updateElement in interface ILazyContentProvider