[jface] TableViewer and ContentProvider... [message #48660] |
Tue, 11 March 2003 05:48  |
Eclipse User |
|
|
|
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 18:38   |
Eclipse User |
|
|
|
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 04:21  |
Eclipse User |
|
|
|
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 18:38  |
Eclipse User |
|
|
|
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 04:21  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02741 seconds