use of com.servoy.j2db.persistence.ScriptMethod in project servoy-client by Servoy.
the class EventCallTest method fillTestSolution.
@Override
protected void fillTestSolution() throws ServoyException {
Form form = solution.createNewForm(validator, null, "test", null, false, new Dimension(600, 400));
form.setNavigatorID(-1);
form.createNewScriptVariable(DummyValidator.INSTANCE, "testVar", IColumnTypes.INTEGER);
GraphicalComponent button = form.createNewGraphicalComponent(new Point(10, 10));
button.setShowClick(true);
button.setShowFocus(true);
ScriptMethod sm = form.createNewScriptMethod(DummyValidator.INSTANCE, "test");
sm.setDeclaration("function test() {testVar = 10}");
button.setOnActionMethodID(sm.getID());
form.createNewScriptVariable(DummyValidator.INSTANCE, "testVar2", IColumnTypes.TEXT);
GraphicalComponent button2 = form.createNewGraphicalComponent(new Point(10, 10));
button2.setName(uuid);
button2.setShowClick(true);
button2.setShowFocus(true);
ScriptMethod sm2 = form.createNewScriptMethod(DummyValidator.INSTANCE, "test2");
sm2.setDeclaration("function test2() {testVar2 = elements['" + uuid + "'].getName()}");
button2.setOnActionMethodID(sm2.getID());
}
use of com.servoy.j2db.persistence.ScriptMethod in project servoy-client by Servoy.
the class JSForm method js_setOnOmitRecordCmdMethod.
/**
* @deprecated As of release 4.1, replaced by setOnOmitRecordCmd(JSMethod).
*/
@Deprecated
public void js_setOnOmitRecordCmdMethod(Object functionOrInteger) {
checkModification();
if (functionOrInteger instanceof Function) {
Function function = (Function) functionOrInteger;
ScriptMethod scriptMethod = getScriptMethod(function, application.getFlattenedSolution());
if (scriptMethod != null) {
getForm().setOnOmitRecordCmdMethodID(scriptMethod.getID());
} else {
getForm().setOnOmitRecordCmdMethodID(0);
}
} else if (functionOrInteger instanceof Number) {
getForm().setOnOmitRecordCmdMethodID(((Number) functionOrInteger).intValue());
}
}
use of com.servoy.j2db.persistence.ScriptMethod in project servoy-client by Servoy.
the class JSForm method getEventHandler.
public static <T extends AbstractBase> JSMethod getEventHandler(IApplication application, T persist, String uuidOrName, IJSParent<?> parent, String propertyName) {
if (uuidOrName != null) {
IJSScriptParent<?> scriptParent = null;
ScriptMethod scriptMethod = application.getFlattenedSolution().getScriptMethod(uuidOrName);
;
if (scriptMethod != null) {
if (scriptMethod.getParent() instanceof TableNode && parent instanceof JSDataSourceNode) {
scriptParent = (JSDataSourceNode) parent;
} else if (scriptMethod.getParent() instanceof Solution) {
// global
scriptParent = null;
} else {
// form method
scriptParent = getJSFormParent(parent);
if (scriptMethod.getParent() != scriptParent.getSupportChild() && scriptParent.getSupportChild() instanceof Form) {
scriptParent = application.getScriptEngine().getSolutionModifier().instantiateForm((Form) scriptParent.getSupportChild(), false);
}
}
List<Object> arguments = persist.getFlattenedMethodArguments(propertyName);
if (arguments == null || arguments.size() == 0) {
return new JSMethod(scriptParent, scriptMethod, application, false);
} else {
return new JSMethodWithArguments(application, scriptParent, scriptMethod, false, arguments.toArray());
}
}
}
return null;
}
use of com.servoy.j2db.persistence.ScriptMethod in project servoy-client by Servoy.
the class JSForm method js_setOnRecordEditStartMethod.
/**
* @deprecated As of release 4.1, replaced by setOnRecordEditStart(JSMethod).
*/
@Deprecated
@ServoyClientSupport(ng = false, wc = true, sc = true)
public void js_setOnRecordEditStartMethod(Object functionOrInteger) {
checkModification();
if (functionOrInteger instanceof Function) {
Function function = (Function) functionOrInteger;
ScriptMethod scriptMethod = getScriptMethod(function, application.getFlattenedSolution());
if (scriptMethod != null) {
getForm().setOnRecordEditStartMethodID(scriptMethod.getID());
} else {
getForm().setOnRecordEditStartMethodID(0);
}
} else if (functionOrInteger instanceof Number) {
getForm().setOnRecordEditStartMethodID(((Number) functionOrInteger).intValue());
}
}
use of com.servoy.j2db.persistence.ScriptMethod in project servoy-client by Servoy.
the class JSForm method js_setOnFindCmdMethod.
/**
* @deprecated As of release 4.1, replaced by setOnFindCmd(JSMethod).
*/
@Deprecated
public void js_setOnFindCmdMethod(Object functionOrInteger) {
checkModification();
if (functionOrInteger instanceof Function) {
Function function = (Function) functionOrInteger;
ScriptMethod scriptMethod = getScriptMethod(function, application.getFlattenedSolution());
if (scriptMethod != null) {
getForm().setOnFindCmdMethodID(scriptMethod.getID());
} else {
getForm().setOnFindCmdMethodID(0);
}
} else if (functionOrInteger instanceof Number) {
getForm().setOnFindCmdMethodID(((Number) functionOrInteger).intValue());
}
}
Aggregations