Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356434 - Callback method in generated javascript should be wrapped with Delegate
Summary: Callback method in generated javascript should be wrapped with Delegate
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 01:51 EDT by Yun Feng Ma CLA
Modified: 2017-02-23 14:19 EST (History)
2 users (show)

See Also:


Attachments
Patch (1.79 KB, patch)
2011-09-01 02:17 EDT, Yun Feng Ma CLA
lasher: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yun Feng Ma CLA 2011-09-01 01:51:59 EDT
Build Identifier: 

The callback methods in below cases need to be wrapped with Delegate:
1) widget Event handler, such as onClick event handler in Button.
2) Service call returning to method.

Here is a test case for above two cases:
handler demo9 type RUIhandler {initialUI = [ ui ],onConstructionFunction = start, cssFile="css/MyRUI9.css", title="demo9"}
	
	TextField TextField{};

	Button Button{ text = "Click", onClick ::= Button_onClick }; //here the Button_onClick should be wrapped with Delegate in generated javascript
	ui Box{  children = [ Button, TextField ] };
	
	function start()
	end
	
	function Button_onClick(event Event in)
		EchoService9 EchoService9{@bindservice {}};
		call EchoService9.echo() returning to echo1; //here the echo1 should be wrapped with Delegate in generated javascript
	end	
	
	function echo1( retResult string in)
		TextField.text = retResult;
	end
end

If Button_onClick is not wrapped with Delegate in generated javascript, when the Button is clicked, the "this" in method Button_onClick is not demo9, then method "echo1" can not be accessed in Button_onClick.

If echo1 is not wrapped with Delegate in generated javascript, when the Service call returns and the callback method is invoked, the "this" in method echo1 is not demo9, then TextField can not be accessed.

Reproducible: Always
Comment 1 Yun Feng Ma CLA 2011-09-01 02:17:18 EDT
Created attachment 202583 [details]
Patch

Hi Scott and Joe,

Please review the patch. Thanks a lot.
Comment 2 Scott Greer CLA 2011-09-08 22:00:29 EDT
Yun Feng,

I've reviewed the code (but not tested it) and it looks good;  can you test and commit the change, or do you need me to do that?
Comment 3 Yun Feng Ma CLA 2011-09-08 22:43:42 EDT
Hi Scott,

Thanks a lot for the review. The change has been in the stream now. Thanks.

(In reply to comment #2)
> Yun Feng,
> 
> I've reviewed the code (but not tested it) and it looks good;  can you test and
> commit the change, or do you need me to do that?
Comment 4 Scott Greer CLA 2011-09-09 09:28:27 EDT
Yun Feng,

Thanks...I didn't realize it was already committed....I'm going to mark this bug resolved -- please re-open if necessary...thanks.
Comment 5 Yun Feng Ma CLA 2011-10-21 04:22:57 EDT
Verified with build 20111020. close it.