Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Technology Project and PMC » [jface] TableViewer and ContentProvider...
[jface] TableViewer and ContentProvider... [message #48660] Tue, 11 March 2003 10:48 Go to next message
Ozgur Kurt is currently offline Ozgur KurtFriend
Messages: 70
Registered: July 2009
Member
hi all,

i have a table viewer, and i wrote a contentprovider and a labelprovider for
it, but things don't go as i expected. in the method "public Object[]
getElements(Object inputElement)" i return an array of objects, but this
function is not called for each member of the returned array later... this
is confusing, what i'm doing wrong?


thanx,
ozgur
Re: [jface] TableViewer and ContentProvider... [message #48907 is a reply to message #48660] Wed, 12 March 2003 23:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: notvalid.hotmail.com

I am a newbie with SWT, but since I have been working on the exact same
thing here is my explanation which may help.

The array of objects you give to viewer.setInput() will be sent as an array
to the contentprovider's getElements(). Each index of the array will
correspond to a row. The contenprovider in turn sends each object of the
array one at a time, to the labelprovider's method , getImage and getText.
These labelprovider methods iterate over the columns for that row, where the
row is the objecte passed from the contentprovider.

I hope that helps...




"Ozgur Kurt" <ozgurkurt@hotmail.com> wrote in message
news:b4kf5u$hif$1@rogue.oti.com...
> hi all,
>
> i have a table viewer, and i wrote a contentprovider and a labelprovider
for
> it, but things don't go as i expected. in the method "public Object[]
> getElements(Object inputElement)" i return an array of objects, but this
> function is not called for each member of the returned array later... this
> is confusing, what i'm doing wrong?
>
>
> thanx,
> ozgur
>
>
Re: [jface] TableViewer and ContentProvider... [message #49080 is a reply to message #48660] Thu, 13 March 2003 09:21 Go to previous message
Frank Radermacher is currently offline Frank RadermacherFriend
Messages: 33
Registered: July 2009
Member
Hi ozgur,

> i have a table viewer, and i wrote a contentprovider and a labelprovider for
> it, but things don't go as i expected.

> in the method "public Object[] > getElements(Object inputElement)"
> i return an array of objects,
untill here it is ok. The viewer has now one object for every future row
in the table.

> but this function is not called for each member of the returned array later...
"this function" means what?
- getElements which already has been called, or do you mean
- getText of the LabelProvider
which will be called from the viewer once for every object in the
previously received array creating a corresponding row in the table.

In order to understand a bit more you could return a dummy string from
the LabelProvider like return "TestString".
This string should be displayed in every roe of the table.

Frank
Re: [jface] TableViewer and ContentProvider... [message #591566 is a reply to message #48660] Wed, 12 March 2003 23:38 Go to previous message
Eclipse UserFriend
Originally posted by: notvalid.hotmail.com

I am a newbie with SWT, but since I have been working on the exact same
thing here is my explanation which may help.

The array of objects you give to viewer.setInput() will be sent as an array
to the contentprovider's getElements(). Each index of the array will
correspond to a row. The contenprovider in turn sends each object of the
array one at a time, to the labelprovider's method , getImage and getText.
These labelprovider methods iterate over the columns for that row, where the
row is the objecte passed from the contentprovider.

I hope that helps...




"Ozgur Kurt" <ozgurkurt@hotmail.com> wrote in message
news:b4kf5u$hif$1@rogue.oti.com...
> hi all,
>
> i have a table viewer, and i wrote a contentprovider and a labelprovider
for
> it, but things don't go as i expected. in the method "public Object[]
> getElements(Object inputElement)" i return an array of objects, but this
> function is not called for each member of the returned array later... this
> is confusing, what i'm doing wrong?
>
>
> thanx,
> ozgur
>
>
Re: [jface] TableViewer and ContentProvider... [message #591610 is a reply to message #48660] Thu, 13 March 2003 09:21 Go to previous message
Frank Radermacher is currently offline Frank RadermacherFriend
Messages: 33
Registered: July 2009
Member
Hi ozgur,

> i have a table viewer, and i wrote a contentprovider and a labelprovider for
> it, but things don't go as i expected.

> in the method "public Object[] > getElements(Object inputElement)"
> i return an array of objects,
untill here it is ok. The viewer has now one object for every future row
in the table.

> but this function is not called for each member of the returned array later...
"this function" means what?
- getElements which already has been called, or do you mean
- getText of the LabelProvider
which will be called from the viewer once for every object in the
previously received array creating a corresponding row in the table.

In order to understand a bit more you could return a dummy string from
the LabelProvider like return "TestString".
This string should be displayed in every roe of the table.

Frank
Previous Topic:Viewing Simple HTML in SWT
Next Topic:Loading IMAGES into a "fragment" project
Goto Forum:
  


Current Time: Sat Nov 09 02:35:15 GMT 2024

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

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

Back to the top