Community
Participate
Working Groups
Filling of Table works too slow. I need to show to user big log. Yes, I know, that he can not to look at 10000 log lines, but I have filters and sorts for this. But in current implementation resort requires refill of table. And even with small table with about 1000 items it works too slow. In any case, if I have all log records in memory (or in file with fast access speed) I can show this logs record to user fast with concept of "virtual" Table. In Windows it is possible to use so named "virtual" ListView, with style LVS_OWNERDATA. My quick hack of SWT Table shows, that with this style and with implementation of LVN_GETDISPINFO Table works much faster (speed practically does not depend on count of items). I think, that TableViewer with its ContentProvider and LabelProvider is almost all what needed to implement LVN_GETDISPINFO. Can you add support of virtual ListView in Eclipse SWT/JFace?
I would like to see this happen as well. Unfortunately, we will not have time to do this for R2.0. We would need to investigate both the potential ways this could be used by the UI team, as well as the underlying support on all the operating systems which use native tables (Carbon (?), GTK(?), etc.) before deciding on an API. Then we would actually have to implement this API everywhere (including in the emulated implementation for photon and linux/motif). Given how little free time there is, and the fact that the UI team probably would not be able to respond to the changes at this point, it will have to wait. If you want to get involved with implementing this yourself, you should start a discussion on the platform-swt-dev mailing list with the results of investigating the support on the various platforms, plus your suggested API.
Here is source code for Windows. /** * @author Kosta */ package org.eclipse.swt.widgets; import org.eclipse.jface.viewers.ITableLabelProvider; // import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.events.*; public class TableVirtual extends Table { private ITableLabelProvider m_LabelProvider; public TableVirtual(Composite parent, int style) { super(parent, checkStyle(style)); } public void setLabelProvider(ITableLabelProvider labelProvider) { m_LabelProvider = labelProvider; } int widgetStyle() { int bits = super.widgetStyle(); bits |= 0x1000; return bits; } void createItem(TableItem item, int index) { } public void createItems(int cnt) { items = new TableItem[cnt]; for (int i = 0; i < cnt; i++) { LVITEM lvItem = new LVITEM(); lvItem.iItem = i; lvItem.iImage = OS.I_IMAGENONE; lvItem.mask = OS.LVIF_IMAGE; // items[i] = new TableItem(this, SWT.NONE); } // OS.SendMessage(handle, 0x1000 + 47, cnt, 0); } LRESULT wmNotifyChild(int wParam, int lParam) { NMHDR hdr = new NMHDR(); OS.MoveMemory(hdr, lParam, NMHDR.sizeof); switch (hdr.code) { case 0xFFFFFF4F : { NMLISTVIEW pnmlv = new NMLISTVIEW(); OS.MoveMemory(pnmlv, lParam, NMLISTVIEW.sizeof); // int item = pnmlv.iSubItem; int subItem = pnmlv.uNewState; // for image support I need to change SWT native library /*if ((pnmlv.iItem & OS.LVIF_IMAGE) != 0) { if ((m_LabelProvider != null) && (subItem == 0)) { Image image = m_LabelProvider.getColumnImage(new Integer(item), subItem); pnmlv.lParam = imageIndex(image); OS.MoveMemory(lParam, pnmlv, NMLISTVIEW.sizeof); } }*/ if ((pnmlv.iItem & OS.LVIF_TEXT) != 0) { String string; if (m_LabelProvider != null) string = m_LabelProvider.getColumnText(new Integer(item), subItem); else string = ""; TCHAR buffer = new TCHAR (getCodePage(), string, true); int byteCount = buffer.length() * TCHAR.sizeof; OS.MoveMemory(pnmlv.x, buffer, byteCount); } } } // switch return super.wmNotifyChild(wParam, lParam); } public void selectItem(int item) { int state = OS.SendMessage(handle, OS.LVM_GETITEMSTATE, item, OS.LVIS_SELECTED | OS.LVIS_FOCUSED); LVITEM lvItem = new LVITEM(); lvItem.mask = OS.LVIF_STATE; lvItem.stateMask = OS.LVIS_SELECTED | OS.LVIS_FOCUSED; lvItem.state |= OS.LVIS_SELECTED | OS.LVIS_FOCUSED; OS.SendMessage(handle, OS.LVM_SETITEMSTATE, item, lvItem); } }
We should consider this for R3.0.
Moving from Later.
Created attachment 5236 [details] An improved version of TableVirtual - much smaller memory footprint (no TableItems allocated for each row) - allows images for any column
Created attachment 5237 [details] A simple test application to show a virtual table with 1000,000 rows
See also bug 36226 .
What's the status of this PR? Are thre plans for including some sort of virtual table in Eclipse 3.0?
We are hoping to get this into 3.0 but might not make it.
Fixed > 20040317 Investigate SWT.VIRTUAL, SWT.SetData, Table.setItemCount() and Table.clear(). There is a chance we will be changing some of this behavior between now and 3.0. Good luck!
Really fixed.
NOTE: DO NOT USE ANY OF THE CODE THAT IS ATTACHED TO THIS BUG REPORT. The virtual table is supported as a style for the regular table.