Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 280900 - List#showSelection() is missing
Summary: List#showSelection() is missing
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 1.3 M1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-19 07:00 EDT by Rüdiger Herrmann CLA
Modified: 2009-08-06 08:28 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (3.65 KB, patch)
2009-07-30 03:24 EDT, Asen Draganov CLA
no flags Details | Diff
Proposed patch (5.89 KB, patch)
2009-07-31 10:39 EDT, Asen Draganov CLA
b.muskalla: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rüdiger Herrmann CLA 2009-06-19 07:00:05 EDT
The List widget has no showSelection method in RWT
Comment 1 Asen Draganov CLA 2009-07-30 03:24:52 EDT
Created attachment 142984 [details]
Proposed patch
Comment 2 Vasko Tchoumatchenko CLA 2009-07-30 07:56:09 EDT
(In reply to comment #1)
> Created an attachment (id=142984) [details]
> Proposed patch
> 

I found the following two issues, while testing the patch:

1. If showSelection() is called before the List is shown (see the snippet below), the list is not scrolled to the selected item. This works in RCP.

2. Calling list.setBounds() before list.showSelection() produces the following error:

Could not evaluate javascript response: qx.ui.form.ListItem: Element must be created previously!


=== test snippet ===

public class Application implements IEntryPoint {

  public int createUI() {
    Display display = new Display();
    Shell shell = new Shell( display ,SWT.NONE);
    final List list = new List (shell, SWT.BORDER | SWT.V_SCROLL);
    for (int i=0; i<100; i++) list.add ("Item " + i); 
    list.select( 60 );
    list.showSelection();       
    list.setBounds (0, 0, 100, 100);
    
    shell.pack ();
    shell.open();
    while( !shell.isDisposed() ) {
      if( !display.readAndDispatch() ) {
        display.sleep();
      }
    }
    return 0;
  }
}
Comment 3 Vasko Tchoumatchenko CLA 2009-07-31 06:23:21 EDT
This bug blocks Bug 277678
Comment 4 Asen Draganov CLA 2009-07-31 10:39:45 EDT
Created attachment 143147 [details]
Proposed patch

This version of the patch fixes the issues, explained in comment #2.
Comment 5 Vasko Tchoumatchenko CLA 2009-07-31 11:28:24 EDT
(In reply to comment #4)
> Created an attachment (id=143147) [details]
> Proposed patch
> 
> This version of the patch fixes the issues, explained in comment #2.
> 

The patch is an improvement. It fixes issue #2, but issue #1 is not fully resolved. 

Referring to the code in comment 2 - the selected element will be revealed if the method calls are ordered like this:
...
    list.setBounds (0, 0, 100, 100);
    list.showSelection();  
...
If the calls are reordered, the view will not be scrolled to the selected item.

In SWT, both cases work. 

Comment 6 Benjamin Muskalla CLA 2009-08-06 04:54:30 EDT
Applied patch to CVS HEAD with some minor changes (variable names). Added several testcases in List_Test