Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » KTable: Right handling of TableModel
KTable: Right handling of TableModel [message #462850] Thu, 20 October 2005 13:21 Go to next message
Eclipse User
Originally posted by: webapp.gmx.de

Hi,

first I hope this is the right newsgroup for questions about the swt KTable
widget, well, at least I couln't find another ;)

I am new to KTable and so I wonder what's the right way to get the data in
the TableModel. For example JFace viewers are first contructed and
afterwards you set the data via setInput(..). How would I do that with
KTable? Lets assume I want to load some data from database using a business
method which returns the data from db in a list with some valueobjects.

Would I create a setData(...) method on my tablemodel implementation and
transform the data to some kind of hashmap in the tablemodel? Or would the
business call be made within the tablemodel? The examples all come preloaded
so I couln't learn from that ;)

Thanks for suggestions,

Rudolf
Re: KTable: Right handling of TableModel [message #462902 is a reply to message #462850] Thu, 20 October 2005 17:51 Go to previous messageGo to next message
Lorenz Maierhofer is currently offline Lorenz Maierhofer
Messages: 88
Registered: July 2009
Member
Hi,

You definitely want to cache DB content locally in a hashmap or
something similar, since otherwise, every drawing event on the table
would generate a new query on the DB.

Just to be clear:
On every draw event and for the necessary calculations, KTable calls the
tablemodel methods (like getRowCount(), getContent(), ...). So
performance highly depends on the implementation of your tablemodel.
When tablemodel methods are expensive, the table ui will become slow...

regards,
Lorenz


Rudolf Schmidt wrote:
> Hi,
>
> first I hope this is the right newsgroup for questions about the swt KTable
> widget, well, at least I couln't find another ;)
>
> I am new to KTable and so I wonder what's the right way to get the data in
> the TableModel. For example JFace viewers are first contructed and
> afterwards you set the data via setInput(..). How would I do that with
> KTable? Lets assume I want to load some data from database using a business
> method which returns the data from db in a list with some valueobjects.
>
> Would I create a setData(...) method on my tablemodel implementation and
> transform the data to some kind of hashmap in the tablemodel? Or would the
> business call be made within the tablemodel? The examples all come preloaded
> so I couln't learn from that ;)
>
> Thanks for suggestions,
>
> Rudolf
>
>
Re: KTable: Right handling of TableModel [message #462963 is a reply to message #462902] Sun, 23 October 2005 10:17 Go to previous messageGo to next message
Eclipse User
Originally posted by: webapp.gmx.de

Hi,

thanks for your help. It seems that it's advisable to have a setInput()
Method on the tablemodel to refresh the data.

By the way another questions concerning ktable arised. Let's assume I want
to format all cells nearly the same, but different background colours. Seems
thats there two ways to do that. I could either have two different renderers
or one renderer which background attribute changing back and forth in the
doGetCellRenderer Method?

Is there a way to chance the color of the space between the cells. Or is the
only way to do that by subclassing e.g. the textcellrenderer?

Thanks,

Rudolf



"Lorenz Maierhofer" <lorenz.m@gmx.at> schrieb im Newsbeitrag
news:dj8lg8$fs0$1@news.eclipse.org...
> Hi,
>
> You definitely want to cache DB content locally in a hashmap or something
> similar, since otherwise, every drawing event on the table would generate
> a new query on the DB.
>
> Just to be clear:
> On every draw event and for the necessary calculations, KTable calls the
> tablemodel methods (like getRowCount(), getContent(), ...). So performance
> highly depends on the implementation of your tablemodel. When tablemodel
> methods are expensive, the table ui will become slow...
>
> regards,
> Lorenz
>
>
> Rudolf Schmidt wrote:
>> Hi,
>>
>> first I hope this is the right newsgroup for questions about the swt
>> KTable widget, well, at least I couln't find another ;)
>>
>> I am new to KTable and so I wonder what's the right way to get the data
>> in the TableModel. For example JFace viewers are first contructed and
>> afterwards you set the data via setInput(..). How would I do that with
>> KTable? Lets assume I want to load some data from database using a
>> business method which returns the data from db in a list with some
>> valueobjects.
>>
>> Would I create a setData(...) method on my tablemodel implementation and
>> transform the data to some kind of hashmap in the tablemodel? Or would
>> the business call be made within the tablemodel? The examples all come
>> preloaded so I couln't learn from that ;)
>>
>> Thanks for suggestions,
>>
>> Rudolf
Re: KTable: Right handling of TableModel [message #462965 is a reply to message #462963] Sun, 23 October 2005 10:30 Go to previous message
Lorenz Maierhofer is currently offline Lorenz Maierhofer
Messages: 88
Registered: July 2009
Member
Hi,

> By the way another questions concerning ktable arised. Let's assume I want
> to format all cells nearly the same, but different background colours. Seems
> thats there two ways to do that. I could either have two different renderers
> or one renderer which background attribute changing back and forth in the
> doGetCellRenderer Method?

Exactly. Just do as you please.

> Is there a way to chance the color of the space between the cells. Or is the
> only way to do that by subclassing e.g. the textcellrenderer?

You mean the separator lines between the cells?
The only way is to subclass the used render and overwrite
drawDefaultSolidCellLine(). However, note that every cell draws only the
bottom and right cell line.

regards,
Lorenz
Previous Topic:Invalid thread access
Next Topic:EXCEPTION_ACCESS_VIOLATION
Goto Forum:
  


Current Time: Wed Oct 22 22:27:36 GMT 2014

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

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