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

Bug 344835

Summary: Bad Scrollbar behavior for the first open of an editor
Product: [RT] RAP Reporter: Arnaud MERGEY <a_mergey>
Component: WorkbenchAssignee: Project Inbox <rap-inbox>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: roger.godbout
Version: 1.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
first open, with bad scrollbar behavior
none
other open, after first, with expected behavior
none
The full RAP application that can be launched to reproduce the issue none

Description Arnaud MERGEY CLA 2011-05-05 09:12:32 EDT
A simple snippet to reproduce the issue:

With sample form page provided (code above), with a scrollable table with many rows

The first  time the editor is opened, a vertical scrollbar appear on the whole editor and the table.
The table scroll bar is expected, the editor scrollbar is not and should not be here.

Strange thing is if the editor is closed and reopened, then we have only the table scrollbar as expected. 
The only way to have the issue again is to restart the application.

I have this behavior with chrome FF and IE

public class EditorPage extends FormPage {

	public EditorPage(FormEditor editor, String id, String title) {
		super(editor, id, title);
	}

	@Override
	protected void createFormContent(IManagedForm managedForm) {
		FormToolkit toolkit = managedForm.getToolkit();
		ScrolledForm form = managedForm.getForm();
		
		//body
		form.setText("My Form Page");
		Composite body = form.getBody();
		toolkit.decorateFormHeading(form.getForm());
		GridLayout globalGridLayout = new GridLayout();
		globalGridLayout.numColumns = 1;
		body.setLayout(globalGridLayout);
		
		//a Table viewer
		TableViewer tableViewer = new TableViewer(toolkit.createTable(body, SWT.MULTI
				| SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER));
		tableViewer.getTable().setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true));
		tableViewer.getTable().setLinesVisible(true);
		tableViewer.getTable().setHeaderVisible(true);

		tableViewer.setContentProvider(new ArrayContentProvider());
		tableViewer.setLabelProvider(new LabelProvider());
		
		//inputs
		int size=200;
		List<String> list=new ArrayList<String>(size);
		for (int i = 0; i < size; i++) {
			list.add("Data_"+i);
		}
		tableViewer.setInput(list);
	}

}
Comment 1 Arnaud MERGEY CLA 2011-05-05 09:13:44 EDT
Created attachment 194825 [details]
first open, with bad scrollbar behavior
Comment 2 Arnaud MERGEY CLA 2011-05-05 09:16:57 EDT
Created attachment 194827 [details]
other open, after first, with expected behavior
Comment 3 Arnaud MERGEY CLA 2011-05-05 09:21:40 EDT
Created attachment 194828 [details]
The full RAP application that can be launched to reproduce the issue

- launch snippet.scrolling.launch
- on the left view double-click on any node to open the editor
- the first time you should see wrong scrollbars
- then close the editor and reopen it, you should now see expected scrollbars
Comment 4 Ivan Furnadjiev CLA 2011-05-05 09:41:39 EDT
I can reproduce it with your snippet and CVS HEAD.
Comment 5 Arnaud MERGEY CLA 2011-08-04 05:33:48 EDT
Just inform people facing this issue, as a workaround, setting a width and eight to the GridData solve the issue.

for example in my snippet if 

tableViewer.getTable().setLayoutData(
new GridData(SWT.FILL, SWT.FILL, true, true));

must be replaced with

GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
layoutData.widthHint = 42;
layoutData.heightHint = 42;
tableViewer.getTable().setLayoutData(layoutData);
Comment 6 Ivan Furnadjiev CLA 2014-05-13 06:02:47 EDT
Still valid with RAP 2.3M3. When you open the editor for the first time editor scrollbar is shown, the second time table scrollbar. Probably related to text size determination.