Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify better Table widget #11

Open
paulvi opened this issue Nov 1, 2017 · 3 comments
Open

Identify better Table widget #11

paulvi opened this issue Nov 1, 2017 · 3 comments

Comments

@paulvi
Copy link
Collaborator

paulvi commented Nov 1, 2017

There should be some new widget in Eclipse e4 for Table.

In broader sense this issue is about rewrite.

@digulla
Copy link

digulla commented Dec 20, 2017

Why do you need a better table widget?

I think the main problem with the code right now is that it wants to fill in the data for every cell instead of using a lazy model where the table asks for cell data when it needs to render the cell.

@paulvi
Copy link
Collaborator Author

paulvi commented Dec 21, 2017

the main problem with the code right now is that it wants to fill in the data for every cell instead of using a lazy model

That's right. I remember a few years ago saw a project, that was making Table widget with aim to support big databases, where there are 10K-100K and more rows.

There is also no row numbers.

@digulla
Copy link

digulla commented Dec 22, 2017

Example for a lazy TableViewer:
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet029VirtualTableViewer.java

and

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet030VirtualLazyTableViewer.java

If you're using an SWT Table: https://stackoverflow.com/questions/1726331/populating-huge-table-in-swt-jface-rcp-application

To add row numbers, you need to insert a column and supply your own cell renderer. That allows you to render it in a different style.

One of the problems is that the table API has no efficient way to get the row number. The most simple code looks like this:

column.setLabelProvider(new ColumnLabelProvider() { 
    public void update(ViewerCell cell) { 
        cell.setText(table.indexOf((TableItem)cell.getItem())+"") 
    } 
}); 

table.indexOf() is pretty expensive but the UI will remember the values, so it will just be called once per table row.

You may also consider to use a Tree instead of a Table to display the data since Tree supports filtering. See https://eclipsesource.com/blogs/2012/10/26/filtering-tables-in-swtjface/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants