Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to get text contained in KTable's cell?
How to get text contained in KTable's cell? [message #463225] Tue, 01 November 2005 11:09 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi all,

I use KTable's implementation of Table widget, I need to get text
contained in KTable's cell just like in Table's getItem(x). So far I've
come up with KTableModel's getContentAt(x,x) but sometimes in my case the
content of the model does not reflect the content in the cell.

Any ideas ?

Thanks,

Setya
Re: How to get text contained in KTable's cell? [message #463226 is a reply to message #463225] Tue, 01 November 2005 13:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi Setya,

to use the method getContentAt(x,x) is absolutely right. This method is
also used by the table when drawing the data on screen, so there should
really not be any difference between cell content and getContentAt(x,x).

There are a couple of possible reasons though:

- maybe you have calculated the wrong row/column index, mixed up row and
column or have hidden (size 0) rows/columns?

- did you implement your own cell renderer or use s special one that
transformes the content in some way before it renders it?

This is all I can think of at the moment. I would need more information
or a snippet to give you more specific help. In what way does cell
content and getContentAt(x,x)-result differ?

Regards,
Friederich Kupzog

Setya wrote:
> Hi all,
>
> I use KTable's implementation of Table widget, I need to get text
> contained in KTable's cell just like in Table's getItem(x). So far I've
> come up with KTableModel's getContentAt(x,x) but sometimes in my case
> the content of the model does not reflect the content in the cell.
>
> Any ideas ?
>
> Thanks,
>
> Setya
>


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: How to get text contained in KTable's cell? [message #463232 is a reply to message #463226] Wed, 02 November 2005 03:58 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Frederich,

Thank for the response.

> to use the method getContentAt(x,x) is absolutely right. This method is
> also used by the table when drawing the data on screen, so there should
> really not be any difference between cell content and getContentAt(x,x).

> There are a couple of possible reasons though:

> - maybe you have calculated the wrong row/column index, mixed up row and
> column or have hidden (size 0) rows/columns?

This is exactly what I'm trying to find out.

I'm performing GUI testing on which one of the components happens to be
KTable, in my testing I just want to make sure that what users see on the
KTable cells are the right values, so far I always check using KTable's
getContentAt(x,x) which always show the right values and my test will
always pass. But then I won't be able to determine if what users see are
not the same as what the model contains because I've no way to compare the
value in the model with the cells.

> - did you implement your own cell renderer or use s special one that
> transformes the content in some way before it renders it?

Not at all.

> This is all I can think of at the moment. I would need more information
> or a snippet to give you more specific help. In what way does cell
> content and getContentAt(x,x)-result differ?

Actually the use case is, if I change the value of column x the value of
column y should also automatically change accordingly. This is what I want
to make sure through GUI testing.

I also came up with KTable's getCellRect(x,y), but I've no way to extract
the text out of Rectangles.

> Regards,
> Friederich Kupzog

PS: Your KTable is a great component. I can't thank you enough for it.


Thanks,


Setya
Re: How to get text contained in KTable's cell? [message #463271 is a reply to message #463232] Wed, 02 November 2005 08:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi Setya,

now I see your problem, I think. If you change a value programatically,
you have to ensure the table is upated by calling table.redraw(). You
can also redraw specific cells using redraw(rectangle) or redraw(int,
int, int, int).
The table has no way to find out when the model changes, so the model
has to care about the refreshing.

There is no way to get the cell content shown on screen because this is
only rendered pixels.

Hope that helped,
Friederich


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: How to get text contained in KTable's cell? [message #463277 is a reply to message #463271] Wed, 02 November 2005 10:22 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Friederich Kupzog wrote:

> Hi Setya,

> now I see your problem, I think. If you change a value programatically,
> you have to ensure the table is upated by calling table.redraw(). You
> can also redraw specific cells using redraw(rectangle) or redraw(int,
> int, int, int).
> The table has no way to find out when the model changes, so the model
> has to care about the refreshing.

What if I change the value through KTableDefaultModel ? Is there any way
to tell the KTable to refresh itself without having to save reference
directly to KTable in KTableDefaultModel ?

In Swing's JTable I can call fireXXX on JTable's model to achieve this.

> There is no way to get the cell content shown on screen because this is
> only rendered pixels.

Thanks

Setya
Re: How to get text contained in KTable's cell? [message #463281 is a reply to message #463277] Wed, 02 November 2005 10:57 Go to previous message
Lorenz Maierhofer is currently offline Lorenz MaierhoferFriend
Messages: 88
Registered: July 2009
Member
Setya wrote:
> Friederich Kupzog wrote:
>
>> Hi Setya,
>
>
>> now I see your problem, I think. If you change a value
>> programatically, you have to ensure the table is upated by calling
>> table.redraw(). You can also redraw specific cells using
>> redraw(rectangle) or redraw(int, int, int, int).
>> The table has no way to find out when the model changes, so the model
>> has to care about the refreshing.
>
>
> What if I change the value through KTableDefaultModel ? Is there any way
> to tell the KTable to refresh itself without having to save reference
> directly to KTable in KTableDefaultModel ?
> In Swing's JTable I can call fireXXX on JTable's model to achieve this.
>
>> There is no way to get the cell content shown on screen because this
>> is only rendered pixels.

KTableDefaultModel currently does not support refreshing on model
changes. A generic implementation would always just call redraw() and
thus redraw the whole table. If you change only parts of the model, you
might be much more efficient by doing a selective redraw using
redraw(Rectangle).

There might be an example demonstrating changing models (and possibly
some generic code) some time in the future...

regards,
Lorenz
Previous Topic:org.eclipse.swt.SWTException: Invalid thread access
Next Topic:Write Own Event Listeners
Goto Forum:
  


Current Time: Tue Mar 19 04:11:26 GMT 2024

Powered by FUDForum. Page generated in 0.03138 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top