Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » TableViewer Reveal / setSelection(....,true)
TableViewer Reveal / setSelection(....,true) [message #89879] Mon, 26 May 2008 04:11 Go to next message
Eclipse UserFriend
Hi,
it seems that the reveal method of the table viewer does not work correctly
if these methods are called when the viewer is create (i.e. in method
createPartControl). Doing it there the correct element is selected, but not
revealed. The viewer seems to be position about two items to low!
You can reproduce the problem by changing DemoTableViewPart to have 240 rows
(just a numbe I used for my tests) and calling the following code right
after getSite().setSelectionProvider(viewer):

Object element = buffer.get(buffer.size() -30);
viewer.setSelection(new StructuredSelection(element), true);
viewer.reveal(element);

Calling these methods by an additional button will do a correct reveal, but
that doesn't help, if you want to initially select an item and reveal it.

Regards,
Markus
Re: TableViewer Reveal / setSelection(....,true) [message #89924 is a reply to message #89879] Mon, 26 May 2008 04:50 Go to previous messageGo to next message
Eclipse UserFriend
Hi Markus,

although this isn't the answer to your question: If your TableViewer is
Virtual and you're dealing with a larger amount of data, I would NOT
recommend to use TableViewer#setSelection. This is because the current
(JFace and RAP) implementation starts getting all elements from the model
in setSelection().

This means, that
- each model element is fetched and kept in memory, even if only the first
item should be selected.
- for each model element a TableItem is rendered to the browser which
decreases browser performance.

Instead, you can set the selection on the RWT layer using
TableViewer.getTable.setSelection, however, the JFace Selection events
aren't fired in this case.

Regards,
Stefan.
Re: TableViewer Reveal / setSelection(....,true) [message #90147 is a reply to message #89879] Mon, 26 May 2008 18:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Hi Markus,

what do you mean with 'seems to be position about two items to low'?
Is the item visible but not at the position you would expected it,
or isn't it visible at all?
The documentation only states that reveal 'ensures that the given
element is visible'.
However, feel free to open a bugzilla if the item isn't visible at
all or you think it should show at a different position.

Cheers,
Rüdiger

Markus Krüger wrote:
> Hi,
> it seems that the reveal method of the table viewer does not work correctly
> if these methods are called when the viewer is create (i.e. in method
> createPartControl). Doing it there the correct element is selected, but not
> revealed. The viewer seems to be position about two items to low!
> You can reproduce the problem by changing DemoTableViewPart to have 240 rows
> (just a numbe I used for my tests) and calling the following code right
> after getSite().setSelectionProvider(viewer):
>
> Object element = buffer.get(buffer.size() -30);
> viewer.setSelection(new StructuredSelection(element), true);
> viewer.reveal(element);
>
> Calling these methods by an additional button will do a correct reveal, but
> that doesn't help, if you want to initially select an item and reveal it.
>
> Regards,
> Markus
>
>
Re: TableViewer Reveal / setSelection(....,true) [message #90177 is a reply to message #89879] Tue, 27 May 2008 02:04 Go to previous messageGo to next message
Eclipse UserFriend
Your first code already reveals because you are passing true so why
calling reveal.

Tom

Markus Krüger schrieb:
> Hi,
> it seems that the reveal method of the table viewer does not work correctly
> if these methods are called when the viewer is create (i.e. in method
> createPartControl). Doing it there the correct element is selected, but not
> revealed. The viewer seems to be position about two items to low!
> You can reproduce the problem by changing DemoTableViewPart to have 240 rows
> (just a numbe I used for my tests) and calling the following code right
> after getSite().setSelectionProvider(viewer):
>
> Object element = buffer.get(buffer.size() -30);
> viewer.setSelection(new StructuredSelection(element), true);
> viewer.reveal(element);
>
> Calling these methods by an additional button will do a correct reveal, but
> that doesn't help, if you want to initially select an item and reveal it.
>
> Regards,
> Markus
>
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: TableViewer Reveal / setSelection(....,true) [message #90231 is a reply to message #90177] Tue, 27 May 2008 05:05 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I just wanted to be sure that reveal is done. In my final implementation
only viewer.setSelection(new StructuredSelection(element), true);
would be done, but thanks for your comment.

Regards,
Markus

"Tom Schindl" <tom.schindl@bestsolution.at> schrieb im Newsbeitrag
news:g1g8ac$3q5$1@build.eclipse.org...
> Your first code already reveals because you are passing true so why
> calling reveal.
>
> Tom
>
> Markus Kr
Re: TableViewer Reveal / setSelection(....,true) [message #90246 is a reply to message #90147] Tue, 27 May 2008 05:06 Go to previous message
Eclipse UserFriend
Hi,

it does not reveal at all. 'seems to be position about two items to low'
means, that if I scroll about two items up, then I can see the item.
I will open a bug on this.

Regards,
Markus

"R
Previous Topic:Too many open files in Tomcat-Log
Next Topic:register binary resources via IResource
Goto Forum:
  


Current Time: Sat Jul 12 22:39:36 EDT 2025

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

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

Back to the top