Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.viewers.deferred
Class DeferredContentProvider


java.lang.Object
  extended by 
org.eclipse.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

Constructor Summary
DeferredContentProvider ( Comparator sortOrder)
          Create a DeferredContentProvider with the given sort order.
 
Method Summary
 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.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeferredContentProvider

public DeferredContentProvider(
Comparator sortOrder)
Create a DeferredContentProvider with the given sort order.

Parameters:
sortOrder - a comparator that sorts the content.
Method Detail

dispose

public void dispose()
Description copied from interface: IContentProvider
Disposes of this content provider. This is called by the viewer when it is disposed.

The viewer should not be updated during this call, as it is in the process of being disposed.

Specified by:
dispose in interface IContentProvider

inputChanged

public void inputChanged(
Viewer viewer,
                         
Object oldInput,
                         
Object newInput)
Description copied from interface: IContentProvider
Notifies this content provider that the given viewer's input has been switched to a different element.

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.

Specified by:
inputChanged in interface IContentProvider
Parameters:
viewer - the viewer
oldInput - the old input element, or null if the viewer did not previously have an input
newInput - the new input element, or null if the viewer does not have an input

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)
Description copied from interface: ILazyContentProvider
Called when a previously-blank item becomes visible in the TableViewer. If the content provider knows the element at this row, it should respond by calling TableViewer#replace(Object, int). NOTE #updateElement(int index) can be used to determine selection values. TableViewer#replace(Object, int) is not called before returning from this method selections may have missing or stale elements. In this situation it is suggested that the selection is asked for again after he update.

Specified by:
updateElement in interface ILazyContentProvider
Parameters:
element - The index that is being updated in the table.

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire