Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 300681

Summary: Mouseover highlighting of List's in ExpandItem's fails with new list model
Product: [RT] RAP Reporter: Sascha Becher <s.becher>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: minor    
Priority: P3    
Version: 1.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Entry point used to reproduce the bug none

Description Sascha Becher CLA 2010-01-25 09:46:48 EST
I've copied the menu (on the left) of the RAP online demo:
http://rap.eclipsesource.com/rapdemo/examples#Buttons

this.mainExpandBar = new ExpandBar(parent, SWT.V_SCROLL);
this.mainExpandBar.setSpacing(4);
this.expandItem = new ExpandItem(this.expandBar, SWT.NONE);
this.expandItem.setText("Title"); // title of expand item

this.menuList = new List(this.expandBar, SWT.SINGLE);
this.menuList.add("Item 1");
this.menuList.add("Item 2");
redrawItem();

// the ExpandItems's onmouseover hovering effect works fine

this.menuList = new List(this.expandBar, SWT.SINGLE);
this.menuList.add("Item 3");
this.menuList.add("Item 4");
this.menuList.add("Item 5");
this.menuList.add("Item 6");
redrawItem();

// the onmouseover hovering works only in the area of the previously set List (on 'Item 3' and 'Item 4')

public void redrawItem() {
  this.menuList.setData(WidgetUtil.CUSTOM_VARIANT, "EXAMPLES"); //$NON-NLS-1$
  this.expandItem.setControl(this.menuList);
  int height = (this.menuList.getItemHeight() + 2) * this.menuList.getItemCount();
  this.expandItem.setHeight(height);
  this.expandItem.setExpanded(true);

  // desperately updating, doesn't change anything
  this.expandBar.update();
  this.expandBar.redraw();
  this.expandBar.layout();

}

It seems, the area responsible for onmouseover events doesn't get updated when the List is changed.

Additionally I had to add +2 to the height of the item. Otherwise the initial List hadn't the right height when drawn first. When redrawing the List with another list model, the +2 offset isn't required anymore and makes the list appear 2 pixels per line greater than needed. This happens only in Eclipse's internal web browser. In Firefox (3.5) and Internet Explorer (7) the offset isn't required at all.
Comment 1 Sascha Becher CLA 2010-01-25 09:48:44 EST
The problem with hovering appears in Firefox, IE and Eclipse's internal webbrowser.
Comment 2 Ivan Furnadjiev CLA 2010-02-16 05:31:58 EST
Created attachment 159161 [details]
Entry point used to reproduce the bug

With this entry point I can't reproduce the bug with current CVS HEAD. About the 2px issue - this is a TextSizeDetermination problem. Use this snippet from NavigationView to workaround it:
---------
    // workaround to apply TextSizeDetermination results
    parent.addControlListener( new ControlAdapter() {
      public void controlResized( final ControlEvent e ) {
        ExpandItem[] items = expandBar.getItems();
        for( int i = 0; i < items.length; i++ ) {
          ExpandItem item = items[ i ];
          List list = ( List )item.getControl();
          item.setHeight( list.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y );
        }
      }
    } );
 --------------
Comment 3 Ivan Furnadjiev CLA 2010-02-16 05:42:14 EST
Please reopen if you have a complete snippet (entry point or project) to reproduce the bug.