Class

RMPApplication

RMPApplication()

Constructor

# new RMPApplication()

Methods

# static addListener(callback)

Sets a function to launch whenever a field of a web interface is modified.
Parameters:
Name Type Description
callback RMPApplication~listenerCallback Callback that handles the variable changes

# static deregisterRequiredVariable(name)

Sets a widget to optional.
Parameters:
Name Type Description
name string Name of the widget variable

# static forEachWidget(visitor)

Calls a JavaScript function for each widget of the web interface.
Parameters:
Name Type Description
visitor RMPApplication~widgetVisitor JavaScript to execute
Example
function visitor(widget) {
     try {
           widget.setEnabled(true);
      } catch(err){
         console.log(err);
    }
}
RMPApplication.forEachWidget(visitor);

# static get()

Alias for getVariable.

# static getAllApplicationVariables() → {Array.<string>}

Returns an array with all variable names of the web interface.
Array.<string>
Example
(["var1","var2","var3"])

# static getAllVariablesValues() → {object}

Returns a JSON object with all variable names and values of the current web interface.
object
Example
{"var1":"val1","array_var":["val1","val2","val3"]})

# static getAllWidgets() → {Array.<object>}

Returns all widgets of the web interface.
Array.<object>
Example
var widgetList = RMPApplication.getAllWidgets();
for( i=0 ; i< widgetList.length ; i++ ){
    widgetList[i].setVisible(true);
}

# static getAllWidgetsId() → {Array.<string>}

Returns the IDs of all widgets of the web interface.
Array.<string>

# static getCurrentScreen() → {number}

Returns the ID of the current screen of the web interface.
number

# static getInvalidWidgets() → {Array.<object>}

Returns all invalid widgets of the web interface.
Array.<object>

# static getList(list)

Returns an RMP_List object.
Parameters:
Name Type Description
list string Name of the variable-based list.

# static getVariable(name) → {string}

Gets the value of a widget of the current web page (e.g. text input).
Parameters:
Name Type Description
name string Name of the widget variable
Value of the variable
string

# static isCurrentScreenEnabled() → {boolean}

Returns whether the current screen of a web interface is enabled (true) or read-only (false).
boolean

# static isEnabled(name) → {boolean}

Returns true if a widget is active, otherwise false.
Parameters:
Name Type Description
name string Name of the widget variable
boolean

# static isValid(name) → {boolean}

Returns true if a widget is valid, otherwise false.
Parameters:
Name Type Description
name string Name of the widget variable
boolean

# static isVisible(name) → {boolean}

Returns true if a widget is visible, otherwise false.
Parameters:
Name Type Description
name string Name of the widget variable
boolean

# static registerRequiredVariable(name)

Sets a widget to mandatory (the message to display should be configured in the web interface design).
Parameters:
Name Type Description
name string Name of the widget variable

# static removeListener(callback)

Removes a previously set listener.
Parameters:
Name Type Description
callback RMPApplication~listenerCallback Callback to remove

# static save(successCallback, failureCallback)

Saves the current web interface with the data filled in by the user (same as "Save as draft" button widget).
Parameters:
Name Type Description
successCallback RMPApplication~saveCallback Callback to execute in case of success
failureCallback RMPApplication~saveCallback Callback to execute in case of failure

# static set()

Alias for setVariable.

# static setCustomDateHandler(customDateHandeler)

Adds a custom handler to compute the date selected or entered by the end user before setting the variable of the Date input widget. By default, the offset time is set to UTC 12:00. If a custom handler is configured, it affects all the Date input widgets of the web interface.
Parameters:
Name Type Description
customDateHandeler RMPApplication~customDateHandler
Example
RMPApplication.setCustomDateHandler(function(selectedDate){  
 var computedDate = new Date(selectedDate.getTime());
 computedDate.setHours(12);
    computedDate.setMinutes(12);
    computedDate.setSeconds(12);
    return computedDate;
 })

# static setEnabled(name, enabled)

Sets a widget to active or inactive.
Parameters:
Name Type Description
name string Name of the widget variable
enabled boolean true: enabled, false: disabled

# static setList(name, list)

Sets an RMP_List.
Parameters:
Name Type Description
name string Name of the variable-based list
list list RMP_list to set

# static setVariable(name, value)

Sets the value of a widget of the current web page (e.g. a list).
Parameters:
Name Type Description
name string Name of the widget variable
value string Value of the widget variable

# static setVisible(name, visible)

Sets a widget to visible or hidden.
Parameters:
Name Type Description
name string Name of the widget variable
visible boolean true: visible, false: hidden

# static showErrorBox(title, message)

Opens a pop-up box (e.g. an alert).
Parameters:
Name Type Description
title string Title of the box
message string Message in the box

# static transpose(object) → {object}

Returns a JSON object with all variable names and values of the current web interface.
Parameters:
Name Type Description
object object to transpose
object
Example
var rows=[{"a":"a1","b":"b1"},{"a":"a2","b":"b2"}];
var to_columns = RMPApplication.transpose(rows); // {"a":["a1","a2"],"b":["b1","b2"]} 
var to_rows = RMPApplication.transpose(to_columns); // [{"a":"a1","b":"b1"},{"a":"a2","b":"b2"}]

# static uuid() → {string}

Generates an RFC4122 v4 UUID.
string
Example
"109156be-c4fb-41ea-b1b4-efe1671c5836"

# static validate(displayErrorBaropt) → {boolean}

Returns true if all mandatory fields are filled and match their pattern, otherwise false.
Parameters:
Name Type Attributes Default Description
displayErrorBar boolean <optional>
false If true, it displays a validation bar below the header bar of the web interface
boolean

Type Definitions

# customDateHandler(date) → {Object}

Update the default behaviour on computing the return date (including time) after the end user has just entering a date (without time) from the date input widget
Parameters:
Name Type Description
date object selected or typed date
computed datetime
Object

# listenerCallback(varName, varValue, P_index)

Callback called when the value of a variable is changed.
Parameters:
Name Type Description
varName string Variable name
varValue string Variable value
P_index number Index of the selected RMP_Array line (-1 if any)

# saveCallback()

Callback called after the web interface has been saved.

# widgetVisitor(widget, varValue, P_index)

Function applied to a widget.
Parameters:
Name Type Description
widget object Variable name
varValue string Variable value
P_index number Index of the selected RMP_Array line (-1 if any)