Child pages
  • JSClient

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
Enter additional information related to this 'class' inside the {div} macro with 'id=description'
Divcache
styleindexdisplay:none

...

iddescription

...

padding0px
width80px

...

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Constants Summary

...

Table Cell (td)
String

...

Table Cell (td)
String

...

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Constants SummaryConstant that is returned as a JSEvent type when in the callback method when it executed normally.

...

...

padding0px
width80px

...

Constant that is returned as a JSEvent type when in the callback method when an exception occurred.

...

...

Table Cell (td)
String

...

servoy sSummary12%30%58%height: 30px;

...

Table Head (th)
colspan2
Method Summary
3Methods SummaryGets the id of the client.

...

Table Cell (td)
Object

...

...

Get a data-provider value.

...

Table Cell (td)
Object

...

Table Cell (td)
Boolean

...

Get a data-provider value.

...

returns true if this client is still valid/usable.

...

Table Cell (td)
void

...

Table Cell (td)
Object

...

voidQueues a method call on the remote server, without a callback method.voidQueues a method call on the remote server.

...

Set a data-provider value.

...

Table Cell (td)
Object

...

...

Set a data-provider value.

...

void

...

closes the client.

...

void

...

...

closes the client.

...

...

constant

...

servoy sDetail

...

padding0px
width100%

...

2100%height:30px

...

colspan1

...

2Constants Details

...

CALLBACK_EVENT

...

name

...

CALLBACK_EVENT

...

des

...

sIndent
Constant that is returned as a JSEvent type when in the callback method when it executed normally.

...

ret

...

Returns

...

sIndentclients

...

Supported Clients

sIndent

...

idsam

...

classlastDetailRow

...

SmartClient,WebClient,NGClientsam

Sample

...

classsIndent

...

Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	/*Queue a method where the callback can do something like this
	if (event.getType() == JSClient.CALLBACK_EVENT)
	{
		application.output("callback data, name: " + event.data);
	}
	else if (event.getType() == JSClient.CALLBACK_EXCEPTION_EVENT)
	{
		application.output("exception callback, name: " + event.data);
	}*/
	var x = new Object();
	x.name = 'remote1';
	x.number = 10;
	// this calls a 'remoteMethod' on the server as a global method, because the context (first argument is set to null), you can use a formname to call a form method
	jsclient.queueMethod(null, "remoteMethod", [x], callback);
}
sIdentjavascriptlastDetailRowCALLBACK_EXCEPTION_EVENT

...

name

...

CALLBACK_EXCEPTION_EVENT

...

des

...

sIndent
Constant that is returned as a JSEvent type when in the callback method when an exception occurred.

...

ret

...

Returns

...

sIndentclients

...

Supported Clients

sIndent

...

SmartClient,WebClient,NGClientsam

...

Sample

...

classsIndent

...

Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	/*Queue a method where the callback can do something like this
	if (event.getType() == JSClient.CALLBACK_EVENT)
	{
		application.output("callback data, name: " + event.data);
	}
	else if (event.getType() == JSClient.CALLBACK_EXCEPTION_EVENT)
	{
		application.output("exception callback, name: " + event.data);
	}*/
	var x = new Object();
	x.name = 'remote1';
	x.number = 10;
	// this calls a 'remoteMethod' on the server as a global method, because the context (first argument is set to null), you can use a formname to call a form method
	jsclient.queueMethod(null, "remoteMethod", [x], callback);
}

...

classlastDetailRow

...

idfunction
classservoy sDetail

...

padding0px
width100%
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details

...

idgetClientID
Table Row (tr)
idname
Table Cell (td)
getClientID
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getClientID
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Gets the id of the client.

This client id can be used to find the client from the headless client plugin.
Note that this client id is not the same id as the id displayed on the Aplicationb Server admin page.

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var headlessClient = plugins.headlessclient.createClient("someSolution", "user", "pass", null);
var clientID = headlessClient.getClientID()
....
headlessClient = plugins.headlessclient.getClient(clientID);
if (headlessClient != null && headlessClient.isValid()) {
	 headlessClient.queueMethod(null, "someRemoteMethod", null, callback);
}

...

classlastDetailRow

...

idgetDataProviderValue-String_String
Table Row (tr)
idname
Table Cell (td)
getDataProviderValue
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
getDataProviderValue
Span
(contextName, dataprovider)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get a data-provider value.

...

idprs

...

classsIndent

...

sIdentjavascriptlastDetailRow

functionservoy sDetail2100%height:30px2Methods DetailsgetClientIDname

getClientID()

dessIndent
Gets the id of the client.

This client id can be used to find the client from the headless client plugin.
Note that this client id is not the same id as the id displayed on the Aplicationb Server admin page.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowgetDataProviderValuename

getDataProviderValue(contextName, dataprovider)

dessIndent
Get a data-provider value.
prs

Parameters

sIndentcontextNameThe context of the given method, null if it is global method or a form name for a form method

...

dataprovider

...

the data-provider name as seen in Servoy

...

ret

...

Returns

...

sIndent

...

the value for the data-provider.clients

...

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

...

classlastDetailRow

...

idgetDataProviderValue-String_String_String
Table Row (tr)
idname
Table Cell (td)
getDataProviderValue

...

idsig

...

Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
getDataProviderValue

...

Sample

...

classsIndent

...

Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	// only gets the globals.media when the 'remoteMethod' is currently executing for this client
	var value = jsclient.getDataProviderValue(null, "scopes.globals.number", 'remoteMethod');
	if (value != null)
	{
		application.output("value get from scopes.globals.number :: "+ value);
		scopes.globals.value = value+10;
		var returnValue = jsclient.setDataProviderValue(null, "scopes.globals.number", scopes.globals.value, 'remoteMethod');
		application.output("value set to scopes.globals.number previous value "+ returnValue);
	}
	else
	{
		application.output("value get from scopes.globals.number :: " + null);
	}
}

...

sIdentjavascriptlastDetailRowgetDataProviderValuename

getDataProviderValue(contextName, dataprovider, methodName)

...

des

...

sIndent
Get a data-provider value.

...

prs

...

Parameters

...

...

sIndent

...

contextName

...

The context of the given method; null if it is global method or a form name for a form method.

...

dataprovider

...

the data-provider name as seen in Servoy.

...

methodName

...

if this is specified, the data-provider's value will only be returned if the specified method is running in this headless client because the currently running client requested it to. Otherwise undefined is returned.

...

ret

...

Returns

...

sIndent

...

classlastDetailRow

...

idqueueMethod-String_String_ObjectArray_Function
Table Row (tr)
idname
Table Cell (td)
queueMethod

...

idsig

...

Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
queueMethod

...

the value of the data-provider.clients

Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	// only gets the globals.media when the 'remoteMethod' is currently executing for this client
	var value = jsclient.getDataProviderValue(null, "scopes.globals.number", 'remoteMethod');
	if (value != null)
	{
		application.output("value get from scopes.globals.number :: "+ value);
		scopes.globals.value = value+10;
		var returnValue = jsclient.setDataProviderValue(null, "scopes.globals.number", scopes.globals.value, 'remoteMethod');
		application.output("value set to scopes.globals.number previous value "+ returnValue);
	}
	else
	{
		application.output("value get from scopes.globals.number :: " + null);
	}
}

...

classlastDetailRow

...

idisValid
Table Row (tr)
idname
Table Cell (td)
isValid
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isValid
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
returns true if this client is still valid/usable.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	/*Queue a method where the callback can do something like this
	if (event.getType() == JSClient.CALLBACK_EVENT)
	{
		application.output("callback data, name: " + event.data);
	}
	else if (event.getType() == JSClient.CALLBACK_EXCEPTION_EVENT)
	{
		application.output("exception callback, name: " + event.data);
	}*/
	var x = new Object();
	x.name = 'remote1';
	x.number = 10;
	// this calls a 'remoteMethod' on the server as a global method, because the context (first argument is set to null), you can use a formname to call a form method
	jsclient.queueMethod(null, "remoteMethod", [x], callback);
}

...

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
isValidname

isValid()

dessIndent
returns true if this client is still valid/usable.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
queueMethodname

queueMethod(contextName, methodName, args)

dessIndent
Queues a method call on the remote server, without a callback method.
Please note that calling queueMethod without a callback does not return anything: no result of the remote method or no exception if something went wrong.
prs

Parameters

sIndentcontextNameThe context of the given method, null if it is global method or a form name for a form method.methodNameThe method name.argsThe arguments that should be passed to the method.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
queueMethodname

queueMethod(contextName, methodName, args, notifyCallBackMethod)

...

des

...

sIndent
Queues a method call on the remote server. The callback method will be called when the method is executed on the server

...


and the return value is given as the JSEvent.data object with the JSEvent.getType() value of JSClient.CALLBACK_EVENT.

...


If an exception is thrown somewhere then the callback method will be called with

...


the exception as the JSEvent data object with the JSEvent.getType() value of JSClient.CALLBACK_EXCEPTION_EVENT

...


The second argument that is give back is the JSClient instance that did the call.

...

prs

...

Parameters

...

sIndent

...

contextName

...

The context of the given method, null if it is global method or a form name for a form method.

...

methodName

...

The method name.

...

args

...

The arguments that should be passed to the method.

...

notifyCallBackMethod

...

classlastDetailRow

...

idsetDataProviderValue-String_String_Object
Table Row (tr)
idname
Table Cell (td)
setDataProviderValue

...

idsig

...

Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
setDataProviderValue

...

The callback method that is called when the execution is finished.clients

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	/*Queue a method where the callback can do something like this
	if (event.getType() == JSClient.CALLBACK_EVENT)
	{
		application.output("callback data, name: " + event.data);
	}
	else if (event.getType() == JSClient.CALLBACK_EXCEPTION_EVENT)
	{
		application.output("exception callback, name: " + event.data);
	}*/
	var x = new Object();
	x.name = 'remote1';
	x.number = 10;
	// this calls a 'remoteMethod' on the server as a global method, because the context (first argument is set to null), you can use a formname to call a form method
	jsclient.queueMethod(null, "remoteMethod", [x], callback);
}

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setDataProviderValuename

setDataProviderValue(contextName, dataprovider, value)

...

...

des

...

sIndent
Set a data-provider value.

...

prs

...

Parameters

...

sIndent

...

contextName

...

The context of the given method, null if it is global method or a form name for a form method.

...

dataprovider

...

the data-provider name as seen in Servoy.

...

value

...

the value to set.

...

ret

...

Returns

...

sIndent

...

the old value or null if no change.clients

...

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

...

classlastDetailRow

...

idsetDataProviderValue-String_String_Object_String
Table Row (tr)
idname
Table Cell (td)
setDataProviderValue

...

idsig

...

Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
setDataProviderValue

...

Sample

...

classsIndent

...

Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	// only gets the globals.media when the 'remoteMethod' is currently executing for this client
	var value = jsclient.getDataProviderValue(null, "scopes.globals.number", 'remoteMethod');
	if (value != null)
	{
		application.output("value get from scopes.globals.number :: "+ value);
		scopes.globals.value = value+10;
		var returnValue = jsclient.setDataProviderValue(null, "scopes.globals.number", scopes.globals.value, 'remoteMethod');
		application.output("value set to scopes.globals.number previous value "+ returnValue);
	}
	else
	{
		application.output("value get from scopes.globals.number :: " + null);
	}
}
sIdentjavascriptlastDetailRowsetDataProviderValuename

setDataProviderValue(contextName, dataprovider, value, methodName)

...

...

des

...

sIndent
Set a data-provider value.

...

prs

...

Parameters

...

sIndent

...

contextName

...

The context of the given method, null if it is global method or a form name for a form method

...

dataprovider

...

the data-provider name as seen in Servoy

...

value

...

the value to set

...

methodName

...

if this is specified, the data-provider's value will only be set if the specified method is running in this headless client because the currently running client requested it to. Otherwise the value is not set into the data-provider and undefined is returned.

...

ret

...

Returns

...

sIndent

...

classlastDetailRow

...

idshutdown
Table Row (tr)
idname
Table Cell (td)
shutdown
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
shutdown
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
closes the client.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	/*Queue a method where the callback can do something like this
	if (event.getType() == JSClient.CALLBACK_EVENT)
	{
		application.output("callback data, name: " + event.data);
	}
	else if (event.getType() == JSClient.CALLBACK_EXCEPTION_EVENT)
	{
		application.output("exception callback, name: " + event.data);
	}*/
	var x = new Object();
	x.name = 'remote1';
	x.number = 10;
	// this calls a 'remoteMethod' on the server as a global method, because the context (first argument is set to null), you can use a formname to call a form method
	jsclient.queueMethod(null, "remoteMethod", [x], callback);
}

...

classlastDetailRow

...

idshutdown-Boolean
Table Row (tr)
idname
Table Cell (td)
shutdown
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
shutdown
Span
(force)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
closes the client.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Boolean} force
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	/*Queue a method where the callback can do something like this
	if (event.getType() == JSClient.CALLBACK_EVENT)
	{
		application.output("callback data, name: " + event.data);
	}
	else if (event.getType() == JSClient.CALLBACK_EXCEPTION_EVENT)
	{
		application.output("exception callback, name: " + event.data);
	}*/
	var x = new Object();
	x.name = 'remote1';
	x.number = 10;
	// this calls a 'remoteMethod' on the server as a global method, because the context (first argument is set to null), you can use a formname to call a form method
	jsclient.queueMethod(null, "remoteMethod", [x], callback);
}

...

classlastDetailRow

...

the old value or null if no changeclients

Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (jsclient && jsclient.isValid())
{
	// only gets the globals.media when the 'remoteMethod' is currently executing for this client
	var value = jsclient.getDataProviderValue(null, "scopes.globals.number", 'remoteMethod');
	if (value != null)
	{
		application.output("value get from scopes.globals.number :: "+ value);
		scopes.globals.value = value+10;
		var returnValue = jsclient.setDataProviderValue(null, "scopes.globals.number", scopes.globals.value, 'remoteMethod');
		application.output("value set to scopes.globals.number previous value "+ returnValue);
	}
	else
	{
		application.output("value get from scopes.globals.number :: " + null);
	}
}

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
shutdownname

shutdown()

dessIndent
closes the client.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
shutdownname

shutdown(force)

dessIndent
closes the client.
prs

Parameters

sIndentforce ;
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow