[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform.swt] Problem in using virtual table
|
Hi,
I wrote a customized tableviewer based on virtual table, but I meet some
problems:
In my table viewer,after user inserts new row, all the existing rows become
blank except the row which is inserted. By debugging, I found that when a
new row is inserted to the table, ,my code will do
1)refresh the viewer
2)set the background color for those rows which are read-only
Ok, problems come. When my code call xxxViewer.refresh(), it will call
[private void internalVirtualRefreshAll()] (I implemented this method just
like the org.eclipse.jface.viewers.TableViewer has done, so you can find
this method in the org.eclipse.jface.viewers.TableViewer)
this method will call getTable().clearAll(); this method will clean each
table item if it is cashed.
Ok, after refresh, all items in table are cleaned with attribute cached =
false.
After the refresh operation, my code sets the background color for those
rows which are read-only, but I found that once [public void setBackground
(Color color) ]in TableItem is called, the attribue:cached is set to true
regardless of whether the data (I mean other attributes like:
strings,checked and etc) is really loaded.
Therefore, after refresh and set background color operations, the table
items in my table have following states:
cached =true;
background=xxx;
strings=null;
image=null;
.......
Seeing from the state above, cached is true but strings is null,this state
causes the blank displaying.
For now, I don't how to fix this problem. I try to judget whether the table
item is cached before I set the color, but the there is no API to access the
"cashed" attribute of table item.
Does anybody meet similar problem? Or you have solution for me?
Thanks a lot.