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

Bug 494881

Summary: [Control] Changing visibility state using client scripting fails
Product: [RT] RAP Reporter: Sebastian Habenicht <dev>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: ivan, mknauer
Version: 3.1   
Target Milestone: 3.2 M3   
Hardware: PC   
OS: Windows NT   
Whiteboard: sr312

Description Sebastian Habenicht CLA 2016-05-30 04:38:02 EDT
When a hidden control is made visible using client scripting, it cannot be hidden anymore from a server side listener (and the other way around):

protected void createContents(final Composite parent) {

		// control to hide and show
		final Control control = new Composite(parent, SWT.BORDER);
		control.setVisible(false);

		// button
		final Button button = new Button(parent, SWT.NONE);
		button.setText("Hide");

		// add client listener to show label on mouse enter
		String protocolId = WidgetUtil.getId(control);
		String scriptCode = "function handleEvent(event) { var widget = rap.getObject('"
				+ protocolId + "'); widget.setVisible(true); }";
		button.addListener(SWT.MouseEnter, new ClientListener(scriptCode));

		// add listener to hide label on button selection
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				control.setVisible(false);
				// label.getParent().layout(); // ...not necessary, but doesn't
				// help anyway
			}
		});
	}


This code works with 3.0.2, but doesn't with 3.1.0-RC2 (issue can be reproduced since 3.1.0-M1). No problem when using a client listener for both actions (instead of server side listener). Tested in FF, Chrome and IE10.
Comment 1 Ivan Furnadjiev CLA 2016-05-30 06:48:59 EDT
This problem has been introduced in RAP 3.0M1 by preserving the common control properties on demand. It's too late to fix it for 3.1 release. We will address this issue in the first service release.
Comment 2 Ivan Furnadjiev CLA 2016-05-30 11:19:17 EDT
This happens only if the property set by the client scripting is reset back in the same request.
Comment 3 Ivan Furnadjiev CLA 2016-05-30 11:20:50 EDT
... we should not use public setters in ControlOperationHandler.
Comment 4 Ivan Furnadjiev CLA 2016-09-22 07:04:41 EDT
Fixed with change https://git.eclipse.org/r/#/c/81443/
Comment 5 Sebastian Habenicht CLA 2016-09-23 04:31:24 EDT
(In reply to Ivan Furnadjiev from comment #4)
> Fixed with change https://git.eclipse.org/r/#/c/81443/

Thanks for fixing it. Will this be part of the first 3.1 service release?
Comment 6 Ivan Furnadjiev CLA 2016-09-23 04:38:30 EDT
(In reply to Sebastian Habenicht from comment #5)
> (In reply to Ivan Furnadjiev from comment #4)
> > Fixed with change https://git.eclipse.org/r/#/c/81443/
> 
> Thanks for fixing it. Will this be part of the first 3.1 service release?

It's too late for SR1, but we will consider it for SR2.