Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Using new TreeViewer 3.1 - LabelProvider Problem
Using new TreeViewer 3.1 - LabelProvider Problem [message #458538] Thu, 14 July 2005 23:01 Go to next message
Agnes Freese is currently offline Agnes FreeseFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,

I am trying to convert from using the TableTreeViewer in 3.01 to the
TreeViewer in 3.1. The TreeViewer appears to have an odd behavior with
respect to its Label Providers.

If I implement an ILabelProvider, and write the getText method within it, it
is called for all of the elements in the tree, including the top level
elements that are returned by the ContentProvider's getElements call.
However, I would assume that I need the ITableLabelProvider because
eventually I will have more than one column in the tree.

But, if I implement an ITableLabelProvider, the getColumnText is never
called for any top level element, it is only called when child elements need
to be drawn. This was not the case with the TableTreeViewer, the
getColumnText was called for the top level elements in addition to the other
elements.

I am wondering if this is normal behavior or a bug, and in any case, how can
I get around this? Any ideas? Has anyone worked with this yet?

Thanks,
Agnes
Re: Using new TreeViewer 3.1 - LabelProvider Problem [message #458548 is a reply to message #458538] Fri, 15 July 2005 16:41 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Agnes Freese:

I never used new TreeViewer with table functionality myself and sure
that someone from SWT team will give you better answer, but for now I
can say that new Tree is custom draw hack, so probably this is why it
requires strings only when it needs them in painting.
Look yourself in Tree source, search for OS.NM_CUSTOMDRAW


> I am trying to convert from using the TableTreeViewer in 3.01 to the
> TreeViewer in 3.1. The TreeViewer appears to have an odd behavior with
> respect to its Label Providers.
>
> If I implement an ILabelProvider, and write the getText method within it, it
> is called for all of the elements in the tree, including the top level
> elements that are returned by the ContentProvider's getElements call.
> However, I would assume that I need the ITableLabelProvider because
> eventually I will have more than one column in the tree.
>
> But, if I implement an ITableLabelProvider, the getColumnText is never
> called for any top level element, it is only called when child elements need
> to be drawn. This was not the case with the TableTreeViewer, the
> getColumnText was called for the top level elements in addition to the other
> elements.
>
> I am wondering if this is normal behavior or a bug, and in any case, how can
> I get around this? Any ideas? Has anyone worked with this yet?
>
> Thanks,
> Agnes
>
>


Konstantin Scheglov,
Google, Inc.
Re: Using new TreeViewer 3.1 - LabelProvider Problem [message #458587 is a reply to message #458548] Sat, 16 July 2005 00:04 Go to previous message
Agnes Freese is currently offline Agnes FreeseFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Konstantin,

As it turned out the problem was with my initialization code. So, this does
actually load correctly.
I implemented ITableLabelProvider and this was called correctly once I fixed
my code. I still have to redo the DND and some other things, but it does
appear to be working for now.

Thanks,
Agnes
"Konstantin Scheglov" <kscheglov@gmail.com> wrote in message
news:db8ovj$mci$1@news.eclipse.org...
> Agnes Freese:
>
> I never used new TreeViewer with table functionality myself and sure
> that someone from SWT team will give you better answer, but for now I
> can say that new Tree is custom draw hack, so probably this is why it
> requires strings only when it needs them in painting.
> Look yourself in Tree source, search for OS.NM_CUSTOMDRAW
>
>
> > I am trying to convert from using the TableTreeViewer in 3.01 to the
> > TreeViewer in 3.1. The TreeViewer appears to have an odd behavior with
> > respect to its Label Providers.
> >
> > If I implement an ILabelProvider, and write the getText method within
it, it
> > is called for all of the elements in the tree, including the top level
> > elements that are returned by the ContentProvider's getElements call.
> > However, I would assume that I need the ITableLabelProvider because
> > eventually I will have more than one column in the tree.
> >
> > But, if I implement an ITableLabelProvider, the getColumnText is never
> > called for any top level element, it is only called when child elements
need
> > to be drawn. This was not the case with the TableTreeViewer, the
> > getColumnText was called for the top level elements in addition to the
other
> > elements.
> >
> > I am wondering if this is normal behavior or a bug, and in any case, how
can
> > I get around this? Any ideas? Has anyone worked with this yet?
> >
> > Thanks,
> > Agnes
> >
> >
Previous Topic:(Eclipse 3.1) Vertical Scrollbar on Tables problem
Next Topic:Laying out a ListViewer
Goto Forum:
  


Current Time: Sun Oct 25 14:33:17 GMT 2020

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

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

Back to the top