public class DeferredContentProvider extends Object implements ILazyContentProvider
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
.
Constructor and Description |
---|
DeferredContentProvider(Comparator sortOrder)
Create a DeferredContentProvider with the given sort order.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of this content provider.
|
int |
getLimit()
Returns the current maximum number of rows or -1 if unbounded
|
void |
inputChanged(Viewer viewer,
Object oldInput,
Object newInput)
Notifies this content provider that the given viewer's input
has been switched to a different element.
|
void |
setFilter(IFilter toSet)
Sets the filter for this content provider.
|
void |
setLimit(int limit)
Sets the maximum number of rows in the table.
|
void |
setSortOrder(Comparator sortOrder)
Sets the sort order for this content provider.
|
void |
updateElement(int element)
Called when a previously-blank item becomes visible in the
TableViewer.
|
public DeferredContentProvider(Comparator sortOrder)
sortOrder
- a comparator that sorts the content.public void dispose()
IContentProvider
The viewer should not be updated during this call, as it is in the process of being disposed.
The default implementation does nothing.
dispose
in interface IContentProvider
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
IContentProvider
A typical use for this method is registering the content provider as a listener to changes on the new input (using model-specific means), and deregistering the viewer from the old input. In response to these change notifications, the content provider should update the viewer (see the add, remove, update and refresh methods on the viewers).
The viewer should not be updated during this call, as it might be in the process of being disposed.
The default implementation does nothing.
inputChanged
in interface IContentProvider
viewer
- the vieweroldInput
- the old input element, or null
if the viewer
did not previously have an inputnewInput
- the new input element, or null
if the viewer
does not have an inputpublic void setSortOrder(Comparator sortOrder)
TableViewer
.sortOrder
- new sort order. The comparator must be able to support being
used in a background thread.public void setFilter(IFilter toSet)
TableViewer
. The filter
must be capable of being used in a background thread.toSet
- filter to setpublic void setLimit(int limit)
limit
- maximum number of rows to show or -1 if unboundedpublic int getLimit()
public void updateElement(int element)
ILazyContentProvider
updateElement
in interface ILazyContentProvider
element
- The index that is being updated in the
table.
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.