Gets the specified form object and returns information about the form (see JSForm node). |
|
|
Parameters
{String} name – the specified name of the form |
|
|
Sample
var myForm = solutionModel.getForm('existingFormName');
//get the style of the form (for all other properties see JSForm node)
var styleName = myForm.styleName;
|
|
|
|
|
Get an array of all forms. |
|
|
Returns
JSForm[] – an array of JSForm type elements |
|
|
Sample
var forms = solutionModel.getForms()
for (var i in forms)
application.output(forms[i].name)
|
|
|
|
|
Get an array of forms, that are all based on datasource/servername. |
|
|
Parameters
{String} datasource – the datasource or servername |
|
|
Returns
JSForm[] – an array of JSForm type elements |
|
|
Sample
var forms = solutionModel.getForms(datasource)
for (var i in forms)
application.output(forms[i].name)
|
|
|
|
|
Get an array of forms, that are all based on datasource/servername and tablename. |
|
|
Parameters
{String} server – the datasource or servername
{String} tablename – the tablename |
|
|
Returns
JSForm[] – an array of JSForm type elements |
|
|
Sample
var forms = solutionModel.getForms(datasource,tablename)
for (var i in forms)
application.output(forms[i].name)
|
|
|
|
|
Gets an existing global method by the specified name. |
|
|
Parameters
{String} scopeName – the scope in which the method is searched
{String} name – the name of the specified global method |
|
|
Sample
var method = solutionModel.getGlobalMethod('globals', 'nameOfGlobalMethod');
if (method != null) application.output(method.code);
|
|
|
|
|
The list of all global methods. |
|
|
Returns
JSMethod[] – an array of JSMethod type elements |
|
|
Sample
var methods = solutionModel.getGlobalMethods('globals');
for (var x in methods)
application.output(methods[x].getName());
|
|
|
|
|
The list of all global methods. |
|
|
Parameters
{String} scopeName – limit to global methods of specified scope name |
|
|
Returns
JSMethod[] – an array of JSMethod type elements |
|
|
Sample
var methods = solutionModel.getGlobalMethods('globals');
for (var x in methods)
application.output(methods[x].getName());
|
|
|
|
|
Gets an existing global variable by the specified name. |
|
|
Parameters
{String} scopeName – the scope in which the variable is searched
{String} name – the specified name of the global variable |
|
|
Sample
var globalVariable = solutionModel.getGlobalVariable('globals', 'globalVariableName');
application.output(globalVariable.name + " has the default value of " + globalVariable.defaultValue);
|
|
|
|
|
Gets an array of all global variables. |
|
|
Returns
JSVariable[] – an array of JSVariable type elements |
|
|
Sample
var globalVariables = solutionModel.getGlobalVariables('globals');
for (var i in globalVariables)
application.output(globalVariables[i].name + " has the default value of " + globalVariables[i].defaultValue);
|
|
|
|
|
Gets an array of all global variables. |
|
|
Parameters
{String} scopeName – limit to global vars of specified scope name |
|
|
Returns
JSVariable[] – an array of JSVariable type elements |
|
|
Sample
var globalVariables = solutionModel.getGlobalVariables('globals');
for (var i in globalVariables)
application.output(globalVariables[i].name + " has the default value of " + globalVariables[i].defaultValue);
|
|
|
|
|
Returns an existing list form. |
|
|
Parameters
formName – the form's name. |
|
|
Returns
JSList – the existing list form, or null if it does not exist. |
|
|
Sample
var list = solutionModel.getListForm('created_by_sm_2');
|
|
|
|
|
Get an array of all list-forms. |
|
|
Returns
JSList[] – an array of IBaseSHList type elements |
|
|
Sample
var forms = solutionModel.getListForms()
for (var i in forms)
application.output(forms[i].name)
|
|
|
|
|
Gets an array of all scope names used. |
|
|
Returns
String[] – an array of String scope names |
|
|
Sample
var scopeNames = solutionModel.getScopeNames();
for (var name in scopeNames)
application.output(name);
|
|
|
|
|
Gets an existing valuelist by the specified name and returns a JSValueList Object that can be assigned to a field. |
|
|
Parameters
{String} name – the specified name of the valuelist |
|
|
Sample
var myValueList = solutionModel.getValueList('myValueListHere')
//now set the valueList property of your field
//myField.valuelist = myValueList
|
|
|
|
|
Gets an array of all valuelists for the currently active solution. |
|
|
Sample
var valueLists = solutionModel.getValueLists();
if (valueLists != null && valueLists.length != 0)
for (var i in valueLists)
application.output(valueLists[i].name);
|
|
|
|
|
Creates a new JSForm Object.
NOTE: See the JSForm node for more information about form objects that can be added to the new form. |
|
|
Parameters
{String} name – the specified name of the form
{String} dataSource – the specified name of the datasource for the specified table |
|
|
Sample
var myForm = solutionModel.newForm('newForm', 'db:/my_server/my_table')
//now you can add stuff to the form (under JSForm node)
//add a label
myForm.newLabel('Name', 1)
//add a "normal" text entry field
myForm.newTextField('dataProviderNameHere', 2)
|
|
|
|
|
(name, dataSource, styleName, show_in_menu, width, height) |
|
|
Creates a new JSForm Object.
NOTE: See the JSForm node for more information about form objects that can be added to the new form. |
|
|
Parameters
{String} name – the specified name of the form
{String} dataSource – the specified name of the datasource for the specified table
{String} styleName – the specified style
{Boolean} show_in_menu – if true show the name of the new form in the menu; or false for not showing
{Number} width – the width of the form in pixels
{Number} height – the height of the form in pixels |
|
|
Sample
var myForm = solutionModel.newForm('newForm', 'db:/my_server/my_table', 'myStyleName', false, 800, 600)
//now you can add stuff to the form (under JSForm node)
//add a label
myForm.newLabel('Name', 20, 20, 120, 30)
//add a "normal" text entry field
myForm.newTextField('dataProviderNameHere', 140, 20, 140,20)
|
|
|
|
|
(name, serverName, tableName, styleName, show_in_menu, width, height) |
|
|
Creates a new JSForm Object.
NOTE: See the JSForm node for more information about form objects that can be added to the new form. |
|
|
Parameters
{String} name – the specified name of the form
{String} serverName – the specified name of the server for the specified table
{String} tableName – the specified name of the table
{String} styleName – the specified style
{Boolean} show_in_menu – if true show the name of the new form in the menu; or false for not showing
{Number} width – the width of the form in pixels
{Number} height – the height of the form in pixels |
|
|
Sample
var myForm = solutionModel.newForm('newForm', 'my_server', 'my_table', 'myStyleName', false, 800, 600)
//With only a datasource:
//var myForm = solutionModel.newForm('newForm', datasource, 'myStyleName', false, 800, 600)
//now you can add stuff to the form (under JSForm node)
//add a label
myForm.newLabel('Name', 20, 20, 120, 30)
//add a "normal" text entry field
myForm.newTextField('dataProviderNameHere', 140, 20, 140,20)
|
|
|
|
|
Creates a new global method with the specified code in a scope. |
|
|
Parameters
{String} scopeName – the scope in which the method is created
{String} code – the specified code for the global method |
|
|
Sample
var method = solutionModel.newGlobalMethod('globals', 'function myglobalmethod(){foundset.newRecord()}')
|
|
|
|
|
Creates a new global variable with the specified name and number type.
NOTE: The global variable number type is based on the value assigned from the SolutionModel-JSVariable node; for example: JSVariable.INTEGER. |
|
|
Parameters
{String} scopeName – the scope in which the variable is created
{String} name – the specified name for the global variable
{Number} type – the specified number type for the global variable |
|
|
Sample
var myGlobalVariable = solutionModel.newGlobalVariable('globals', 'newGlobalVariable', JSVariable.INTEGER);
myGlobalVariable.defaultValue = 12;
//myGlobalVariable.defaultValue = "{a:'First letter',b:'Second letter'}" // an js object, type must be media.
//myGlobalVariable.defaultValue = '"some text"'; // Use two pairs of quotes if you want to assign a String as default value.
|
|
|
|
|
(formName, dataSource, textDataProviderID) |
|
|
Creates a new list form, similar to an inset list but without the inset list's header and relation.
The result will be an independent form which behaves like a mobile list. |
|
|
Parameters
{String} formName – the new form's name.
{String} dataSource – the list will be populated based on this datasource.
{String} textDataProviderID – can be null; it's a convenience argument for setting the dataprovider that will be used to populate the main text area of the list's items. |
|
|
Returns
JSList – the newly created list form. |
|
|
Sample
var f = solutionModel.newForm("created_by_sm_1","udm","contacts",null,false,100,380);
// create a button to go to it on the main form
b = f.newButton("Show created list form",0,9,10,10,
f.newMethod("function showListForm() { forms.created_by_sm_2.controller.show(); }"));
// create the actual list form
var list = f.createListForm('created_by_sm_2', databaseManager.getDataSource("udm","contacts"),"name_first");
list.onAction = solutionModel.getForm('created_by_sm_2').newMethod("function goBack() { history.back(); }");
|
|
|
|
|
Removes the specified form during the persistent connected client session.
NOTE: Make sure you call history.remove first in your Servoy method (script). |
|
|
Parameters
{String} name – the specified name of the form to remove |
|
|
Returns
Boolean – true is form has been removed, false if form could not be removed |
|
|
Sample
//first remove it from the current history, to destroy any active form instance
var success = history.removeForm('myForm')
//removes the named form from this session, please make sure you called history.remove() first
if(success)
{
solutionModel.removeForm('myForm')
}
|
|
|
|
|
Removes the specified global method. |
|
|
Parameters
{String} scopeName – the scope in which the method is declared
{String} name – the name of the global method to be removed |
|
|
Returns
Boolean – true if the removal was successful, false otherwise |
|
|
Sample
var m1 = solutionModel.newGlobalMethod('globals', 'function myglobalmethod1(){application.output("Global Method 1");}');
var m2 = solutionModel.newGlobalMethod('globals', 'function myglobalmethod2(){application.output("Global Method 2");}');
var success = solutionModel.removeGlobalMethod('globals', 'myglobalmethod1');
if (success == false) application.output('!!! myglobalmethod1 could not be removed !!!');
var list = solutionModel.getGlobalMethods('globals');
for (var i = 0; i < list.length; i++) {
application.output(list[i].code);
}
|
|
|
|
|
Removes the specified global variable. |
|
|
Parameters
{String} scopeName – the scope in which the variable is declared
{String} name – the name of the global variable to be removed |
|
|
Returns
Boolean – true if the removal was successful, false otherwise |
|
|
Sample
var v1 = solutionModel.newGlobalVariable('globals', 'globalVar1', JSVariable.INTEGER);
var v2 = solutionModel.newGlobalVariable('globals', 'globalVar2', JSVariable.TEXT);
var success = solutionModel.removeGlobalVariable('globals', 'globalVar1');
if (success == false) application.output('!!! globalVar1 could not be removed !!!');
var list = solutionModel.getGlobalVariables('globals');
for (var i = 0; i < list.length; i++) {
application.output(list[i].name + '[ ' + list[i].variableType + ']: ' + list[i].variableType);
}
|
|
|
|
|
Reverts the specified form to the original (blueprint) version of the form; will result in an exception error if the form is not an original form.
NOTE: Make sure you call history.remove first in your Servoy method (script) or call form.controller.recreateUI() before the script ends. |
|
|
Parameters
{String} name – the specified name of the form to revert |
|
|
Sample
// revert the form to the original solution form, removing any changes done to it through the solution model.
var revertedForm = solutionModel.revertForm('myForm')
// add a label on a random place.
revertedForm.newLabel("MyLabel",Math.random()*100,Math.random()*100,80,20);
// make sure that the ui is up to date.
forms.myForm.controller.recreateUI();
|
|
|
|
|
|