I’m hoping that this is an easy answer…
-
How do I invoke methods, created in servoy developer method editor, from my client plugin. This is possible right?
-
More specifically, I would like to have the java script methods invoked in response to gui events in the client plugin and bean. Any thoughts?..
Thanks,
Sean
I’ve found this in the scheduler plugin and this would answer question 1:
Function method = (Function) object;
Object args[] = (Object[]) object;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Context context = Context.enter();
try {
method.call(context, method.getParentScope(), method.getParentScope(), args);
} catch (JavaScriptException e) {
e.printStackTrace();
} finally {
Context.exit();
}
}
});
To pass the Function object from the Editor (corresponding to a method) you write the name of the method without the parentheses (ie: write hello, not hello()).
About question 2 I don’t know what to say, I guess it depends on the gui events you’re talking about … if you discover something post it here!
Well this is a start. I have the latest beta but the Scheduler plugin does not come with source code. How did you get it??
The scheduler plugin will contain the source in Servoy 2.1 beta4 (from which the snipped above is a part)
Did you guys got it working, the invokation of Servoy Methods from inside a plugin (without using the jar that the Scheduler plugin uses)?
If so, would you be willing to share some code? ![Very Happy :D]()
Been trying to get it working, but I’m not really getting anywhere…
Paul
The scheduler jar is not needed to invoke methods from a plugin, the opensource scheduler plugin does show how it works .