[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: TableViewer SWT.VIRTUAL
|
Support for TableViewer with the style SWT.VIRTUAL was added in 3.1 M5.
Take a look at ILazyContentProvider and DeferredContentProvider
I only work on the SWT side, not on the JFace side so I can't help very
much. The best place to get answers about JFace API is in the
eclipse.platform newsgroup.
news://news.eclipse.org/eclipse.platform
I poked around Eclipse and could not find an example in the plugins
themselves but I did find a test application that uses the new
ILazyContentProvider.
For example, in the plugin org.eclipse.ui.tests (You need to check this out
of CVS, I did not see it included in any downloads - has lots of simple
examples of using JFace API) look at the class
org.jface.tests.viewers.TestLazyModelContentProvider:
/*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying material
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.tests.viewers;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILazyContentProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
/**
* The TestLazyModelContentProvider is the lazy version
* of the model content provider.
*/
public class TestLazyModelContentProvider extends TestModelContentProvider
implements ILazyContentProvider, IContentProvider {
TableViewerTest test;
TestElement input;
TestLazyModelContentProvider(TableViewerTest testObject){
test = testObject;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILazyContentProvider#updateElements(int,
int)
*/
public void updateElement(int index) {
if(input == null)
return; //Nothing to update yet
((TableViewer) test.fViewer).replace(input.getChildAt(index), index);
}
/* (non-Javadoc)
* @see org.eclipse.jface.tests.viewers.TestModelContentProvider#dispose()
*/
public void dispose() {
super.dispose();
}
/* (non-Javadoc)
* @see
org.eclipse.jface.tests.viewers.TestModelContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
input = (TestElement) newInput;
super.inputChanged(viewer, oldInput, newInput);
}
/* (non-Javadoc)
* @see
org.eclipse.jface.tests.viewers.TestModelContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object element) {
Assert.isTrue(false,"Should not ever call getElements if lazy");
return super.getElements(element);
}
}
"Stefano Zaccaria" <szaccaria@xxxxxxxxxxxx> wrote in message
news:d04g25$1tv$1@xxxxxxxxxxxxxxxxxx
> Hello to all,
> Can any body help me with TableViewer and SWT.VIRTUAL.
>
> I want to use a large table ( 100.000 rows ) in my program, but when I use
> the Jface TableViewer the load of the table is very slow.
> I read that whit the TableViewer SWT.VIRTUAL, the load is too fast. I try
> put the SWT.VIRTUAL in the defition of the table, but it not fuction very
> well. If some body give me a litle piece of code I very grateful to him.
>
> Thank very much.
>
> Stefano
>
>