telosys.objects
Class ScreenActions

java.lang.Object
  extended bytelosys.objects.ScreenActions

public class ScreenActions
extends java.lang.Object

ScreenActions object
A "client-side" stub to invoke the server side actions with AJAX requests


Constructor Summary
ScreenActions(Screen screen)
          Constructor The default AJAX mode is set to "synchronous"
ScreenActions(Screen screen, boolean flagAsync)
          Constructor with AJAX mode parameter
 
Method Summary
 void clearElementsToRetrieve()
          Clears all elements to retrieve
 void clearParameters()
          Clears all parameters
 void clearViewsToRetrieve()
          Clears all views to retrieve
 ScreenResponse doClear(boolean bUpdateScreen)
          Invokes the standard "CLEAR" action to clear the Screen Context on the server
 ScreenResponse doClose()
          Invokes the standard "CLOSE" action
 ScreenResponse doDelete(boolean bClearScreen, boolean bUpdateScreen)
          Invokes the standard "DELETE" action to delete data on the server
 ScreenResponse doExec(string sProcName, boolean bUpdateScreen)
          Executes the given procedure with the given parameters
 ScreenResponse doGet(boolean bUpdateScreen)
          Invokes the standard "GET" action to get data from the server.
 ScreenResponse doGetElements(arguments elements)
          Invokes the standard "GET" action to get data from the server.
 ScreenResponse doGetView(string sViewName)
          Invokes the standard "GET" action to get data from the server.
 ScreenResponse doGetView(string sViewName, string sRenderer)
          Invokes the standard "GET" action to get data from the server.
 ScreenResponse doGetViews(arguments viewNames)
          Invokes the standard "GET" action to get data from the server.
 ScreenResponse doInsert(boolean bUpdateScreen)
          Invokes the standard "INSERT" action to insert data on the server
 ScreenResponse doListAdd(string sListName, string sItemName, number iOldIndex, boolean bUpdateScreen)
          Adds the given item on the list
 ScreenResponse doListClear(string sListName, string sItemName, number iOldIndex)
          Clears the given item from the list
 ScreenResponse doListInsert(string sListName, string sItemName, number iOldIndex, number iIndex, boolean bUpdateScreen)
          Inserts the given item on the list
 ScreenResponse doListRemove(string sListName, string sItemName, number iOldIndex, number iIndex, boolean bUpdateScreen)
          Removes the given item from the list
 ScreenResponse doListSelect(string sListName, string sItemName, number iOldIndex, number iIndex, boolean bUpdateScreen)
          Selects the given item of the list
 ScreenResponse doListSort(string sListName, string sItemName, number iOldIndex, string sColumn, string sOrder)
          Sorts a list in the screen context ( VOList or DataSet )
 ScreenResponse doLoad(boolean bUpdateScreen)
          Invokes the standard "LOAD" action to load data from the server.
 ScreenResponse doLoadElements(arguments elementNames)
          Invokes the standard "LOAD" action to load data from the server.
 ScreenResponse doLoadView(string sViewName)
          Invokes the standard "LOAD" action to load data from the server.
 ScreenResponse doLoadView(string sViewName, string sRenderer)
          Invokes the standard "LOAD" action to load data from the server.
 ScreenResponse doLoadViews(arguments viewNames)
          Invokes the standard "LOAD" action to load data from the server.
 void doNotClearContextData()
          No "clear" when we execute an action
 void doNotGetContextData()
          No "get" when we execute an action
 void doNotSetContextData()
          No "set" when we execute an action
 ScreenResponse doOpen()
          Invokes the standard "OPEN" action
 ScreenResponse doSave(boolean bUpdateScreen)
          Invokes the standard "SAVE" action to save data on the server.
 ScreenResponse doSet(boolean bUpdateScreen)
          Invokes the standard "SET" action to update data on the server.
 ScreenResponse doUpdate(boolean bUpdateScreen)
          Invokes the standard "UPDATE" action to update data on the server
protected  ScreenRequest getRequest(string action)
          INTERNAL : Do not use Returns a request with the given action and the parameters to send
 object getScreen()
          Returns the screen instance
 number numberOfParameters()
          Returns the current number of parameters
protected  void openWindowLastAction(string sURL, string sRequest, string sResponse)
          INTERNAL : Do not use
protected  void populateFields(object oResponse)
          INTERNAL : Do not use Populates the screen fields with XML data received
protected  object sendScreenData(string sAction, function caller, boolean bUpdateScreen)
          INTERNAL : Do not use Sends a request to the server to execute a given action
 void setDefaultModeAsync()
          Set the default mode to "Asynchronous" ( default mode for all future requests )
 void setDefaultModeSync()
          Set the default mode to "Synchronous" ( default mode for all future requests )
 void setElementsToRetrieve(arguments elements)
          Adds elements to retrieve after receiving the response
 void setElementToRetrieve(string sElementName)
          Adds an element to retrieve after receiving the response
 void setModeAsync()
          Set the mode "Asynchronous" (replace the default mode just for once)
The next AJAX request will be sent in "Asynchronous" mode
 void setModeSync()
          Set the mode "Synchronous" (replace the default mode just for once)
The next AJAX request will be sent in "Synchronous" mode
 void setParameter(string sName, string sValue)
          Sets a parameter
 void setParametersFromFields()
          Populates the action parameters with the values of all the fields declared in the screen.
 void setParametersFromFields(string elementName)
          Populates the action parameters with the values of the fields belonging to the given element name.
 void setPermanentCallback(function callback)
          Set the permanent callback function ( the callback to use by default for all future requests )
 void setTemporaryCallback(function callback)
          Set a temporary callback function ( replace the permanent callback just for once )
protected  void setTrace(boolean flag)
          Set the trace flag
 void setViewsToRetrieve(arguments viewNames)
          Adds views to retrieve after receiving the response
 void setViewToRetrieve(string sViewName)
          Define a single view to retrieve (the renderer associated with the view is used by default )
 void setViewToRetrieve(string sViewName, string sRenderer)
          Define a single view to retrieve using a specific renderer to generate it
 void showElementsToRetrieve()
          Shows (alert) all elements to retrieve
 void showLastAction()
          Open a window to show the last action's request and response
 void showParameters()
          Shows (alert) all parameters
 void showViewsToRetrieve()
          Shows (alert) all views to retrieve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenActions

public ScreenActions(Screen screen)
Constructor The default AJAX mode is set to "synchronous"

Parameters:
screen - : the screen instance (not null)

ScreenActions

public ScreenActions(Screen screen,
                     boolean flagAsync)
Constructor with AJAX mode parameter

Parameters:
screen - : the screen instance (not null)
flagAsync - : true to set the default mode to "asynchronous"
Method Detail

setTrace

protected void setTrace(boolean flag)
Set the trace flag

Parameters:
flag -

getScreen

public object getScreen()
Returns the screen instance

Returns:
the screen instance

doNotClearContextData

public void doNotClearContextData()
No "clear" when we execute an action


doNotSetContextData

public void doNotSetContextData()
No "set" when we execute an action


doNotGetContextData

public void doNotGetContextData()
No "get" when we execute an action


setParameter

public void setParameter(string sName,
                         string sValue)
Sets a parameter

Parameters:
sName - the parameter name
sValue - the parameter value

clearParameters

public void clearParameters()
Clears all parameters


showParameters

public void showParameters()
Shows (alert) all parameters


setElementToRetrieve

public void setElementToRetrieve(string sElementName)
Adds an element to retrieve after receiving the response

Parameters:
sElementName - the element name

setElementsToRetrieve

public void setElementsToRetrieve(arguments elements)
Adds elements to retrieve after receiving the response

Parameters:
elements - variable list of elements names

clearElementsToRetrieve

public void clearElementsToRetrieve()
Clears all elements to retrieve


showElementsToRetrieve

public void showElementsToRetrieve()
Shows (alert) all elements to retrieve


setViewToRetrieve

public void setViewToRetrieve(string sViewName)
Define a single view to retrieve (the renderer associated with the view is used by default )

Parameters:
sViewName -

setViewToRetrieve

public void setViewToRetrieve(string sViewName,
                              string sRenderer)
Define a single view to retrieve using a specific renderer to generate it

Parameters:
sViewName - the view name
sRenderer - the renderer

setViewsToRetrieve

public void setViewsToRetrieve(arguments viewNames)
Adds views to retrieve after receiving the response

Parameters:
viewNames - variable list of views names

clearViewsToRetrieve

public void clearViewsToRetrieve()
Clears all views to retrieve


showViewsToRetrieve

public void showViewsToRetrieve()
Shows (alert) all views to retrieve


setDefaultModeAsync

public void setDefaultModeAsync()
Set the default mode to "Asynchronous" ( default mode for all future requests )


setDefaultModeSync

public void setDefaultModeSync()
Set the default mode to "Synchronous" ( default mode for all future requests )


setModeAsync

public void setModeAsync()
Set the mode "Asynchronous" (replace the default mode just for once)
The next AJAX request will be sent in "Asynchronous" mode


setModeSync

public void setModeSync()
Set the mode "Synchronous" (replace the default mode just for once)
The next AJAX request will be sent in "Synchronous" mode


setPermanentCallback

public void setPermanentCallback(function callback)
Set the permanent callback function ( the callback to use by default for all future requests )

Parameters:
callback -
Since:
1.1.0

setTemporaryCallback

public void setTemporaryCallback(function callback)
Set a temporary callback function ( replace the permanent callback just for once )

Parameters:
callback -
Since:
1.1.0

doOpen

public ScreenResponse doOpen()
Invokes the standard "OPEN" action

Returns:
the server response object

doClose

public ScreenResponse doClose()
Invokes the standard "CLOSE" action

Returns:
the server response object

doGet

public ScreenResponse doGet(boolean bUpdateScreen)
Invokes the standard "GET" action to get data from the server. Gets all the Screen Context elements and all the views

Parameters:
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doGetView

public ScreenResponse doGetView(string sViewName)
Invokes the standard "GET" action to get data from the server. Gets the given Screen Context view ( use the renderer associated with it )

Parameters:
sViewName - the view name
Returns:
the server response object

doGetView

public ScreenResponse doGetView(string sViewName,
                                string sRenderer)
Invokes the standard "GET" action to get data from the server. Gets the given Screen Context view and use the given renderer to produce it

Parameters:
sViewName - the view name
sRenderer - the renderer to use
Returns:
the server response object

doGetElements

public ScreenResponse doGetElements(arguments elements)
Invokes the standard "GET" action to get data from the server. Gets all the Screen Context elements

Parameters:
elements - variable list of elements names
Returns:
the server response object

doGetViews

public ScreenResponse doGetViews(arguments viewNames)
Invokes the standard "GET" action to get data from the server. Gets all the Screen Context views

Parameters:
viewNames - variable list of views names arguments
Returns:
the server response object

doSet

public ScreenResponse doSet(boolean bUpdateScreen)
Invokes the standard "SET" action to update data on the server. Sets all the Screen Context elements

Parameters:
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doClear

public ScreenResponse doClear(boolean bUpdateScreen)
Invokes the standard "CLEAR" action to clear the Screen Context on the server

Parameters:
bUpdateScreen - true(clear the screen fields) | false(do not clear the screen fields)
Returns:
the server response object

doLoad

public ScreenResponse doLoad(boolean bUpdateScreen)
Invokes the standard "LOAD" action to load data from the server. Loads all the Screen Context elements and all the views

Parameters:
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doLoadViews

public ScreenResponse doLoadViews(arguments viewNames)
Invokes the standard "LOAD" action to load data from the server. Loads all the Screen views

Parameters:
viewNames - variable list of views names arguments
Returns:
the server response object

doLoadView

public ScreenResponse doLoadView(string sViewName)
Invokes the standard "LOAD" action to load data from the server. Retrieves the given view ( generated by the renderer associated with it )

Parameters:
sViewName - the view name
Returns:
the server response object

doLoadView

public ScreenResponse doLoadView(string sViewName,
                                 string sRenderer)
Invokes the standard "LOAD" action to load data from the server. Retrieves the given view ( generated by the given renderer )

Parameters:
sViewName - the view name
sRenderer - the renderer to use
Returns:
the server response object

doLoadElements

public ScreenResponse doLoadElements(arguments elementNames)
Invokes the standard "LOAD" action to load data from the server. Loads the given Screen elements

Parameters:
elementNames - variable list of elements to retrieve after the load
Returns:
the server response object

populateFields

protected void populateFields(object oResponse)
INTERNAL : Do not use Populates the screen fields with XML data received

Parameters:
oResponse - the server response object

openWindowLastAction

protected void openWindowLastAction(string sURL,
                                    string sRequest,
                                    string sResponse)
INTERNAL : Do not use

Parameters:
sURL -
sRequest -
sResponse -

showLastAction

public void showLastAction()
Open a window to show the last action's request and response


getRequest

protected ScreenRequest getRequest(string action)
INTERNAL : Do not use Returns a request with the given action and the parameters to send

Parameters:
action -
Returns:

sendScreenData

protected object sendScreenData(string sAction,
                                function caller,
                                boolean bUpdateScreen)
INTERNAL : Do not use Sends a request to the server to execute a given action

Parameters:
sAction - : the action ("save"|"insert"|"update")
caller - : the caller function
bUpdateScreen - : true(update the screen) | false(no screen update)
Returns:
the server response object

doSave

public ScreenResponse doSave(boolean bUpdateScreen)
Invokes the standard "SAVE" action to save data on the server. If data exists, executes a "UPDATE" action else a "INSERT" action

Parameters:
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doInsert

public ScreenResponse doInsert(boolean bUpdateScreen)
Invokes the standard "INSERT" action to insert data on the server

Parameters:
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doUpdate

public ScreenResponse doUpdate(boolean bUpdateScreen)
Invokes the standard "UPDATE" action to update data on the server

Parameters:
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doDelete

public ScreenResponse doDelete(boolean bClearScreen,
                               boolean bUpdateScreen)
Invokes the standard "DELETE" action to delete data on the server

Parameters:
bClearScreen - true(clear the screen) | false(no screen clear)
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doListSelect

public ScreenResponse doListSelect(string sListName,
                                   string sItemName,
                                   number iOldIndex,
                                   number iIndex,
                                   boolean bUpdateScreen)
Selects the given item of the list

Parameters:
sListName - the list name
sItemName - the item name
iOldIndex - the old index
iIndex - the new index
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doListInsert

public ScreenResponse doListInsert(string sListName,
                                   string sItemName,
                                   number iOldIndex,
                                   number iIndex,
                                   boolean bUpdateScreen)
Inserts the given item on the list

Parameters:
sListName - the list name
sItemName - the item name
iOldIndex - the old index
iIndex - the new index
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doListAdd

public ScreenResponse doListAdd(string sListName,
                                string sItemName,
                                number iOldIndex,
                                boolean bUpdateScreen)
Adds the given item on the list

Parameters:
sListName - the list name
sItemName - the item name
iOldIndex - the old index
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doListRemove

public ScreenResponse doListRemove(string sListName,
                                   string sItemName,
                                   number iOldIndex,
                                   number iIndex,
                                   boolean bUpdateScreen)
Removes the given item from the list

Parameters:
sListName - the list name
sItemName - the item name
iOldIndex - the old index
iIndex - the new index
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

doListClear

public ScreenResponse doListClear(string sListName,
                                  string sItemName,
                                  number iOldIndex)
Clears the given item from the list

Parameters:
sListName - the list name
sItemName - the item name
iOldIndex - the old index
Returns:
the server response object

doListSort

public ScreenResponse doListSort(string sListName,
                                 string sItemName,
                                 number iOldIndex,
                                 string sColumn,
                                 string sOrder)
Sorts a list in the screen context ( VOList or DataSet )

Parameters:
sListName - the symbolic name of the list to sort ( the 'element name' of the list )
sItemName - the name of the list item to update if any ( can be null )
iOldIndex - the index of the list item to update if any ( can be null )
sColumn - the column to use as sort criteria ( VOList : attribute name, DataSet : column number )
sOrder - the sort order : "asc" for ascending order, "desc" for descending order ( can be null : automatic reverse )
Returns:
the server response object

doExec

public ScreenResponse doExec(string sProcName,
                             boolean bUpdateScreen)
Executes the given procedure with the given parameters

Parameters:
sProcName - the procedure name
bUpdateScreen - true(update the screen) | false(no screen update)
Returns:
the server response object

setParametersFromFields

public void setParametersFromFields(string elementName)
Populates the action parameters with the values of the fields belonging to the given element name.

Parameters:
elementName - the name of the element
Since:
v 1.1.0

setParametersFromFields

public void setParametersFromFields()
Populates the action parameters with the values of all the fields declared in the screen.

Since:
v 1.1.0

numberOfParameters

public number numberOfParameters()
Returns the current number of parameters

Returns:
0 to N
Since:
v 1.1.0