| Summary: | OwnerData or "virtual" Table support | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Konstantin Scheglov <Konstantin.Scheglov> | ||||||
| Component: | SWT | Assignee: | Steve Northover <snorthov> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | cnagy, eclipse, ed.burnette, gunnar, jpf, snorthov, veronika_irvine, wgoddin, yokeley | ||||||
| Version: | 2.0 | Keywords: | helpwanted | ||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | 37998 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
|
Description
Konstantin Scheglov
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
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. |