jcompagner:
ahh sorry… FunctionDefinition is something from Servoy 5.0
We already have that (it is gotten promoted) because our TreeBean uses it
Add the dbtreeview.jar to your classpath and then you have FunctionDef those are sort of the same thing we have introduced as public api in 5.0
i wasnt talking about the cancel function when i talked about function objects.
its just that everything that comes from a form, thats the formscope or function object shouldnt be kept as hard references in plugins.
Because we could just already have destroyed the formscope and then you are referencing garbage.
About the cancel i just was wondering that.
If i have a long process method. Hows does cancel work? because that will not work. Your cancel method will only be called after the process method is done and returned.
wicket doesnt support multi threaded access to pages.
First wicket ajax part in the browser will only call 1 async method at one time. And if you would call the server at the same time then wicket should block the page access
And even if your method would be called at the same time. Then the process method should really test constantly a variable that the cancel method will be set
Big problem here that this is multi threaded access then to a variable. And the scriptengine doesnt support that.
Thanks for your insight and the detailed answer!
I will have a look at FunctionDef of the TreeViewBean.
But I suppose that for 5.0, I will need to change it to FunctionReference from the Servoy jars?
And about keeping hard references, this means that the web_client_utils should also be revised because it holds a whole Hashtable of callback Functions!
I call the “process” method from the browser with an async call with IClientPluginAccess.executeMethod(), yes - that is why I need the name of a function (and scope) and not the Function.
The cancelFunction is a call to the Rhino Function itself, from an ajax call in Wicket, yes, but synchronously this time.
And yes, the user needs to check a “cancel” variable constantly in the process method, so the whole script involved in a form to make this work is:
[attachment=0]busyScripting.gif[/attachment]
(Sorry about the capture, but I can’t get the “Code” BBCode to work correctly on the forum anymore!)
What you are saying is that if the process navigates to other pages then the callback will not work?
Then yes, of course, you are right, and users should be informed about that.
But as for multi threaded access to a variable, I’m not sure I understand because the variable is not held in the plugin, it is in the form and the access is done by Servoy, not by the plugin, so I guess (I hope) that each session holding its own form variable there is no concurrency problem here, apart from 2 different plugin calling cancel at the same time, bit I don’t see how it could happen.
I’m sure you will understand from the code above how it is working, really.