Custom functions can be registered to be
used inside an expression.
To register custom functions:
-
Click Edit > Functions.The Custom functions dialog opens with the list of currently registered custom functions.
-
To add a function, click Add and type the fully qualified Java™ class name in the text field.The new function is added to the list.If the function is valid, its name and description can be seen in the details area.To be valid, a custom function must meet the following two criteria:
- It must be a Java class implementing
ilog.views.sdm.renderer.IlvSDMCSSFunction
. - It must be already in the CLASSPATH of the Designer.
If the function name cannot be loaded into the JVM™ , a red warning is displayed in place of the name and short description. -
To remove a function, select it in the list and click Remove.
-
-
To accept the changes, click Apply.Note that only valid functions will be registered and shown by the Expression Assist. Any others will be removed.
Example:
-
Create a new diagram by clicking File > New.
-
Click Edit > Functions.
-
Click Add.
-
Type
ilog.views.sdm.renderer.IlvSDMCSSFunction$Test
in the “Add a new function” dialog box. -
Click OK.The new function appears in the list.The function is only for testing. It returns its first argument.
-
Click Apply.
-
In the diagram window, click one of the blue boxes.
-
In the Styling Customizer, at the right of the
name
property field, type+
.The Expression Assist displays a list of expression options. -
Select
testFunction
.The function is added in the expression. -
Inside the brackets, type
:up
. -
Press Enter to validate the expression.
All nodes have now
:up
appended to their label, for example
Node 1:up
.