Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Potential bug in TableViewer with associated VIRTUAL table
Potential bug in TableViewer with associated VIRTUAL table [message #465369] Sun, 11 December 2005 16:29 Go to next message
Eclipse UserFriend
Originally posted by: micasim.gmx.de

Hi,

I'm using jdk1.5.0_03; Eclipse 3.1.1; SWT
org.eclipse.swt.motif.linux.x86_3.1.1.jar

I set up a trivial sample to evaluate TableViewer with a VIRTUAL table
associated.
The content provider is a ILazyContentProvider (see also below).

Running the sample I noticed the following weird behaviour:
When started the first N instances were displayed (as esxpected).
Then I wanted to display the last ones so I pressed the CTRL+END keys.
Now ALL instances not loaded yet were loaded.
Examining a bit more I detected the TableViewer loads all elements
whenever I pressed the CTRL-key.

I guess this is a bug of the TableViewer at least on the motif platform.
Can anyone try my sample on his box to verify this, please?
I will try it on my Windows NT2K box tomorrow.

Please let me know whether this is a known bug.

Kind regards,
Michael
Re: Potential bug in TableViewer with associated VIRTUAL table [message #465370 is a reply to message #465369] Sun, 11 December 2005 16:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: micasim.gmx.de

Sorry,

I've forgotten to attach the source, so here we go:

package de.micasim.vt;

import java.util.ArrayList;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ILazyContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;

/**
* @author michael
*
*/
public class Main extends ApplicationWindow {
private class Exit extends Action {
private ApplicationWindow parent;

public Exit (ApplicationWindow parent) {
super();
this.parent = parent;
setText ("E&xit@Ctrl+Q");
setToolTipText ("Quit the application.");
this.setAccelerator (SWT.CTRL|'Q');
//setImageDescriptor (ImageDescriptor.createFromFile (Main.class,
"exit.png"));
}

/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run () {
parent.close();
}
}
private class Element {
private String oid;
private String descript;
public Element (String id, String description){
super();
oid = id;
descript = description;
}
public String id() {return oid;}
public String description() {return descript;}
}
private class MyLabelProvider extends LabelProvider implements
ITableLabelProvider {
public Image getColumnImage (Object arg0, int arg1) {
return null;
}
public String getColumnText (Object element, int columnIndex) {
switch (columnIndex) {
case 0:
return ((Element)element).id();
case 1:
return ((Element)element).description();
}
return element.toString();
}

}
private class MyContentProvider implements ILazyContentProvider {
public final String[] properties = {"id","description"};
private ArrayList<Element> data;
private TableViewer connectedViewer;
public MyContentProvider (TableViewer viewer) {
super();
connectedViewer = viewer;
data = new ArrayList<Element> (107);
for (int i = 0; i < 100000; i++)
data.add (new Element (Integer.toString(i), "Element #"+i));
}
public void dispose () {}
public void inputChanged (Viewer viewer, Object input, Object oldInput)
{}

/**
* Called when a previously-blank item becomes visible in the
TableViewer.
* @see org.eclipse.jface.viewers.ILazyContentProvider#updateElement (int)
*/
public void updateElement (int index) {
System.out.println ("updateElement ("+index+")");
Element element = data.get (index);
if (element != null)
connectedViewer.replace (element, index);
}
public int contentSize() {
return data.size();
}
}


private Exit exit;
private TableViewer tableViewer;
private MyContentProvider contentProvider;

/**
* @param shell
*/
public Main (Shell shell) {
super (shell);
exit = new Exit (this);
this.addMenuBar();
}



/**
* @see org.eclipse.jface.window.ApplicationWindow#createMenuManager ()
*/
@Override
protected MenuManager createMenuManager () {
MenuManager menubar = new MenuManager();
MenuManager submenu = new MenuManager ("&File");
submenu.add (exit);
menubar.add (submenu);
return menubar;
}



/**
* @see
org.eclipse.jface.window.Window#createContents(org.eclipse.s wt.widgets.Composite)
*/
@Override
protected Control createContents (Composite parentComposite) {
Table table = new Table (parentComposite,
SWT.BORDER|SWT.H_SCROLL|SWT.V_SCROLL|SWT.MULTI|SWT.FULL_SELE CTION|SWT.VIRTUAL);
table.setHeaderVisible (true);
TableColumn column = new TableColumn (table, SWT.NONE);
column.setText ("Name");
column.setWidth (64);
column = new TableColumn (table, SWT.NONE);
column.setText ("Beschreibung");
column.setWidth (128);

tableViewer = new TableViewer (table);
tableViewer.setLabelProvider (new MyLabelProvider());
tableViewer.setContentProvider (contentProvider = new MyContentProvider
(tableViewer));
tableViewer.setColumnProperties (contentProvider.properties);

tableViewer.setItemCount (contentProvider.contentSize());
return table;
}

/**
* @see
org.eclipse.jface.window.ApplicationWindow#configureShell(or g.eclipse.swt.widgets.Shell)
*/
@Override
protected void configureShell (Shell shell) {
super.configureShell (shell);
shell.setSize (640, 480);
}



/**
* @param args
*/
public static void main (String[] args) {
try {
Main appWindow = new Main (null);
appWindow.setBlockOnOpen (true);
appWindow.open ();
} catch (Exception x) {
x.printStackTrace();
}
}

}
Seems to be a bug of Table itself [message #465371 is a reply to message #465369] Sun, 11 December 2005 17:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: micasim.gmx.de

Hi again,

Now I tried Snippet144
( http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet144.java)
with the same result.
When I pressed the CTRL-Key the complete table is filled, so the Snippet
does the output in the SWT.SetData listener for _every_ instance.
I'm really wondering whether this behaviour is on every platform, if so we
won't be able to use VIRTUAL tables.

kind regards,
Michael
Re: Seems to be a bug of Table itself [message #465383 is a reply to message #465371] Mon, 12 December 2005 11:39 Go to previous messageGo to next message
Michael is currently offline MichaelFriend
Messages: 3
Registered: July 2009
Junior Member
Am Sun, 11 Dec 2005 18:05:30 +0100 schrieb Michael Simons <micasim@gmx.de>:

> Hi again,
>
> Now I tried Snippet144
> ( http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet144.java)
> with the same result.
> When I pressed the CTRL-Key the complete table is filled, so the Snippet
> does the output in the SWT.SetData listener for _every_ instance.
> I'm really wondering whether this behaviour is on every platform, if so
> we won't be able to use VIRTUAL tables.
>
> kind regards,
> Michael
>

I've tried it here on my win box (Eclipse 3.1.0), now. The failure does
not occur, so it seems to be a problem of the Linux Motif Platform only.

Should I do a bug report on this?

Regards,
Michael
Re: Seems to be a bug of Table itself [message #465393 is a reply to message #465383] Mon, 12 December 2005 15:36 Go to previous messageGo to next message
Charles Tuckey is currently offline Charles TuckeyFriend
Messages: 18
Registered: July 2009
Junior Member
michael wrote:
> Am Sun, 11 Dec 2005 18:05:30 +0100 schrieb Michael Simons <micasim@gmx.de>:
>
>
> I've tried it here on my win box (Eclipse 3.1.0), now. The failure does
> not occur, so it seems to be a problem of the Linux Motif Platform only.
>

I don't see this problem on Linux with GTK either.

> Should I do a bug report on this?
>
> Regards,
> Michael
>


charlie
Re: Seems to be a bug of Table itself [message #465403 is a reply to message #465393] Mon, 12 December 2005 18:49 Go to previous messageGo to next message
Michael is currently offline MichaelFriend
Messages: 3
Registered: July 2009
Junior Member
Thanks Charlie,

so it seems to only be a problem of Motif. As Motif might not be used very
frequently it's a minor bug.

Michael

Am Mon, 12 Dec 2005 16:36:09 +0100 schrieb Charles Tuckey
<charlest@otii.com>:

>
> michael wrote:
>> Am Sun, 11 Dec 2005 18:05:30 +0100 schrieb Michael Simons
>> <micasim@gmx.de>:
>> I've tried it here on my win box (Eclipse 3.1.0), now. The failure
>> does not occur, so it seems to be a problem of the Linux Motif
>> Platform only.
>>
>
> I don't see this problem on Linux with GTK either.
>
>> Should I do a bug report on this?
>> Regards,
>> Michael
>>
>
>
> charlie
>



--
Erstellt mit M2, Operas revolutionärem E-Mail-Modul:
http://www.opera.com/m2/
Re: Seems to be a bug of Table itself [message #465473 is a reply to message #465383] Wed, 14 December 2005 16:09 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
This was fixed in 3.2 on Motif (back around July 2005).

"michael" <michael.simons@optitool.de> wrote in message
news:op.s1n5b4wu27ug8i@news.eclipse.org...
> Am Sun, 11 Dec 2005 18:05:30 +0100 schrieb Michael Simons
> <micasim@gmx.de>:
>
>> Hi again,
>>
>> Now I tried Snippet144
>> ( http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet144.java)
>> with the same result.
>> When I pressed the CTRL-Key the complete table is filled, so the Snippet
>> does the output in the SWT.SetData listener for _every_ instance.
>> I'm really wondering whether this behaviour is on every platform, if so
>> we won't be able to use VIRTUAL tables.
>>
>> kind regards,
>> Michael
>>
>
> I've tried it here on my win box (Eclipse 3.1.0), now. The failure does
> not occur, so it seems to be a problem of the Linux Motif Platform only.
>
> Should I do a bug report on this?
>
> Regards,
> Michael
>
Previous Topic:How can i determine whether the UI thread has been created?
Next Topic:Calling a C library from a SWT app ?
Goto Forum:
  


Current Time: Thu Sep 19 08:44:26 GMT 2019

Powered by FUDForum. Page generated in 0.02847 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top