Table updating problems [message #465962] |
Tue, 27 December 2005 02:59 |
Saad Mahamood Messages: 7 Registered: July 2009 |
Junior Member |
|
|
Hello!
I have a 3x3 table, which contains images. When a user types in a query
in search box I have the table reload with new images. However, the
table doesn't show the new images, until I click on the table, and thus
invoking my untyped Listener, which listens for Table cell selections.
I've tried Table.redraw(), Table.update(), but with no luck - The code
for the inserting of images is below:
private void addTableData(ArrayList<Product> pList) throws IOException {
//Remove current data:
prodTable.removeAll();
ArrayList<Image> imageList = new ArrayList<Image>(3);
for(int i = 0; i < pList.size(); i++) {
//Get each Product:
Product prod = pList.get(i);
//Get Product Image:
Image prodImage = new Image(shell.getDisplay(),
new FileInputStream(prod.getImageURL()));
//Add product to imageList ArrayList:
imageList.add(prodImage);
//If imageList size is 3 or i == size of Product List
if(imageList.size() == 3 | i == pList.size() - 1) {
//Copy images to an Image Array:
Image[] images = new Image[imageList.size()];
for(int j=0; j < images.length; j++) {
images[j] = imageList.get(j);
}
//TableItem to table:
TableItem item = new TableItem(prodTable, SWT.NONE);
item.setImage(images);
imageList.removeAll(imageList);
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02837 seconds