Updating Custom Widgets

Updating Custom Widgets

Custom Widgets

There was a technology update to the JEXL Scripting language as part of the 5.4 release.

As part of the JEXL version update some changes may be required to your custom widgets on upgrade. 

Widget Builder Widgets

Widget Builder widgets should be unaffected by the JEXL update.  No steps should be needed for these widgets. 

Advanced Widgets

Advanced Widgets allow the Widget developer to hand code the JEXL block in the Widget definition file.  If you do not have any Advanced Widgets you can ignore these steps.

These Widgets are located in <InstallDir>/rxconfig/Widgets XML files.  The system will attempt to auto correct these issues in your widgets, but will report warnings in the <installDir>/jetty/base/logs/server.log file if a widget has syntax issues until the code is updated in the widget's XML definition file. 

Recommended Changes

Foreach Loops

The syntax for foreach loops has changed, replace all instances of:

foreach(object in list)

with

for(object : list)

Equals Whitespace Changes

$= and =$ are now keywords. See the Ends With operator.

 This means that any code like:

$myVar=$someOtherVar

Needs updated to place a space before and after the = symbol like:

$myVar = $someOtherVar

Note Ends With !$

!$ is now a special operator.  Existing code will need updated

For example:

if(!$myBooleanCondition) 

Needs updated to:

if( ! $myBooleanCondition )