Child pages
  • JSClient

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Cache

...

index

...

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.

...

iddescription

...

Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Constants Summary

...

Table Cell (td)
String

...

true
refresh100d
iddoc
showRefreshtrue
titleRefresh page
showDatetrue
retryEnable

 

 

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListINLINESmartClientsWordListINLINEWebClientsWordListINLINENGClient

 

 

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

...

Table Cell (td)
String

...

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

...

 

...

 

...

Colgroup Tag
Col
width80px
Col

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

...

Get a data-provider value.

...

Table Cell (td)
Boolean

...

returns true if this client is still valid/usable.

...

void

...

Table Cell (td)
Object

...

Queues 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

...

2

...

100%

...

Col

...

height:30px

...

2

...

Constants 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

...

SmartClient,WebClient,NGClientsam

...

Table Row (tr)
classlastDetailRow
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);
}

sIdentjavascriptlastDetailRow CALLBACK_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

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);
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

...

idfunction
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
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);
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

...

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

...

Parameters

...

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
lastDetailRow 
getDataProviderValuename

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

...

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

getDataProviderValue

...

idsig

...

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

...

sIndentclients

...

classsIndent

...

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);
	}
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
getDataProviderValuename

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

...

sIndentclients

...

classsIndent

...

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);
	}
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
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);
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

...

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

queueMethod

...

idsig

...

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

...

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, 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

...

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);
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

...

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

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

...

sIndentclients

...

classsIndent

...

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);
	}
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

...

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

setDataProviderValue

...

idsig

...

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

...

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
setDataProviderValuename

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

...

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

...

sIndentclients

...

classsIndent

...

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);
	}
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
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);
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

...

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

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