Bug 344835 - Bad Scrollbar behavior for the first open of an editor
Summary: Bad Scrollbar behavior for the first open of an editor
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: Workbench (show other bugs)
Version: 1.4   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-05 09:12 EDT by Arnaud MERGEY CLA
Modified: 2014-05-13 06:02 EDT (History)
1 user (show)

See Also:


Attachments
first open, with bad scrollbar behavior (5.37 KB, image/png)
2011-05-05 09:13 EDT, Arnaud MERGEY CLA
no flags Details
other open, after first, with expected behavior (4.54 KB, image/png)
2011-05-05 09:16 EDT, Arnaud MERGEY CLA
no flags Details
The full RAP application that can be launched to reproduce the issue (20.58 KB, application/octet-stream)
2011-05-05 09:21 EDT, Arnaud MERGEY CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.