Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Best practice: how to get the row of a table colored
Best practice: how to get the row of a table colored [message #438566] Sun, 27 June 2004 22:37 Go to next message
Davide is currently offline DavideFriend
Messages: 28
Registered: July 2009
Junior Member
I have read tons of messages in the newsgroup for
this topic, but unfortunately I still haven't found
an handy approach. I'd like to accomplish this from
the JFace TableViewer level, w/o having to dive
to the underling Table instance to to get the list
of TableItem(s) and colore them and then show the table
because this does not address the problem of coloring
the rows added to the table *after* it had been shown.
Another suggested approach was again to get tableitem,
then add a specific class as the paint listener (get the canvas...).
but I think this is anyway not elegant, for the same reasons.
In the API there is the IColorProvider interface:
can we add the instance of a class implementing it somehow (as the
LabelProvider and ContentProvider are added) to the TableViewer?
This could solve any problem at once and e very valuable in
application design where you build over TableViewer your
own complicated, custom viever, yet keep it configurable for
the disparate business objects plugging into it the specific
Label, Content, Color and whatever provider classes

Any hints?
best regards
Re: Best practice: how to get the row of a table colored [message #438608 is a reply to message #438566] Mon, 28 June 2004 17:13 Go to previous messageGo to next message
Jean-Christophe Deprez is currently offline Jean-Christophe DeprezFriend
Messages: 133
Registered: July 2009
Senior Member
>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 6/27/2004, 3:37:18 PM, ak_71@libero.it (Davide) wrote regarding Best
practice: how to get the row of a table colored:

As is all too common in Eclipse there is an instanceof
check that gives you what you want instead of something
visible in the API.

In this case it is an instanceof check in TableViewer
that checks to see if your IContentProvider is an
instanceof IColorProvider, and if it is, calls
getForeground and getBackground. When it
calls them it passes the element which in the
case of a Table should be your row object.

-- d




> I have read tons of messages in the newsgroup for
> this topic, but unfortunately I still haven't found
> an handy approach. I'd like to accomplish this from
> the JFace TableViewer level, w/o having to dive
> to the underling Table instance to to get the list
> of TableItem(s) and colore them and then show the table
> because this does not address the problem of coloring
> the rows added to the table *after* it had been shown.
> Another suggested approach was again to get tableitem,
> then add a specific class as the paint listener (get the canvas...).
> but I think this is anyway not elegant, for the same reasons.
> In the API there is the IColorProvider interface:
> can we add the instance of a class implementing it somehow (as the
> LabelProvider and ContentProvider are added) to the TableViewer?
> This could solve any problem at once and e very valuable in
> application design where you build over TableViewer your
> own complicated, custom viever, yet keep it configurable for
> the disparate business objects plugging into it the specific
> Label, Content, Color and whatever provider classes




> Any hints?
> best regards
Re: Best practice: how to get the row of a table colored [message #438923 is a reply to message #438608] Sat, 03 July 2004 22:15 Go to previous message
Eclipse UserFriend
Originally posted by: ak_71.libero.it

hi nobody, thanks for your answer.
How the hell did you get this? did you dive into the whole
tableviewer code?
Other nice things like this?

Sani
d.

nobody@nowhere.com wrote:

> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

> On 6/27/2004, 3:37:18 PM, ak_71@libero.it (Davide) wrote regarding Best
> practice: how to get the row of a table colored:

> As is all too common in Eclipse there is an instanceof
> check that gives you what you want instead of something
> visible in the API.

> In this case it is an instanceof check in TableViewer
> that checks to see if your IContentProvider is an
> instanceof IColorProvider, and if it is, calls
> getForeground and getBackground. When it
> calls them it passes the element which in the
> case of a Table should be your row object.

> -- d




> > I have read tons of messages in the newsgroup for
> > this topic, but unfortunately I still haven't found
> > an handy approach. I'd like to accomplish this from
> > the JFace TableViewer level, w/o having to dive
> > to the underling Table instance to to get the list
> > of TableItem(s) and colore them and then show the table
> > because this does not address the problem of coloring
> > the rows added to the table *after* it had been shown.
> > Another suggested approach was again to get tableitem,
> > then add a specific class as the paint listener (get the canvas...).
> > but I think this is anyway not elegant, for the same reasons.
> > In the API there is the IColorProvider interface:
> > can we add the instance of a class implementing it somehow (as the
> > LabelProvider and ContentProvider are added) to the TableViewer?
> > This could solve any problem at once and e very valuable in
> > application design where you build over TableViewer your
> > own complicated, custom viever, yet keep it configurable for
> > the disparate business objects plugging into it the specific
> > Label, Content, Color and whatever provider classes




> > Any hints?
> > best regards
Previous Topic:Wizard and TableTreeEditor problems
Next Topic:Real Swing
Goto Forum:
  


Current Time: Fri Apr 26 05:08:27 GMT 2024

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

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

Back to the top