Runtime issue on rendering images in table? [message #656208] |
Thu, 24 February 2011 15:00 |
Bassspieler Messages: 40 Registered: April 2010 Location: Germany |
Member |
|
|
Hi RAP-Addicts!
I've got an interesting challenge. I've got a table with a special column. On this column I've added a label provider that overides 'getImage'. The returned image is dynamically created based on the column's width.
The interesting point is, that I have added a listener on the column to get notified, when the user resizes the column. When that is the case, I refresh the table viewer. This re-calls the label provider's getImage-method and a new image with the adjusted width is created and returned.
Sadly, this doesn't work quite well. At the end of the process, the column is wider or smaller and also the image that is returned has the correct size. But it seems that somehow the RAP-part that is drawing the cell did not recognize, that the size of the image changed. So the space the image takes within the cell stays the same, although the widths of column and image have changed.
This looks quite awkward, because the new bigger image is rendered centered in the provided space/place for the image.
Did I oversee something important? Or is this some case of RAP-bug?
The fact that made me think the fault is on my side is, that my table is not that simple. There are lots of columns that contain these dynamic images and the described resizing bug of the table is there, but on the first dynamic-image-column everything works as I expected it to be. So technically my code seems to work. But it doesn't for the rest of dynamic-image-columns.
So maybe it's some kind of runtime issue with rendering images of columns of a table?
|
|
|
Re: Runtime issue on rendering images in table? [message #656222 is a reply to message #656208] |
Thu, 24 February 2011 15:22 |
Ivan Furnadjiev Messages: 2426 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi Bassspieler,
did you run your code in RCP (SWT) :-)? I think that you will get the
same results there. This is a know behavior of SWT (Windows) Table and
for good or bad RAP tries to behave the same. The space for the image is
calculated when you set the image for the first time (in one TableItem)
and it is not changed later if you set a bigger or smaller image. There
is one possible solution - call Table#clearAll() before setting the new
image. Of course, you have to populate all TableItems data again - text,
images, checked and greyed states.
HTH,
Ivan
On 2/24/2011 5:00 PM, Bassspieler wrote:
> Hi RAP-Addicts!
>
> I've got an interesting challenge. I've got a table with a special
> column. On this column I've added a label provider that overides
> 'getImage'. The returned image is dynamically created based on the
> column's width.
>
> The interesting point is, that I have added a listener on the column
> to get notified, when the user resizes the column. When that is the
> case, I refresh the table viewer. This re-calls the label provider's
> getImage-method and a new image with the adjusted width is created and
> returned.
>
> Sadly, this doesn't work quite well. At the end of the process, the
> column is wider or smaller and also the image that is returned has the
> correct size. But it seems that somehow the RAP-part that is drawing
> the cell did not recognize, that the size of the image changed. So the
> space the image takes within the cell stays the same, although the
> widths of column and image have changed.
> This looks quite awkward, because the new bigger image is rendered
> centered in the provided space/place for the image.
>
> Did I oversee something important? Or is this some case of RAP-bug?
>
> The fact that made me think the fault is on my side is, that my table
> is not that simple. There are lots of columns that contain these
> dynamic images and the described resizing bug of the table is there,
> but on the first dynamic-image-column everything works as I expected
> it to be. So technically my code seems to work. But it doesn't for the
> rest of dynamic-image-columns.
>
> So maybe it's some kind of runtime issue with rendering images of
> columns of a table?
|
|
|
|
Powered by
FUDForum. Page generated in 0.03978 seconds